Refactored the machinery operable procs (#19274)

Refactored the machinery operable procs into a single one, DMDoc'd, SDMM
marked, made more readable.
Fixed suspension field generator not being able to be used as it was not
checking the power cell for operability.

Fixes #19249
This commit is contained in:
Fluffy
2024-05-31 21:23:30 +00:00
committed by GitHub
parent bcc4f225f8
commit 7fb282adf0
18 changed files with 111 additions and 37 deletions
@@ -96,7 +96,7 @@
/obj/machinery/atmospherics/binary/oxyregenerator/process()
. = ..()
if((inoperable()) || !use_power)
if((!operable()) || !use_power)
return
var/power_draw = -1
+1 -1
View File
@@ -204,7 +204,7 @@ GLOBAL_LIST_EMPTY_TYPED(holodeck_controls, /obj/machinery/computer/holodeck_cont
holographic_mobs -= P
P.derez()
if(inoperable())
if(!operable())
return
if(active)
use_power_oneoff(item_power_usage * (holographic_objs.len + holographic_mobs.len))
+1 -1
View File
@@ -113,7 +113,7 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
return FALSE
var/flags = issilicon(user) ? USE_ALLOW_NON_ADJACENT : 0
if (use_check_and_message(user, flags) || user.blinded || inoperable() || !linked)
if (use_check_and_message(user, flags) || user.blinded || !operable() || !linked)
return -1
else
return SEE_THRU
+1 -1
View File
@@ -921,7 +921,7 @@
return wires.is_cut(wireIndex)
/obj/machinery/power/apc/proc/can_use(mob/user, var/loud = 0) //used by attack_hand() and Topic()
if(inoperable())
if(!operable())
return FALSE
var/use_flags = issilicon(user) && USE_ALLOW_NON_ADJACENT // AIs and borgs can use it at range
use_flags |= (check_rights(R_ADMIN, FALSE, user) && USE_ALLOW_NONLIVING) // admins can use the UI when ghosting
@@ -29,7 +29,7 @@
/obj/machinery/fusion_fuel_injector/process()
if(injecting)
if(inoperable())
if(!operable())
StopInjecting()
else
Inject()
@@ -95,7 +95,7 @@
harvesting.Cut()
/obj/machinery/kinetic_harvester/update_icon()
if(inoperable())
if(!operable())
icon_state = "broken"
else if(use_power >= POWER_USE_ACTIVE)
icon_state = "on"
+2 -2
View File
@@ -312,7 +312,7 @@
return src.attack_hand(user)
/obj/machinery/chem_master/attack_hand(mob/user as mob)
if(inoperable())
if(!operable())
return
user.set_machine(src)
ui_interact(user)
@@ -428,7 +428,7 @@
interact(user)
/obj/machinery/reagentgrinder/interact(mob/user as mob) // The microwave Menu
if(inoperable())
if(!operable())
return
user.set_machine(src)
var/is_chamber_empty = 0
@@ -38,6 +38,14 @@
ui_interact(user)
/obj/machinery/suspension_gen/operable(additional_flags)
if(stat & (BROKEN|additional_flags))
return FALSE
if(!cell.charge)
return FALSE
return TRUE
/obj/machinery/suspension_gen/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.isscrewdriver())
if(!open)