From ef9d5bbe7c77d3536580155de51583071f336ae3 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 12:12:05 -0700 Subject: [PATCH] refactor --- code/game/machinery/cryopod.dm | 9 +++------ code/game/machinery/machinery.dm | 5 ----- code/game/objects/objs.dm | 5 +++++ code/game/objects/structures/crates_lockers/closets.dm | 5 +++++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index e0d53d61505..3c33035f2c9 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -772,12 +772,9 @@ /proc/cryo_ssd(var/mob/living/carbon/person_to_cryo) if(istype(person_to_cryo.loc, /obj/machinery/cryopod)) return 0 - if(istype(person_to_cryo.loc, /obj/mecha)) - var/obj/mecha/E = person_to_cryo.loc - E.go_out() - if(istype(person_to_cryo.loc, /obj/machinery)) - var/obj/machinery/E = person_to_cryo.loc - E.force_eject_occupant() + if(istype(person_to_cryo.loc, /obj)) + var/obj/O = person_to_cryo.loc + O.force_eject_occupant() var/list/free_cryopods = list() for(var/obj/machinery/cryopod/P in GLOB.machines) if(!P.occupant && istype(get_area(P), /area/crew_quarters/sleep)) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index f1f66314dda..f02e037e8c5 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -597,8 +597,3 @@ Class Procs: . = . % 9 AM.pixel_x = -8 + ((.%3)*8) AM.pixel_y = -8 + (round( . / 3)*8) - -/obj/machinery/proc/force_eject_occupant() - // For each subtype of /machinery, this proc handles safely removing occupants from the machine if they must be cryoed due to being SSD/AFK. - // In the event that the machinery doesn't have an overriden version of this proc to do it, log a runtime so one can be added. - log_runtime(EXCEPTION("Proc force_eject_occupant() is not overriden on a machine containing a mob."), src) \ No newline at end of file diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index d40c628ed90..c0802eaa78a 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -351,3 +351,8 @@ a { /obj/proc/check_uplink_validity() return TRUE + +/obj/proc/force_eject_occupant() + // This proc handles safely removing occupants from the object if they must be cryoed due to being SSD/AFK. + // In the event that the object doesn't have an overriden version of this proc to do it, log a runtime so one can be added. + log_runtime(EXCEPTION("Proc force_eject_occupant() is not overriden on a machine containing a mob."), src) \ No newline at end of file diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 04373502832..6db1846e872 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -354,6 +354,11 @@ /obj/structure/closet/AllowDrop() return TRUE +/obj/structure/closet/force_eject_occupant() + // Its okay to silently teleport mobs out of lockers, since the only thing affected is their contents list. + return + + /obj/structure/closet/bluespace name = "bluespace closet" desc = "A storage unit that moves and stores through the fourth dimension."