More harddel fixes + Tram sanity check (#57828)

* Fixes a harddel caused by the FUCKING MACHINE VAR WHAT THE FU-

* Fixes a tram related harddel, the proc that removed things from the riders list worked on stuff passed in by Uncrossed, but failed with the qdeleting signal. I've made a wrapper proc to better support these things, added signal handlers, and removed an if check that hid nulls (If it's breaking I need to know)
This commit is contained in:
LemonInTheDark
2021-03-20 05:46:04 -07:00
committed by GitHub
parent fbca3e697f
commit 2fad574a4e
4 changed files with 22 additions and 19 deletions
+12 -10
View File
@@ -163,7 +163,7 @@ GLOBAL_LIST_EMPTY(lifts)
. = ..()
RegisterSignal(src, COMSIG_MOVABLE_CROSSED, .proc/AddItemOnLift)
RegisterSignal(loc, COMSIG_ATOM_CREATED, .proc/AddItemOnLift)//For atoms created on platform
RegisterSignal(src, COMSIG_MOVABLE_UNCROSSED, .proc/RemoveItemFromLift)
RegisterSignal(src, COMSIG_MOVABLE_UNCROSSED, .proc/UncrossedRemoveItemFromLift)
RegisterSignal(src, COMSIG_MOVABLE_BUMP, .proc/GracefullyBreak)
if(!lift_master_datum)
@@ -174,13 +174,19 @@ GLOBAL_LIST_EMPTY(lifts)
. = ..()
RegisterSignal(loc, COMSIG_ATOM_CREATED, .proc/AddItemOnLift)//For atoms created on platform
/obj/structure/industrial_lift/proc/RemoveItemFromLift(datum/source, atom/movable/AM)
if(!(AM in lift_load))
/obj/structure/industrial_lift/proc/UncrossedRemoveItemFromLift(datum/source, atom/movable/potential_rider)
SIGNAL_HANDLER
RemoveItemFromLift(potential_rider)
/obj/structure/industrial_lift/proc/RemoveItemFromLift(atom/movable/potential_rider)
SIGNAL_HANDLER
if(!(potential_rider in lift_load))
return
LAZYREMOVE(lift_load, AM)
UnregisterSignal(AM, COMSIG_PARENT_QDELETING)
LAZYREMOVE(lift_load, potential_rider)
UnregisterSignal(potential_rider, COMSIG_PARENT_QDELETING)
/obj/structure/industrial_lift/proc/AddItemOnLift(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(istype(AM, /obj/structure/fluff/tram_rail))
return
if(AM in lift_load)
@@ -254,11 +260,7 @@ GLOBAL_LIST_EMPTY(lifts)
var/atom/throw_target = get_edge_target_turf(collided, turn(going, pick(45, -45)))
collided.throw_at(throw_target, 200, 4)
forceMove(destination)
for(var/am in things2move)
if(isnull(am))
LAZYREMOVE(lift_load, am)//after enough use, one of these always ends up inside despite signals. when they show, we need to scrub them out.
continue
var/atom/movable/thing = am
for(var/atom/movable/thing as anything in things2move)
thing.forceMove(destination)
/obj/structure/industrial_lift/proc/use(mob/living/user)