mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Refactored go-kart code (#29938)
* Refactored go-kart code * Go-karts explode fuel tanks * Improved speen(), correctly reset fucked up offsets when leaving vehicles * Even better speen()
This commit is contained in:
@@ -206,9 +206,6 @@ var/global/list/ghdel_profiling = list()
|
|||||||
if(T)
|
if(T)
|
||||||
T.densityChanged()
|
T.densityChanged()
|
||||||
|
|
||||||
/atom/proc/bumped_by_firebird(var/obj/structure/bed/chair/vehicle/firebird/F)
|
|
||||||
return Bumped(F)
|
|
||||||
|
|
||||||
// Convenience proc to see if a container is open for chemistry handling
|
// Convenience proc to see if a container is open for chemistry handling
|
||||||
// returns true if open
|
// returns true if open
|
||||||
// false if closed
|
// false if closed
|
||||||
|
|||||||
@@ -1193,3 +1193,13 @@
|
|||||||
target = get_turf(target_loc)
|
target = get_turf(target_loc)
|
||||||
|
|
||||||
current_tick = 1
|
current_tick = 1
|
||||||
|
|
||||||
|
|
||||||
|
/atom/movable/proc/speen(times = 4)
|
||||||
|
set waitfor = FALSE
|
||||||
|
var/prev_dir = dir
|
||||||
|
for(var/i in 1 to times)
|
||||||
|
for(var/new_dir in cardinal)
|
||||||
|
change_dir(new_dir)
|
||||||
|
sleep(1)
|
||||||
|
change_dir(prev_dir)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
/obj/item/stack/tile/mineral/phazon/adjust_slowdown(mob/living/L, current_slowdown)
|
/obj/item/stack/tile/mineral/phazon/adjust_slowdown(mob/living/L, current_slowdown)
|
||||||
current_slowdown *= 0.75
|
current_slowdown *= 0.75
|
||||||
..()
|
return ..()
|
||||||
|
|
||||||
/obj/item/stack/tile/mineral/brass
|
/obj/item/stack/tile/mineral/brass
|
||||||
name = "brass tile"
|
name = "brass tile"
|
||||||
|
|||||||
@@ -13,6 +13,16 @@
|
|||||||
if(slip_n_slide(M))
|
if(slip_n_slide(M))
|
||||||
M.simple_message("<span class='notice'>You slipped on the [name]!</span>",
|
M.simple_message("<span class='notice'>You slipped on the [name]!</span>",
|
||||||
"<span class='userdanger'>Something is scratching at your feet! Oh god!</span>")
|
"<span class='userdanger'>Something is scratching at your feet! Oh god!</span>")
|
||||||
|
if(istype(AM, /obj/structure/bed/chair/vehicle/gokart))
|
||||||
|
var/obj/structure/bed/chair/vehicle/gokart/kart = AM
|
||||||
|
var/left_or_right = prob(50) ? turn(kart.dir, 90) : turn(kart.dir, -90)
|
||||||
|
var/tiles_to_slip = rand(round(potency/20, 1), round(potency/10, 1))
|
||||||
|
kart.speen()
|
||||||
|
playsound(src, 'sound/misc/slip.ogg', 50, 1, -3)
|
||||||
|
spawn()
|
||||||
|
for(var/i in 1 to tiles_to_slip)
|
||||||
|
step(kart, left_or_right)
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
/datum/locking_category/banana_peel
|
/datum/locking_category/banana_peel
|
||||||
|
|
||||||
|
|||||||
@@ -320,8 +320,10 @@
|
|||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/obj/structure/table/bumped_by_firebird(obj/structure/bed/chair/vehicle/firebird/F)
|
/obj/structure/table/Bumped(atom/movable/AM)
|
||||||
destroy()
|
..()
|
||||||
|
if(istype(AM, /obj/structure/bed/chair/vehicle/firebird))
|
||||||
|
destroy()
|
||||||
|
|
||||||
//checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops.
|
//checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops.
|
||||||
/obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from)
|
/obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from)
|
||||||
@@ -778,8 +780,10 @@ obj/structure/table/plastic
|
|||||||
return 1
|
return 1
|
||||||
return !density
|
return !density
|
||||||
|
|
||||||
/obj/structure/rack/bumped_by_firebird(obj/structure/bed/chair/vehicle/firebird/F)
|
/obj/structure/rack/Bumped(atom/movable/AM)
|
||||||
destroy()
|
..()
|
||||||
|
if(istype(AM, /obj/structure/bed/chair/vehicle/firebird))
|
||||||
|
destroy()
|
||||||
|
|
||||||
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||||
if(W.is_wrench(user) && can_disassemble())
|
if(W.is_wrench(user) && can_disassemble())
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
plane = ABOVE_HUMAN_PLANE
|
plane = ABOVE_HUMAN_PLANE
|
||||||
pass_flags = PASSMOB|PASSDOOR
|
pass_flags = PASSMOB|PASSDOOR
|
||||||
wreckage_type = /obj/effect/decal/mecha_wreckage/vehicle/firebird
|
wreckage_type = /obj/effect/decal/mecha_wreckage/vehicle/firebird
|
||||||
|
explodes_fueltanks = TRUE
|
||||||
var/datum/effect/effect/system/trail/firebird/ion_trail
|
var/datum/effect/effect/system/trail/firebird/ion_trail
|
||||||
|
|
||||||
/obj/structure/bed/chair/vehicle/firebird/New()
|
/obj/structure/bed/chair/vehicle/firebird/New()
|
||||||
@@ -61,12 +61,6 @@
|
|||||||
/obj/structure/bed/chair/vehicle/firebird/handle_layer()
|
/obj/structure/bed/chair/vehicle/firebird/handle_layer()
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/structure/bed/chair/vehicle/firebird/to_bump(var/atom/obstacle)
|
|
||||||
if(throwing)
|
|
||||||
return ..()
|
|
||||||
else
|
|
||||||
return obstacle.bumped_by_firebird(src) //Yep
|
|
||||||
|
|
||||||
/obj/structure/bed/chair/vehicle/firebird/santa
|
/obj/structure/bed/chair/vehicle/firebird/santa
|
||||||
name = "magic snowmobile"
|
name = "magic snowmobile"
|
||||||
desc = "After a complaint from space PETA, santa's been forced to take a less elegant ride."
|
desc = "After a complaint from space PETA, santa's been forced to take a less elegant ride."
|
||||||
|
|||||||
@@ -12,6 +12,13 @@
|
|||||||
noghostspin = 0
|
noghostspin = 0
|
||||||
can_have_carts = FALSE
|
can_have_carts = FALSE
|
||||||
wreckage_type = /obj/effect/decal/mecha_wreckage/vehicle/gokart
|
wreckage_type = /obj/effect/decal/mecha_wreckage/vehicle/gokart
|
||||||
|
explodes_fueltanks = TRUE
|
||||||
|
|
||||||
|
/obj/structure/bed/chair/vehicle/gokart/getMovementDelay()
|
||||||
|
. = ..()
|
||||||
|
var/turf/here = get_turf(src)
|
||||||
|
if(here)
|
||||||
|
return here.adjust_slowdown(src, .)
|
||||||
|
|
||||||
/obj/structure/bed/chair/vehicle/gokart/unlock_atom(var/atom/movable/AM)
|
/obj/structure/bed/chair/vehicle/gokart/unlock_atom(var/atom/movable/AM)
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
var/list/datum/action/vehicle_actions = list()
|
var/list/datum/action/vehicle_actions = list()
|
||||||
|
|
||||||
var/headlights = FALSE
|
var/headlights = FALSE
|
||||||
|
var/explodes_fueltanks = FALSE
|
||||||
|
|
||||||
/obj/structure/bed/chair/vehicle/proc/getMovementDelay()
|
/obj/structure/bed/chair/vehicle/proc/getMovementDelay()
|
||||||
return movement_delay
|
return movement_delay
|
||||||
@@ -421,8 +422,8 @@
|
|||||||
if(!.)
|
if(!.)
|
||||||
return
|
return
|
||||||
|
|
||||||
AM.pixel_x -= offsets["[dir]"]["x"]
|
AM.pixel_x = initial(AM.pixel_x)
|
||||||
AM.pixel_y -= offsets["[dir]"]["y"]
|
AM.pixel_y = initial(AM.pixel_y)
|
||||||
|
|
||||||
last_dir = null
|
last_dir = null
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,7 @@
|
|||||||
/datum/emote/spin/run_emote(mob/user)
|
/datum/emote/spin/run_emote(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(.)
|
if(.)
|
||||||
var/prev_dir = user.dir
|
user.speen()
|
||||||
for(var/i in list(1, 4, 2, 8, 1, 4, 2, 8, 1, 4, 2, 8, 1, 4, 2, 8))
|
|
||||||
user.dir = i
|
|
||||||
sleep(1)
|
|
||||||
user.dir = prev_dir
|
|
||||||
|
|
||||||
/datum/emote/me
|
/datum/emote/me
|
||||||
key = "me"
|
key = "me"
|
||||||
|
|||||||
@@ -194,9 +194,13 @@
|
|||||||
if(exposed_temperature >= AUTOIGNITION_WELDERFUEL)
|
if(exposed_temperature >= AUTOIGNITION_WELDERFUEL)
|
||||||
explode()
|
explode()
|
||||||
|
|
||||||
/obj/structure/reagent_dispensers/fueltank/bumped_by_firebird(var/obj/structure/bed/chair/vehicle/firebird/F)
|
/obj/structure/reagent_dispensers/fueltank/Bumped(atom/movable/AM)
|
||||||
visible_message("<span class='danger'>\the [F] crashes into \the [src]!</span>")
|
..()
|
||||||
explode()
|
if(istype(AM, /obj/structure/bed/chair/vehicle))
|
||||||
|
var/obj/structure/bed/chair/vehicle/car = AM
|
||||||
|
if(car.explodes_fueltanks)
|
||||||
|
visible_message("<span class='danger'>\The [car] crashes into \the [src]!</span>")
|
||||||
|
explode()
|
||||||
|
|
||||||
/obj/structure/reagent_dispensers/fueltank/proc/explode()
|
/obj/structure/reagent_dispensers/fueltank/proc/explode()
|
||||||
if (reagents.total_volume > 500)
|
if (reagents.total_volume > 500)
|
||||||
|
|||||||
Reference in New Issue
Block a user