Fixes runtimes from moving SSD/AFK people out of machines

This commit is contained in:
Kyep
2020-07-21 11:56:59 -07:00
parent f1dbb39f87
commit 13149fa93a
6 changed files with 28 additions and 4 deletions
+3
View File
@@ -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)
+3
View File
@@ -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, "<span class='notice'>The sleeper does not offer that chemical!</span>")
+3
View File
@@ -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
+7
View File
@@ -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))
+5
View File
@@ -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)
+7 -4
View File
@@ -740,10 +740,11 @@
if(!occupant)
return
if(user != occupant)
to_chat(occupant, "<span class='warning'>The machine kicks you out!</span>")
if(user.loc != loc)
to_chat(occupant, "<span class='warning'>You leave the not-so-cozy confines of the SSU.</span>")
if(user)
if(user != occupant)
to_chat(occupant, "<span class='warning'>The machine kicks you out!</span>")
if(user.loc != loc)
to_chat(occupant, "<span class='warning'>You leave the not-so-cozy confines of the SSU.</span>")
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"