From 13149fa93a4933bee3d30e467ba28735fcc20343 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 11:56:59 -0700 Subject: [PATCH 01/12] Fixes runtimes from moving SSD/AFK people out of machines --- code/game/dna/dna_modifier.dm | 3 +++ code/game/machinery/Sleeper.dm | 3 +++ code/game/machinery/cryo.dm | 3 +++ code/game/machinery/cryopod.dm | 7 +++++++ code/game/machinery/machinery.dm | 5 +++++ code/game/machinery/suit_storage_unit.dm | 11 +++++++---- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index fb0ccff32cb..d887153c6d5 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -282,6 +282,9 @@ occupant = null icon_state = "scanner_open" +/obj/machinery/dna_scannernew/force_eject_occupant() + go_out(null, TRUE) + /obj/machinery/dna_scannernew/ex_act(severity) if(occupant) occupant.ex_act(severity) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index e4d0befa61e..7c5a03e29e6 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -411,6 +411,9 @@ for(var/atom/movable/A in contents - component_parts - list(beaker)) A.forceMove(loc) +/obj/machinery/sleeper/force_eject_occupant() + go_out() + /obj/machinery/sleeper/proc/inject_chemical(mob/living/user as mob, chemical, amount) if(!(chemical in possible_chems)) to_chat(user, "The sleeper does not offer that chemical!") diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 4213ff517bf..8be09ef30b7 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -443,6 +443,9 @@ for(var/atom/movable/A in contents - component_parts - list(beaker)) A.forceMove(get_step(loc, SOUTH)) +/obj/machinery/atmospherics/unary/cryo_cell/force_eject_occupant() + go_out() + /// Called when either the occupant is dead and the AUTO_EJECT_DEAD flag is present, OR the occupant is alive, has no external damage, and the AUTO_EJECT_HEALTHY flag is present. /obj/machinery/atmospherics/unary/cryo_cell/proc/auto_eject(eject_flag) on = FALSE diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 36196ea4eca..e0d53d61505 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -768,9 +768,16 @@ return ..() + /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() 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 f02e037e8c5..f1f66314dda 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -597,3 +597,8 @@ 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/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index da4df4f8382..98a50d0c69d 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -740,10 +740,11 @@ if(!occupant) return - if(user != occupant) - to_chat(occupant, "The machine kicks you out!") - if(user.loc != loc) - to_chat(occupant, "You leave the not-so-cozy confines of the SSU.") + if(user) + if(user != occupant) + to_chat(occupant, "The machine kicks you out!") + if(user.loc != loc) + to_chat(occupant, "You leave the not-so-cozy confines of the SSU.") occupant.forceMove(loc) occupant = null if(!state_open) @@ -751,6 +752,8 @@ update_icon() return +/obj/machinery/suit_storage_unit/force_eject_occupant() + eject_occupant() /obj/machinery/suit_storage_unit/verb/get_out() set name = "Eject Suit Storage Unit" From ef9d5bbe7c77d3536580155de51583071f336ae3 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 12:12:05 -0700 Subject: [PATCH 02/12] 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." From 5cb0288621dc34b46fdb2b4604a0be2399a96067 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 12:35:02 -0700 Subject: [PATCH 03/12] mechs too --- code/game/mecha/mecha.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 52973c9e285..ecdcd7179d0 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1264,6 +1264,9 @@ L.client.RemoveViewMod("mecha") zoom_mode = FALSE +/obj/mecha/force_eject_occupant() + go_out() + ///////////////////////// ////// Access stuff ///// ///////////////////////// From f4ac180b69c4b017bdd299c444b9181c490a3329 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 12:35:12 -0700 Subject: [PATCH 04/12] and admin GET --- code/modules/admin/verbs/adminjump.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 0c1a8c5f14f..980e5a60e25 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -111,6 +111,10 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)]", 1) + + if(istype(M.loc, /obj)) + var/obj/O = M.loc + O.force_eject_occupant() admin_forcemove(M, get_turf(usr)) feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -135,6 +139,9 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name(M)]", 1) if(M) + if(istype(M.loc, /obj)) + var/obj/O = M.loc + O.force_eject_occupant() admin_forcemove(M, get_turf(usr)) admin_forcemove(usr, M.loc) feedback_add_details("admin_verb","GK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! From 4f49695e961bad27e11a559439ffef41dd51f67f Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Jul 2020 12:43:21 -0700 Subject: [PATCH 05/12] travis newlines --- code/game/objects/objs.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index c0802eaa78a..19d3ecc8328 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -355,4 +355,5 @@ a { /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 + log_runtime(EXCEPTION("Proc force_eject_occupant() is not overriden on a machine containing a mob."), src) + From ce9945885bacd0264753a520c76845cea9363fde Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 22 Jul 2020 17:08:26 -0700 Subject: [PATCH 06/12] use isobj helper --- code/game/machinery/cryopod.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 3c33035f2c9..e102ba73221 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -772,7 +772,7 @@ /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)) + if(isobj(person_to_cryo.loc)) var/obj/O = person_to_cryo.loc O.force_eject_occupant() var/list/free_cryopods = list() From 53bb067ff5a7af822fe77d9d2a4107c243eb5839 Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 22 Jul 2020 19:18:37 -0700 Subject: [PATCH 07/12] Steel --- code/modules/admin/verbs/adminjump.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 980e5a60e25..8ba64859da1 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -112,7 +112,7 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)]", 1) - if(istype(M.loc, /obj)) + if(isobj(M.loc)) var/obj/O = M.loc O.force_eject_occupant() admin_forcemove(M, get_turf(usr)) @@ -139,7 +139,7 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name(M)]", 1) if(M) - if(istype(M.loc, /obj)) + if(isobj(M.loc)) var/obj/O = M.loc O.force_eject_occupant() admin_forcemove(M, get_turf(usr)) From 370ee8b9919012bd0253dd9c34b24cf4adc7515e Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 1 Aug 2020 10:34:06 -0700 Subject: [PATCH 08/12] Fixes #13132 --- code/datums/diseases/transformation.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/datums/diseases/transformation.dm b/code/datums/diseases/transformation.dm index f619e9aa9bd..3e3e1696e61 100644 --- a/code/datums/diseases/transformation.dm +++ b/code/datums/diseases/transformation.dm @@ -57,6 +57,9 @@ W.plane = initial(W.plane) W.loc = affected_mob.loc W.dropped(affected_mob) + if(isobj(affected_mob.loc)) + var/obj/O = affected_mob.loc + O.force_eject_occupant() var/mob/living/new_mob = new new_form(affected_mob.loc) if(istype(new_mob)) new_mob.a_intent = "harm" From aa36e21c29577e6c5d643d9fb8fac9a16d3b1f07 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 1 Aug 2020 10:45:27 -0700 Subject: [PATCH 09/12] also support bodyscanners --- code/game/machinery/adv_med.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 1ee30b6e9d0..3fa78dd02e6 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -172,6 +172,9 @@ for(var/atom/movable/A in contents - component_parts) A.forceMove(loc) +/obj/machinery/bodyscanner/force_eject_occupant() + go_out() + /obj/machinery/bodyscanner/ex_act(severity) if(occupant) occupant.ex_act(severity) From 4a21768bba437a1e0d5f200c57d15cee23f44570 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 1 Aug 2020 11:04:24 -0700 Subject: [PATCH 10/12] updates comment --- code/game/objects/objs.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 19d3ecc8328..2633848d35e 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -353,7 +353,7 @@ a { 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. + // This proc handles safely removing occupant mobs from the object if they must be teleported out (due to being SSD/AFK, by admin teleport, etc) or transformed. // 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) From 0aaba82b5bf54b9f063ba94fe457cc5a3feb965a Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 1 Aug 2020 11:17:34 -0700 Subject: [PATCH 11/12] add support for more admin teleport commands --- code/modules/admin/verbs/adminjump.dm | 20 +++++++++++++++++++- code/modules/admin/verbs/debug.dm | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 8ba64859da1..ca83b5bad08 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -22,6 +22,10 @@ to_chat(src, "Nowhere to jump to!") return + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() + admin_forcemove(usr, T) log_admin("[key_name(usr)] jumped to [A]") if(!isobserver(usr)) @@ -35,6 +39,9 @@ if(!check_rights(R_ADMIN)) return + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() log_admin("[key_name(usr)] jumped to [T.x], [T.y], [T.z] in [T.loc]") if(!isobserver(usr)) message_admins("[key_name_admin(usr)] jumped to [T.x], [T.y], [T.z] in [T.loc]", 1) @@ -52,6 +59,9 @@ log_admin("[key_name(usr)] jumped to [key_name(M)]") if(!isobserver(usr)) message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1) + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() if(src.mob) var/mob/A = src.mob var/turf/T = get_turf(M) @@ -70,6 +80,9 @@ var/turf/T = locate(tx, ty, tz) if(T) + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() admin_forcemove(usr, T) if(isobserver(usr)) var/mob/dead/observer/O = usr @@ -96,7 +109,9 @@ log_admin("[key_name(usr)] jumped to [key_name(M)]") if(!isobserver(usr)) message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1) - + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() admin_forcemove(usr, M.loc) feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -155,6 +170,9 @@ var/area/A = input(usr, "Pick an area.", "Pick an area") in return_sorted_areas() if(A) + if(isobj(M.loc)) + var/obj/O = M.loc + O.force_eject_occupant() admin_forcemove(M, pick(get_area_turfs(A))) feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] teleported [key_name(M)] to [A]") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 424e3c91f57..770ce952b21 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -917,6 +917,9 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention) if(istype(landmark)) var/datum/map_template/ruin/template = landmark.ruin_template + if(isobj(usr.loc)) + var/obj/O = usr.loc + O.force_eject_occupant() admin_forcemove(usr, get_turf(landmark)) to_chat(usr, "[template.name]") From 2a8df407416ba04d7954862a5e74e1a578b3781e Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 10 Aug 2020 12:53:14 -0700 Subject: [PATCH 12/12] AA requests --- code/game/machinery/suit_storage_unit.dm | 2 +- code/game/objects/objs.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 98a50d0c69d..cd6b33d0a95 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -744,7 +744,7 @@ if(user != occupant) to_chat(occupant, "The machine kicks you out!") if(user.loc != loc) - to_chat(occupant, "You leave the not-so-cozy confines of the SSU.") + to_chat(occupant, "You leave the not-so-cozy confines of [src].") occupant.forceMove(loc) occupant = null if(!state_open) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 2633848d35e..7a56c53f73a 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -355,5 +355,5 @@ a { /obj/proc/force_eject_occupant() // This proc handles safely removing occupant mobs from the object if they must be teleported out (due to being SSD/AFK, by admin teleport, etc) or transformed. // 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) + CRASH("Proc force_eject_occupant() is not overriden on a machine containing a mob.")