Processing subsystems improvements (#18961)

Refactored the use of the isprocessing var into the datum flag
DF_ISPROCESSING.
Updated SSprocessing and SSmachinery to have a constant fire rate.
Updated gas cooler to be time-constant thanks to the above.
This commit is contained in:
Fluffy
2024-04-20 20:16:08 +02:00
committed by GitHub
parent edd0376490
commit 1f759338d8
15 changed files with 130 additions and 77 deletions
+8 -8
View File
@@ -100,21 +100,21 @@ FLOOR SAFES
cut_overlay(drill_overlay)
if(istype(drill, /obj/item/thermal_drill))
var/drill_icon = istype(drill, /obj/item/thermal_drill/diamond_drill) ? "d" : "h"
var/state = "[initial(icon_state)]_[drill_icon]-drill-[isprocessing ? "on" : "off"]"
var/state = "[initial(icon_state)]_[drill_icon]-drill-[(datum_flags & DF_ISPROCESSING) ? "on" : "off"]"
drill_overlay = image(icon = 'icons/effects/drill.dmi', icon_state = state, pixel_x = drill_x_offset, pixel_y = drill_y_offset)
add_overlay(drill_overlay)
/obj/structure/safe/attack_hand(mob/user as mob)
if(drill)
switch(alert("What would you like to do?", "Thermal Drill", "Turn [isprocessing ? "Off" : "On"]", "Remove Drill", "Cancel"))
switch(alert("What would you like to do?", "Thermal Drill", "Turn [(datum_flags & DF_ISPROCESSING) ? "Off" : "On"]", "Remove Drill", "Cancel"))
if("Turn On")
if(!drill || isprocessing)
if(!drill || (datum_flags & DF_ISPROCESSING))
return
if(broken)
to_chat(user, SPAN_WARNING("\The [src] is already broken open!"))
return
if(do_after(user, 2 SECONDS))
if(!drill || isprocessing)
if(!drill || (datum_flags & DF_ISPROCESSING))
return
if(broken)
return
@@ -123,19 +123,19 @@ FLOOR SAFES
START_PROCESSING(SSprocessing, src)
update_icon()
if("Turn Off")
if(!drill || !isprocessing)
if(!drill || !(datum_flags & DF_ISPROCESSING))
return
if(do_after(user, 2 SECONDS))
if(!drill || !isprocessing)
if(!drill || !(datum_flags & DF_ISPROCESSING))
return
drill.soundloop.stop()
STOP_PROCESSING(SSprocessing, src)
update_icon()
if("Remove Drill")
if(isprocessing)
if(datum_flags & DF_ISPROCESSING)
to_chat(user, SPAN_WARNING("You cannot remove the drill while it's running!"))
else if(do_after(user, 2 SECONDS))
if(isprocessing)
if(datum_flags & DF_ISPROCESSING)
return
user.put_in_hands(drill)
drill = null