diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm
index 9b22f0e2dd5..80792c53f96 100644
--- a/code/game/objects/structures/morgue.dm
+++ b/code/game/objects/structures/morgue.dm
@@ -21,10 +21,10 @@
anchored = 1.0
/obj/structure/morgue/proc/update()
- if(src.connected)
- src.icon_state = "morgue0"
+ if(connected)
+ icon_state = "morgue0"
else
- if(src.contents.len)
+ if(contents.len)
var/mob/living/M = locate() in contents
@@ -35,14 +35,14 @@
var/mob/dead/observer/G = M.get_ghost()
if(M.client)
- src.icon_state = "morgue3"
+ icon_state = "morgue3"
else if(G && G.client) //There is a ghost and it is connected to the server
- src.icon_state = "morgue5"
+ icon_state = "morgue5"
else
- src.icon_state = "morgue2"
+ icon_state = "morgue2"
- else src.icon_state = "morgue4"
- else src.icon_state = "morgue1"
+ else icon_state = "morgue4"
+ else icon_state = "morgue1"
return
@@ -50,94 +50,99 @@
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
if(2.0)
if (prob(50))
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
if(3.0)
if (prob(5))
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
return
/obj/structure/morgue/alter_health()
- return src.loc
+ return loc
/obj/structure/morgue/attack_hand(mob/user as mob)
- if (src.connected)
- for(var/atom/movable/A as mob|obj in src.connected.loc)
+ if (connected)
+ for(var/atom/movable/A as mob|obj in connected.loc)
if (!( A.anchored ))
A.loc = src
- playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
- //src.connected = null
- qdel(src.connected)
+ playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
+ qdel(connected)
+ connected = null
else
- playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
- src.connected = new /obj/structure/m_tray( src.loc )
- step(src.connected, src.dir)
- src.connected.layer = OBJ_LAYER
- var/turf/T = get_step(src, src.dir)
- if (T.contents.Find(src.connected))
- src.connected.connected = src
- src.icon_state = "morgue0"
+ playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
+ connected = new /obj/structure/m_tray( loc )
+ step(connected, dir)
+ connected.layer = OBJ_LAYER
+ var/turf/T = get_step(src, dir)
+ if (T.contents.Find(connected))
+ connected.connected = src
+ icon_state = "morgue0"
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.connected.loc
- src.connected.icon_state = "morguet"
- src.connected.dir = src.dir
+ A.loc = connected.loc
+ connected.icon_state = "morguet"
+ connected.dir = dir
else
- //src.connected = null
- qdel(src.connected)
- src.add_fingerprint(user)
+ qdel(connected)
+ connected = null
+ add_fingerprint(user)
update()
return
/obj/structure/morgue/attackby(P as obj, mob/user as mob, params)
if (istype(P, /obj/item/weapon/pen))
- var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
+ var/t = input(user, "What would you like the label to be?", text("[]", name), null) as text
if (user.get_active_hand() != P)
return
- if ((!in_range(src, usr) && src.loc != user))
+ if ((!in_range(src, usr) && loc != user))
return
t = sanitize(copytext(t,1,MAX_MESSAGE_LEN))
if (t)
- src.name = text("Morgue- '[]'", t)
- src.overlays += image(src.icon, "morgue_label")
+ name = text("Morgue- '[]'", t)
+ overlays += image(icon, "morgue_label")
else
- src.name = "Morgue"
- src.overlays.Cut()
- src.add_fingerprint(user)
+ name = "Morgue"
+ overlays.Cut()
+ add_fingerprint(user)
return
/obj/structure/morgue/relaymove(mob/user as mob)
if (user.stat)
return
- src.connected = new /obj/structure/m_tray( src.loc )
- step(src.connected, EAST)
- src.connected.layer = OBJ_LAYER
+ connected = new /obj/structure/m_tray( loc )
+ step(connected, EAST)
+ connected.layer = OBJ_LAYER
var/turf/T = get_step(src, EAST)
- if (T.contents.Find(src.connected))
- src.connected.connected = src
- src.icon_state = "morgue0"
+ if (T.contents.Find(connected))
+ connected.connected = src
+ icon_state = "morgue0"
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.connected.loc
- //Foreach goto(106)
- src.connected.icon_state = "morguet"
+ A.loc = connected.loc
+ connected.icon_state = "morguet"
else
- //src.connected = null
- qdel(src.connected)
+ qdel(connected)
+ connected = null
return
+/obj/structure/morgue/Destroy()
+ if(connected)
+ qdel(connected)
+ connected = null
+ return ..()
+
/*
* Morgue tray
@@ -155,15 +160,13 @@
/obj/structure/m_tray/attack_hand(mob/user as mob)
- if (src.connected)
- for(var/atom/movable/A as mob|obj in src.loc)
+ if (connected)
+ for(var/atom/movable/A as mob|obj in loc)
if (!( A.anchored ))
- A.loc = src.connected
- //Foreach goto(26)
- src.connected.connected = null
- src.connected.update()
+ A.loc = connected
+ connected.connected = null
+ connected.update()
add_fingerprint(user)
- //SN src = null
qdel(src)
return
return
@@ -175,13 +178,19 @@
return
if (!ismob(user) || user.stat || user.lying || user.stunned)
return
- O.loc = src.loc
+ O.loc = loc
if (user != O)
for(var/mob/B in viewers(user, 3))
if ((B.client && !( B.blinded )))
B << text("\red [] stuffs [] into []!", user, O, src)
return
+/obj/structure/m_tray/Destroy()
+ if(connected && connected.connected == src)
+ connected.connected = null
+ connected = null
+ return ..()
+
/*
* Crematorium
@@ -200,116 +209,106 @@
var/locked = 0
/obj/structure/crematorium/proc/update()
- if (src.connected)
- src.icon_state = "crema0"
+ if (connected)
+ icon_state = "crema0"
else
- if (src.contents.len)
- src.icon_state = "crema2"
+ if (contents.len)
+ icon_state = "crema2"
else
- src.icon_state = "crema1"
+ icon_state = "crema1"
return
/obj/structure/crematorium/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
if(2.0)
if (prob(50))
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
if(3.0)
if (prob(5))
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.loc
+ A.loc = loc
ex_act(severity)
qdel(src)
return
return
/obj/structure/crematorium/alter_health()
- return src.loc
+ return loc
/obj/structure/crematorium/attack_hand(mob/user as mob)
-// if (cremating) AWW MAN! THIS WOULD BE SO MUCH MORE FUN ... TO WATCH
-// user.show_message("\red Uh-oh, that was a bad idea.", 1)
-// //usr << "Uh-oh, that was a bad idea."
-// src:loc:poison += 20000000
-// src:loc:firelevel = src:loc:poison
-// return
if (cremating)
usr << "\red It's locked."
return
- if ((src.connected) && (src.locked == 0))
- for(var/atom/movable/A as mob|obj in src.connected.loc)
+ if ((connected) && (locked == 0))
+ for(var/atom/movable/A as mob|obj in connected.loc)
if (!( A.anchored ))
A.loc = src
- playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
- //src.connected = null
- qdel(src.connected)
- else if (src.locked == 0)
- playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
- src.connected = new /obj/structure/c_tray( src.loc )
- step(src.connected, SOUTH)
- src.connected.layer = OBJ_LAYER
+ playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
+ qdel(connected)
+ connected = null
+ else if (locked == 0)
+ playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
+ connected = new /obj/structure/c_tray( loc )
+ step(connected, SOUTH)
+ connected.layer = OBJ_LAYER
var/turf/T = get_step(src, SOUTH)
- if (T.contents.Find(src.connected))
- src.connected.connected = src
- src.icon_state = "crema0"
+ if (T.contents.Find(connected))
+ connected.connected = src
+ icon_state = "crema0"
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.connected.loc
- src.connected.icon_state = "cremat"
+ A.loc = connected.loc
+ connected.icon_state = "cremat"
else
- //src.connected = null
- qdel(src.connected)
- src.add_fingerprint(user)
+ qdel(connected)
+ connected = null
+ add_fingerprint(user)
update()
/obj/structure/crematorium/attackby(P as obj, mob/user as mob, params)
if (istype(P, /obj/item/weapon/pen))
- var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
+ var/t = input(user, "What would you like the label to be?", text("[]", name), null) as text
if (user.get_active_hand() != P)
return
- if ((!in_range(src, usr) > 1 && src.loc != user))
+ if ((!in_range(src, usr) > 1 && loc != user))
return
t = sanitize(copytext(t,1,MAX_MESSAGE_LEN))
if (t)
- src.name = text("Crematorium- '[]'", t)
+ name = text("Crematorium- '[]'", t)
else
- src.name = "Crematorium"
- src.add_fingerprint(user)
+ name = "Crematorium"
+ add_fingerprint(user)
return
/obj/structure/crematorium/relaymove(mob/user as mob)
if (user.stat || locked)
return
- src.connected = new /obj/structure/c_tray( src.loc )
- step(src.connected, SOUTH)
- src.connected.layer = OBJ_LAYER
+ connected = new /obj/structure/c_tray( loc )
+ step(connected, SOUTH)
+ connected.layer = OBJ_LAYER
var/turf/T = get_step(src, SOUTH)
- if (T.contents.Find(src.connected))
- src.connected.connected = src
- src.icon_state = "crema0"
+ if (T.contents.Find(connected))
+ connected.connected = src
+ icon_state = "crema0"
for(var/atom/movable/A as mob|obj in src)
- A.loc = src.connected.loc
- //Foreach goto(106)
- src.connected.icon_state = "cremat"
+ A.loc = connected.loc
+ connected.icon_state = "cremat"
else
- //src.connected = null
- qdel(src.connected)
+ qdel(connected)
+ connected = null
return
-/obj/structure/crematorium/proc/cremate(atom/A, mob/user as mob)
-// for(var/obj/machinery/crema_switch/O in src) //trying to figure a way to call the switch, too drunk to sort it out atm
-// if(var/on == 1)
-// return
+/obj/structure/crematorium/proc/cremate(mob/user as mob)
if(cremating)
return //don't let you cremate something twice or w/e
@@ -319,10 +318,10 @@
return
else
- if(!isemptylist(src.search_contents_for(/obj/item/weapon/disk/nuclear)))
+ if(!isemptylist(search_contents_for(/obj/item/weapon/disk/nuclear)))
usr << "You get the feeling that you shouldn't cremate one of the items in the cremator."
return
- if(!isemptylist(src.search_contents_for(/obj/item/flag/nation)))
+ if(!isemptylist(search_contents_for(/obj/item/flag/nation)))
usr << "You get the feeling that you shouldn't cremate one of the items in the cremator."
return
for (var/mob/M in viewers(src))
@@ -335,10 +334,10 @@
for(var/mob/living/M in contents)
if (M.stat!=2)
M.emote("scream")
- //Logging for this causes runtimes resulting in the cremator locking up. Commenting it out until that's figured out.
- //M.attack_log += "\[[time_stamp()]\] Has been cremated by [user]/[user.ckey]" //No point in this when the mob's about to be deleted
- //user.attack_log +="\[[time_stamp()]\] Cremated [M]/[M.ckey]"
- //log_attack("\[[time_stamp()]\] [user]/[user.ckey] cremated [M]/[M.ckey]")
+ if(istype(user))
+ M.attack_log += "\[[time_stamp()]\] Has been cremated by [user]/[user.ckey]"
+ user.attack_log +="\[[time_stamp()]\] Cremated [M]/[M.ckey]"
+ log_attack("\[[time_stamp()]\] [user]/[user.ckey] cremated [M]/[M.ckey]")
M.death(1)
M.ghostize()
qdel(M)
@@ -351,9 +350,15 @@
cremating = 0
locked = 0
update()
- playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
+ playsound(loc, 'sound/machines/ding.ogg', 50, 1)
return
+/obj/structure/crematorium/Destroy()
+ if(connected)
+ qdel(connected)
+ connected = null
+ return ..()
+
/*
* Crematorium tray
@@ -370,15 +375,14 @@
throwpass = 1
/obj/structure/c_tray/attack_hand(mob/user as mob)
- if (src.connected)
- for(var/atom/movable/A as mob|obj in src.loc)
+ if (connected)
+ for(var/atom/movable/A as mob|obj in loc)
if (!( A.anchored ))
- A.loc = src.connected
+ A.loc = connected
//Foreach goto(26)
- src.connected.connected = null
- src.connected.update()
+ connected.connected = null
+ connected.update()
add_fingerprint(user)
- //SN src = null
qdel(src)
return
return
@@ -390,7 +394,7 @@
return
if (!ismob(user) || user.stat || user.lying || user.stunned)
return
- O.loc = src.loc
+ O.loc = loc
if (user != O)
for(var/mob/B in viewers(user, 3))
if ((B.client && !( B.blinded )))
@@ -398,8 +402,14 @@
//Foreach goto(99)
return
+/obj/structure/m_tray/Destroy()
+ if(connected && connected.connected == src)
+ connected.connected = null
+ connected = null
+ return ..()
+
/obj/machinery/crema_switch/attack_hand(mob/user as mob)
- if(src.allowed(usr))
+ if(allowed(usr))
for (var/obj/structure/crematorium/C in world)
if (C.id == id)
if (!C.cremating)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 1c1067cb240..65864f5d912 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -485,6 +485,10 @@
if ((!(L.stat) && !(L.restrained())))
resist_grab(L) //this passes L because the proc requires a typecasted mob/living instead of just 'src'
+ // Sliding out of a morgue/crematorium
+ if(loc && (istype(loc, /obj/structure/morgue) || istype(loc, /obj/structure/crematorium)))
+ resist_tray(L)
+
//unbuckling yourself
if(L.buckled && (L.last_special <= world.time) )
resist_buckle(L) //this passes L because the proc requires a typecasted mob/living instead of just 'src'
@@ -687,6 +691,17 @@
BD.attack_hand(usr)
C.open()
+// resist_tray allows a mob to slide themselves out of a morgue or crematorium
+/mob/living/proc/resist_tray(var/mob/living/carbon/CM)
+ if(!istype(CM))
+ return
+ if (usr.stat || usr.restrained())
+ return
+
+ usr << "You attempt to slide yourself out of \the [loc]..."
+ var/obj/structure/S = loc
+ S.attack_hand(src)
+
/* resist_stop_drop_roll allows a mob to stop, drop, and roll in order to put out a fire burning on them.
*/////
/mob/living/proc/resist_stop_drop_roll(var/mob/living/carbon/CM)