diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm
index a584293e981..28e1c9b3cc7 100644
--- a/code/game/objects/structures/morgue.dm
+++ b/code/game/objects/structures/morgue.dm
@@ -274,6 +274,10 @@
* Crematorium
*/
+#define CREMATOR_DESTROYED 0
+#define CREMATOR_IN_REPAIR 1
+#define CREMATOR_OPERATIONAL 2
+
GLOBAL_LIST_EMPTY(crematoriums)
// These have so much copypasted code from the above that they should really be made into subtypes
// Someone please I beg
@@ -283,10 +287,13 @@ GLOBAL_LIST_EMPTY(crematoriums)
icon = 'icons/obj/stationobjs.dmi'
icon_state = "crema"
density = TRUE
+ max_integrity = 1000
+ integrity_failure = 700 // Actual integrity is thus only 300, the max_integrity is so high to prevent it from being destroyed before it's made invincibile once broken
var/obj/structure/c_tray/connected = null
anchored = TRUE
var/cremating = FALSE
var/id = 1
+ var/repairstate = CREMATOR_OPERATIONAL // Repairstate 0 is DESTROYED, 1 has the igniter applied but needs welding (IN_REPAIR), 2 is OPERATIONAL
var/locked = FALSE
var/open_sound = 'sound/items/deconstruct.ogg'
@@ -309,31 +316,6 @@ GLOBAL_LIST_EMPTY(crematoriums)
if(length(contents))
. += "crema_full"
-/obj/structure/crematorium/ex_act(severity)
- switch(severity)
- if(1.0)
- for(var/atom/movable/A in src)
- A.forceMove(loc)
- ex_act(severity)
- qdel(src)
- return
-
- if(2.0)
- if(prob(50))
- for(var/atom/movable/A in src)
- A.forceMove(loc)
- ex_act(severity)
- qdel(src)
- return
-
- if(3.0)
- if(prob(5))
- for(var/atom/movable/A in src)
- A.forceMove(loc)
- ex_act(severity)
- qdel(src)
- return
-
/obj/structure/crematorium/attack_hand(mob/user as mob)
if(cremating)
to_chat(usr, "It's locked.")
@@ -354,12 +336,58 @@ GLOBAL_LIST_EMPTY(crematoriums)
add_fingerprint(user)
update_icon(UPDATE_OVERLAYS)
-/obj/structure/crematorium/attackby(P as obj, mob/user as mob, params)
+/obj/structure/crematorium/obj_break(damage_flag)
+ if(broken)
+ return
+ visible_message("[src] dims as its paneling collapses and it becomes non-functional.")
+ icon_state = "crema_broke" // this will need a proper sprite when possible, as it's just a shitty codersprite
+ resistance_flags = INDESTRUCTIBLE // prevents it from being destroyed instead of just broken
+ name = "broken crematorium"
+ desc = "A broken human incinerator. No longer works well on barbeque nights. It requires a new igniter to be repaired."
+ repairstate = CREMATOR_DESTROYED
+ broken = TRUE
+ cremating = FALSE
+ update_icon(UPDATE_OVERLAYS)
+ GLOB.crematoriums -= src
+
+/obj/structure/crematorium/welder_act(mob/user, obj/item/I)
+ if(user.a_intent == INTENT_HARM) // if you want to damage it with a welder you should be able to
+ return
+ if(!broken)
+ to_chat(user, "The crematorium does not seem to need fixing.")
+ return TRUE
+ if(!I.tool_use_check(user, 0))
+ return TRUE
+ if(repairstate != CREMATOR_IN_REPAIR)
+ to_chat(user, "[src] needs a new igniter before you weld the paneling closed.")
+ return TRUE
+ WELDER_ATTEMPT_REPAIR_MESSAGE
+ if(!I.use_tool(src, user, 3 SECONDS, volume = I.tool_volume))
+ return TRUE
+ WELDER_REPAIR_SUCCESS_MESSAGE
+ icon_state = initial(icon_state)
+ resistance_flags = NONE
+ name = initial(name)
+ desc = initial(desc)
+ repairstate = CREMATOR_OPERATIONAL
+ broken = FALSE
+ obj_integrity = max_integrity
+ GLOB.crematoriums += src
+ return TRUE
+
+/obj/structure/crematorium/attackby(obj/item/P, mob/user, params)
if(is_pen(P))
rename_interactive(user, P)
add_fingerprint(user)
return
-
+ if(istype(P, /obj/item/assembly/igniter))
+ if(repairstate == CREMATOR_DESTROYED)
+ user.visible_message("[user] replaces [src]'s igniter.", "You replace [src]'s damaged igniter. Now it just needs its paneling welded.")
+ repairstate = CREMATOR_IN_REPAIR
+ desc = "A broken human incinerator. No longer works well on barbeque nights. It requires its paneling to be welded to function."
+ qdel(P)
+ else
+ to_chat(user, "[src] does not need its igniter replaced.")
return ..()
/obj/structure/crematorium/relaymove(mob/user as mob)
@@ -470,6 +498,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
icon = 'icons/obj/stationobjs.dmi'
icon_state = "crema_tray"
density = TRUE
+ resistance_flags = INDESTRUCTIBLE
layer = 2.0
var/obj/structure/crematorium/connected = null
anchored = TRUE
@@ -512,6 +541,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
name = "crematorium igniter"
icon = 'icons/obj/power.dmi'
icon_state = "crema_switch"
+ resistance_flags = INDESTRUCTIBLE // could use a more elegant solution like being able to be rebuilt, broken and repaired, or by directly attaching the switch to the crematorium
power_channel = EQUIP
use_power = IDLE_POWER_USE
idle_power_usage = 100
@@ -557,3 +587,6 @@ GLOBAL_LIST_EMPTY(crematoriums)
#undef REVIVABLE
#undef NOT_BODY
#undef GHOST_CONNECTED
+#undef CREMATOR_DESTROYED
+#undef CREMATOR_IN_REPAIR
+#undef CREMATOR_OPERATIONAL
diff --git a/icons/obj/stationobjs.dmi b/icons/obj/stationobjs.dmi
index f501e7998bd..f4c2e769df5 100755
Binary files a/icons/obj/stationobjs.dmi and b/icons/obj/stationobjs.dmi differ