Makes the crematorium able to be "broken" and fixed instead of destroyed. (#19878)

* makes the crematorium indestructible

* cremator can now be broken instead

* woops I totally understand span

* thank you vietrice

* code comments

* Lewcc review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* I am the worst spriter, fight me

* probably should stop cremating if broken eh?

* slightly less shit coder sprite

* SEAAAAAAAAAN

* Sirryan Requests Pt1

* woops you didn't see this part

* Sirryan Requests Pt2 - Electric Boogaloo

* SteelSlayer review

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
This commit is contained in:
Coolrune206
2023-01-11 07:42:50 +10:00
committed by GitHub
parent 2f334c7a7e
commit d08786fe8b
2 changed files with 60 additions and 27 deletions
+60 -27
View File
@@ -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, "<span class='warning'>It's locked.</span>")
@@ -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("<span class='warning'>[src] dims as its paneling collapses and it becomes non-functional.</span>")
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, "<span class='notice'>The crematorium does not seem to need fixing.</span>")
return TRUE
if(!I.tool_use_check(user, 0))
return TRUE
if(repairstate != CREMATOR_IN_REPAIR)
to_chat(user, "<span class='notice'>[src] needs a new igniter before you weld the paneling closed.</span>")
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("<span class='notice'>[user] replaces [src]'s igniter.</span>", "<span class='notice'>You replace [src]'s damaged igniter. Now it just needs its paneling welded.</span>")
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, "<span class='notice'>[src] does not need its igniter replaced.</span>")
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