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)
|
||||
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
|
||||
// returns true if open
|
||||
// false if closed
|
||||
|
||||
@@ -1193,3 +1193,13 @@
|
||||
target = get_turf(target_loc)
|
||||
|
||||
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)
|
||||
current_slowdown *= 0.75
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/tile/mineral/brass
|
||||
name = "brass tile"
|
||||
|
||||
@@ -13,6 +13,16 @@
|
||||
if(slip_n_slide(M))
|
||||
M.simple_message("<span class='notice'>You slipped on the [name]!</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
|
||||
|
||||
|
||||
@@ -320,8 +320,10 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/table/bumped_by_firebird(obj/structure/bed/chair/vehicle/firebird/F)
|
||||
destroy()
|
||||
/obj/structure/table/Bumped(atom/movable/AM)
|
||||
..()
|
||||
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.
|
||||
/obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from)
|
||||
@@ -778,8 +780,10 @@ obj/structure/table/plastic
|
||||
return 1
|
||||
return !density
|
||||
|
||||
/obj/structure/rack/bumped_by_firebird(obj/structure/bed/chair/vehicle/firebird/F)
|
||||
destroy()
|
||||
/obj/structure/rack/Bumped(atom/movable/AM)
|
||||
..()
|
||||
if(istype(AM, /obj/structure/bed/chair/vehicle/firebird))
|
||||
destroy()
|
||||
|
||||
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.is_wrench(user) && can_disassemble())
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
plane = ABOVE_HUMAN_PLANE
|
||||
pass_flags = PASSMOB|PASSDOOR
|
||||
wreckage_type = /obj/effect/decal/mecha_wreckage/vehicle/firebird
|
||||
|
||||
explodes_fueltanks = TRUE
|
||||
var/datum/effect/effect/system/trail/firebird/ion_trail
|
||||
|
||||
/obj/structure/bed/chair/vehicle/firebird/New()
|
||||
@@ -61,12 +61,6 @@
|
||||
/obj/structure/bed/chair/vehicle/firebird/handle_layer()
|
||||
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
|
||||
name = "magic snowmobile"
|
||||
desc = "After a complaint from space PETA, santa's been forced to take a less elegant ride."
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
noghostspin = 0
|
||||
can_have_carts = FALSE
|
||||
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)
|
||||
. = ..()
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
var/list/datum/action/vehicle_actions = list()
|
||||
|
||||
var/headlights = FALSE
|
||||
var/explodes_fueltanks = FALSE
|
||||
|
||||
/obj/structure/bed/chair/vehicle/proc/getMovementDelay()
|
||||
return movement_delay
|
||||
@@ -421,8 +422,8 @@
|
||||
if(!.)
|
||||
return
|
||||
|
||||
AM.pixel_x -= offsets["[dir]"]["x"]
|
||||
AM.pixel_y -= offsets["[dir]"]["y"]
|
||||
AM.pixel_x = initial(AM.pixel_x)
|
||||
AM.pixel_y = initial(AM.pixel_y)
|
||||
|
||||
last_dir = null
|
||||
|
||||
|
||||
@@ -42,11 +42,7 @@
|
||||
/datum/emote/spin/run_emote(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
var/prev_dir = user.dir
|
||||
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
|
||||
user.speen()
|
||||
|
||||
/datum/emote/me
|
||||
key = "me"
|
||||
|
||||
@@ -194,9 +194,13 @@
|
||||
if(exposed_temperature >= AUTOIGNITION_WELDERFUEL)
|
||||
explode()
|
||||
|
||||
/obj/structure/reagent_dispensers/fueltank/bumped_by_firebird(var/obj/structure/bed/chair/vehicle/firebird/F)
|
||||
visible_message("<span class='danger'>\the [F] crashes into \the [src]!</span>")
|
||||
explode()
|
||||
/obj/structure/reagent_dispensers/fueltank/Bumped(atom/movable/AM)
|
||||
..()
|
||||
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()
|
||||
if (reagents.total_volume > 500)
|
||||
|
||||
Reference in New Issue
Block a user