mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
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:
@@ -101,11 +101,10 @@
|
||||
user.unset_machine()
|
||||
|
||||
/obj/machinery/computer/camera_advanced/Destroy()
|
||||
if(current_user)
|
||||
current_user.unset_machine()
|
||||
if(eyeobj)
|
||||
qdel(eyeobj)
|
||||
QDEL_NULL(eyeobj)
|
||||
QDEL_LIST(actions)
|
||||
current_user = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/camera_advanced/on_unset_machine(mob/M)
|
||||
|
||||
@@ -190,18 +190,21 @@
|
||||
ui_interact(user)
|
||||
|
||||
/mob/proc/unset_machine()
|
||||
if(machine)
|
||||
machine.on_unset_machine(src)
|
||||
machine = null
|
||||
if(!machine)
|
||||
return
|
||||
UnregisterSignal(machine, COMSIG_PARENT_QDELETING)
|
||||
machine.on_unset_machine(src)
|
||||
machine = null
|
||||
|
||||
//called when the user unsets the machine.
|
||||
/atom/movable/proc/on_unset_machine(mob/user)
|
||||
return
|
||||
|
||||
/mob/proc/set_machine(obj/O)
|
||||
if(src.machine)
|
||||
if(machine)
|
||||
unset_machine()
|
||||
src.machine = O
|
||||
machine = O
|
||||
RegisterSignal(O, COMSIG_PARENT_QDELETING, .proc/unset_machine)
|
||||
if(istype(O))
|
||||
O.obj_flags |= IN_USE
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -297,7 +297,6 @@
|
||||
|
||||
/obj/effect/chronos_cam/check_eye(mob/user)
|
||||
if(user != holder)
|
||||
user.unset_machine()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/chronos_cam/on_unset_machine(mob/user)
|
||||
|
||||
Reference in New Issue
Block a user