mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Small rewrite of crematorium and morgue so they work right.
Only issue is that the damn things don't GC. Also lots of duplicate code between the two, still some other shittiness, but this is much better. I really just wanted to fix the bug where after usage you can't use em again until the tray gets deleted rather than GC'd. On the plus side, they don't constantly make and delete trays every time someone opens them. Also, and this is important, I uncommented the crematorium usage logging. It didn't runtime in testing so it should be good to go.
This commit is contained in:
@@ -12,21 +12,33 @@
|
||||
|
||||
/obj/structure/morgue
|
||||
name = "morgue"
|
||||
desc = "Used to keep bodies in untill someone fetches them."
|
||||
desc = "Used to keep bodies in until someone fetches them."
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "morgue1"
|
||||
density = 1
|
||||
var/obj/structure/m_tray/connected = null
|
||||
anchored = 1.0
|
||||
|
||||
/obj/structure/morgue/on_log()
|
||||
update()
|
||||
/obj/structure/morgue/New()
|
||||
connected = new(src)
|
||||
connected.connected = src
|
||||
..()
|
||||
|
||||
/obj/structure/morgue/proc/update()
|
||||
if (src.connected)
|
||||
/obj/structure/morgue/Destroy()
|
||||
open()
|
||||
if(connected)
|
||||
qdel(connected)
|
||||
connected = null
|
||||
..()
|
||||
|
||||
/obj/structure/morgue/on_log()
|
||||
update_icon()
|
||||
|
||||
/obj/structure/morgue/update_icon()
|
||||
if (!connected || connected.loc != src) //open or the tray broke off somehow
|
||||
src.icon_state = "morgue0"
|
||||
else
|
||||
if(!src.contents.len)
|
||||
if(src.contents.len == 1) //empty except for the tray
|
||||
src.icon_state = "morgue1"
|
||||
else
|
||||
|
||||
@@ -43,31 +55,6 @@
|
||||
src.icon_state = "morgue4"//clone that mofo
|
||||
break
|
||||
|
||||
|
||||
/obj/structure/morgue/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
for(var/atom/movable/A as mob|obj in src)
|
||||
A.loc = src.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
|
||||
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
|
||||
ex_act(severity)
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/structure/morgue/alter_health()
|
||||
return src.loc
|
||||
|
||||
@@ -75,31 +62,14 @@
|
||||
return src.attack_hand(user)
|
||||
|
||||
/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 (!( A.anchored ))
|
||||
A.loc = src
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
//src.connected = null
|
||||
qdel(src.connected)
|
||||
if(!connected)
|
||||
user << "That doesn't appear to have a tray."
|
||||
return
|
||||
if(connected.loc == src)
|
||||
open()
|
||||
else
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
src.connected = new /obj/structure/m_tray( src.loc )
|
||||
step(src.connected, EAST)
|
||||
src.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"
|
||||
for(var/atom/movable/A as mob|obj in src)
|
||||
A.loc = src.connected.loc
|
||||
src.connected.icon_state = "morguet"
|
||||
else
|
||||
//src.connected = null
|
||||
qdel(src.connected)
|
||||
src.add_fingerprint(user)
|
||||
update()
|
||||
return
|
||||
close()
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/structure/morgue/attackby(P as obj, mob/user as mob)
|
||||
if (istype(P, /obj/item/weapon/pen))
|
||||
@@ -113,25 +83,24 @@
|
||||
src.name = text("Morgue- '[]'", t)
|
||||
else
|
||||
src.name = "Morgue"
|
||||
src.add_fingerprint(user)
|
||||
return
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/structure/morgue/container_resist()
|
||||
src.connected = new /obj/structure/m_tray( src.loc )
|
||||
step(src.connected, EAST)
|
||||
src.connected.layer = OBJ_LAYER
|
||||
open()
|
||||
|
||||
/obj/structure/morgue/proc/open()
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
var/turf/T = get_step(src, EAST)
|
||||
if (T.contents.Find(src.connected))
|
||||
src.connected.connected = src
|
||||
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"
|
||||
else
|
||||
//src.connected = null
|
||||
qdel(src.connected)
|
||||
return
|
||||
for(var/atom/movable/A in src)
|
||||
A.loc = T
|
||||
update_icon()
|
||||
|
||||
/obj/structure/morgue/proc/close()
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
for(var/atom/movable/A in connected.loc)
|
||||
if(!A.anchored || A == connected)
|
||||
A.loc = src
|
||||
update_icon()
|
||||
|
||||
|
||||
/*
|
||||
@@ -148,22 +117,22 @@
|
||||
anchored = 1.0
|
||||
throwpass = 1
|
||||
|
||||
/obj/structure/m_tray/Destroy()
|
||||
if(connected)
|
||||
connected.connected = null
|
||||
connected.update_icon()
|
||||
connected = null
|
||||
..()
|
||||
|
||||
/obj/structure/m_tray/attack_paw(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/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 (!( A.anchored ))
|
||||
A.loc = src.connected
|
||||
//Foreach goto(26)
|
||||
src.connected.connected = null
|
||||
src.connected.update()
|
||||
connected.close()
|
||||
add_fingerprint(user)
|
||||
//SN src = null
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
else
|
||||
user << "That's not connected to anything."
|
||||
|
||||
/obj/structure/m_tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
|
||||
if ((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
|
||||
@@ -196,12 +165,24 @@
|
||||
var/id = 1
|
||||
var/locked = 0
|
||||
|
||||
/obj/structure/crematorium/proc/update()
|
||||
if (src.connected)
|
||||
src.icon_state = "crema0"
|
||||
/obj/structure/crematorium/New()
|
||||
connected = new(src)
|
||||
connected.connected = src
|
||||
..()
|
||||
|
||||
/obj/structure/crematorium/Destroy()
|
||||
open()
|
||||
if(connected)
|
||||
qdel(connected)
|
||||
connected = null
|
||||
..()
|
||||
|
||||
/obj/structure/crematorium/update_icon()
|
||||
if(!connected || connected.loc != src)
|
||||
icon_state = "crema0"
|
||||
else
|
||||
|
||||
if(src.contents.len)
|
||||
if(src.contents.len > 1)
|
||||
src.icon_state = "crema2"
|
||||
else
|
||||
src.icon_state = "crema1"
|
||||
@@ -212,31 +193,6 @@
|
||||
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
|
||||
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
|
||||
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
|
||||
ex_act(severity)
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/structure/crematorium/alter_health()
|
||||
return src.loc
|
||||
|
||||
@@ -244,39 +200,17 @@
|
||||
return src.attack_hand(user)
|
||||
|
||||
/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."
|
||||
if (cremating || locked)
|
||||
user << "\red It's locked."
|
||||
return
|
||||
if ((src.connected) && (src.locked == 0))
|
||||
for(var/atom/movable/A as mob|obj in src.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
|
||||
var/turf/T = get_step(src, SOUTH)
|
||||
if (T.contents.Find(src.connected))
|
||||
src.connected.connected = src
|
||||
src.icon_state = "crema0"
|
||||
for(var/atom/movable/A as mob|obj in src)
|
||||
A.loc = src.connected.loc
|
||||
src.connected.icon_state = "cremat"
|
||||
else
|
||||
//src.connected = null
|
||||
qdel(src.connected)
|
||||
src.add_fingerprint(user)
|
||||
update()
|
||||
if (!connected)
|
||||
user << "That doesn't appear to have a tray."
|
||||
return
|
||||
if(connected.loc == src)
|
||||
open()
|
||||
else
|
||||
close()
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/structure/crematorium/attackby(P as obj, mob/user as mob)
|
||||
if (istype(P, /obj/item/weapon/pen))
|
||||
@@ -294,30 +228,13 @@
|
||||
return
|
||||
|
||||
/obj/structure/crematorium/container_resist()
|
||||
src.connected = new /obj/structure/c_tray( src.loc )
|
||||
step(src.connected, SOUTH)
|
||||
src.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"
|
||||
for(var/atom/movable/A as mob|obj in src)
|
||||
A.loc = src.connected.loc
|
||||
//Foreach goto(106)
|
||||
src.connected.icon_state = "cremat"
|
||||
else
|
||||
//src.connected = null
|
||||
qdel(src.connected)
|
||||
return
|
||||
open()
|
||||
|
||||
/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
|
||||
|
||||
if(contents.len <= 0)
|
||||
if(contents.len <= 1)
|
||||
for (var/mob/M in viewers(src))
|
||||
M.show_message("\red You hear a hollow crackle.", 1)
|
||||
return
|
||||
@@ -332,30 +249,43 @@
|
||||
|
||||
cremating = 1
|
||||
locked = 1
|
||||
update()
|
||||
update_icon()
|
||||
|
||||
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 <b>[user]/[user.ckey]</b>" //No point in this when the mob's about to be deleted
|
||||
//user.attack_log +="\[[time_stamp()]\] Cremated <b>[M]/[M.ckey]</b>"
|
||||
//log_attack("\[[time_stamp()]\] <b>[user]/[user.ckey]</b> cremated <b>[M]/[M.ckey]</b>")
|
||||
user.attack_log +="\[[time_stamp()]\] Cremated <b>[M]/[M.ckey]</b>"
|
||||
log_attack("\[[time_stamp()]\] <b>[user]/[user.ckey]</b> cremated <b>[M]/[M.ckey]</b>")
|
||||
M.death(1)
|
||||
M.ghostize()
|
||||
qdel(M)
|
||||
|
||||
for(var/obj/O in contents) //obj instead of obj/item so that bodybags and ashes get destroyed. We dont want tons and tons of ash piling up
|
||||
qdel(O)
|
||||
if(O != connected) //Creamtorium does not burn hot enough to destroy the tray
|
||||
qdel(O)
|
||||
|
||||
new /obj/effect/decal/cleanable/ash(src)
|
||||
sleep(30)
|
||||
cremating = 0
|
||||
locked = 0
|
||||
update()
|
||||
update_icon()
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
return
|
||||
|
||||
/obj/structure/crematorium/proc/open()
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
var/turf/T = get_step(src, SOUTH)
|
||||
for(var/atom/movable/A in src)
|
||||
A.loc = T
|
||||
update_icon()
|
||||
|
||||
/obj/structure/crematorium/proc/close()
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
for(var/atom/movable/A in connected.loc)
|
||||
if(!A.anchored || A == connected)
|
||||
A.loc = src
|
||||
update_icon()
|
||||
|
||||
/*
|
||||
* Crematorium tray
|
||||
@@ -371,22 +301,22 @@
|
||||
anchored = 1.0
|
||||
throwpass = 1
|
||||
|
||||
/obj/structure/c_tray/Destroy()
|
||||
if(connected)
|
||||
connected.connected = null
|
||||
connected.update_icon()
|
||||
connected = null
|
||||
..()
|
||||
|
||||
/obj/structure/c_tray/attack_paw(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/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 (!( A.anchored ))
|
||||
A.loc = src.connected
|
||||
//Foreach goto(26)
|
||||
src.connected.connected = null
|
||||
src.connected.update()
|
||||
connected.close()
|
||||
add_fingerprint(user)
|
||||
//SN src = null
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
else
|
||||
user << "That's not connected to anything."
|
||||
|
||||
/obj/structure/c_tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
|
||||
if ((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
|
||||
|
||||
Reference in New Issue
Block a user