diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index f38fc091a9d..76da0bab45c 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -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) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 721bfff1c60..fc3df6bb3b3 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -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 diff --git a/code/game/objects/structures/industrial_lift.dm b/code/game/objects/structures/industrial_lift.dm index 150412f642d..b7fd1addebb 100644 --- a/code/game/objects/structures/industrial_lift.dm +++ b/code/game/objects/structures/industrial_lift.dm @@ -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) diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index 0f197adc659..910190b7790 100644 --- a/code/modules/clothing/spacesuits/chronosuit.dm +++ b/code/modules/clothing/spacesuits/chronosuit.dm @@ -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)