diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
index c54bd669539..1c084356e09 100644
--- a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
+++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
@@ -194,7 +194,7 @@
if(!M.use_power) // Not using power at all
to_chat(user, SPAN_NOTICE("ERROR: No power grid connection. Unable to overload."))
return
- if(M.inoperable()) // Not functional
+ if(!M.operable()) // Not functional
to_chat(user, SPAN_NOTICE("ERROR: Unknown error. Machine is probably damaged or power supply is nonfunctional."))
return
else // Not a machine at all (what the hell is this doing in Machines list anyway??)
diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm
index e06314514ad..ad17b4bf86f 100644
--- a/code/game/machinery/computer/camera.dm
+++ b/code/game/machinery/computer/camera.dm
@@ -27,7 +27,7 @@
return attack_hand(user)
/obj/machinery/computer/security/check_eye(var/mob/user as mob)
- if (user.stat || user.blinded || inoperable())
+ if (user.stat || user.blinded || !operable())
return -1
if(!current_camera)
return 0
@@ -37,7 +37,7 @@
return viewflag
/obj/machinery/computer/security/grants_equipment_vision(var/mob/user as mob)
- if(user.stat || user.blinded || inoperable())
+ if(user.stat || user.blinded || !operable())
return FALSE
if(!current_camera)
return FALSE
@@ -131,7 +131,7 @@
A.client.eye = A.eyeobj
return 1
- if (user.stat || user.blinded || inoperable())
+ if (user.stat || user.blinded || !operable())
return 0
set_current(C)
diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm
index d5d62b897f7..760e04408f6 100644
--- a/code/game/machinery/computer/computer.dm
+++ b/code/game/machinery/computer/computer.dm
@@ -32,7 +32,7 @@
update_icon()
/obj/machinery/computer/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = TRUE)
- if(inoperable() || isNotStationLevel(z) || user.stat)
+ if(!operable() || isNotStationLevel(z) || user.stat)
user.unset_machine()
return
diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm
index 6d34856649f..7ef04970e8c 100644
--- a/code/game/machinery/computer/pod.dm
+++ b/code/game/machinery/computer/pod.dm
@@ -91,7 +91,7 @@
/obj/machinery/computer/pod/process()
- if(inoperable())
+ if(!operable())
return
if(timing)
if(time > 0)
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index b02c40084be..f119499bd9a 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -57,7 +57,7 @@
return
if(ishuman(M) || isrobot(M) || isbot(M) || istype(M, /mob/living/simple_animal/spiderbot) || ismech(M))
- if(inoperable())
+ if(!operable())
if(do_after(M, 1 SECOND, src))
// The VM here is before open and the wording is backwards because density gets set after a background sleep in open
visible_message("\The [M] [density ? "pushes" : "pulls"] \the [src] [density ? "open" : "closed"].")
@@ -68,7 +68,7 @@
/obj/machinery/door/window/allowed(mob/M)
. = ..()
- if(inoperable() || !density) // Unpowered windoors can just be slid open, open windoors can always be closed
+ if(!operable() || !density) // Unpowered windoors can just be slid open, open windoors can always be closed
return TRUE
use_power_oneoff(50) // Just powering the RFID and maybe a weak motor
if(operable() && . == FALSE)
@@ -183,7 +183,7 @@
return TRUE
if(isobj(attacking_item) && attacking_item.iscrowbar() && user.a_intent == I_HELP)
- if(inoperable())
+ if(!operable())
visible_message("\The [user] forces \the [src] [density ? "open" : "closed"].")
if(density)
open(TRUE)
@@ -207,7 +207,7 @@
src.add_fingerprint(user)
if(allowed(user))
- if(inoperable())
+ if(!operable())
if(!do_after(user, 1 SECOND, src))
return TRUE
visible_message("\The [user] [density ? "pushes" : "pulls"] \the [src] [density ? "open" : "closed"].")
@@ -229,7 +229,7 @@
/obj/machinery/door/window/brigdoor/allowed(mob/M)
- if(inoperable()) // Brigdoors are the exception to the "fail open" windoor - they lock closed
+ if(!operable()) // Brigdoors are the exception to the "fail open" windoor - they lock closed
to_chat(M, SPAN_WARNING("\The [src] refuses to budge in its unpowered state."))
return FALSE
. = ..()
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 854b7bdca75..2cfc1a66879 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -226,19 +226,26 @@ Class Procs:
return
return
-/proc/is_operable(var/obj/machinery/M, var/mob/user)
- return istype(M) && M.operable()
+/**
+ * Check to see if the machine is operable
+ *
+ * * `additional_flags` - Additional flags to check for, that could have been added to the `stat` variable
+ *
+ * Returns `TRUE` if the machine is operable, `FALSE` otherwise
+ */
+/obj/machinery/proc/operable(additional_flags = 0)
+ SHOULD_NOT_SLEEP(TRUE)
+ SHOULD_BE_PURE(TRUE)
-/obj/machinery/proc/operable(var/additional_flags = 0)
- return !inoperable(additional_flags)
-
-/obj/machinery/proc/inoperable(var/additional_flags = 0)
- return (stat & (NOPOWER|BROKEN|additional_flags))
+ if(stat & (NOPOWER|BROKEN|additional_flags))
+ return FALSE
+ else
+ return TRUE
/obj/machinery/proc/toggle_power(power_set = -1, additional_flags = 0)
if(power_set >= 0)
update_use_power(power_set)
- else if (use_power || inoperable(additional_flags))
+ else if (use_power || !operable(additional_flags))
update_use_power(POWER_USE_OFF)
else
update_use_power(initial(use_power))
@@ -277,7 +284,7 @@ Class Procs:
return src.attack_hand(user)
/obj/machinery/attack_hand(mob/user as mob)
- if(inoperable(MAINT))
+ if(!operable(MAINT))
return 1
if(user.lying || user.stat)
return 1
@@ -373,7 +380,7 @@ Class Procs:
playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0) //TODO: Check if that one is the correct sound
/obj/machinery/proc/shock(mob/user, prb)
- if(inoperable())
+ if(!operable())
return 0
if(!prob(prb))
return 0
diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm
index d6f110729aa..d11bb788540 100644
--- a/code/game/machinery/requests_console.dm
+++ b/code/game/machinery/requests_console.dm
@@ -450,7 +450,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
//err... hacking code, which has no reason for existing... but anyway... it was once supposed to unlock priority 3 messanging on that console (EXTREME priority...), but the code for that was removed.
/obj/machinery/requests_console/attackby(obj/item/attacking_item, mob/user)
if (istype(attacking_item, /obj/item/card/id))
- if(inoperable(MAINT)) return TRUE
+ if(!operable(MAINT)) return TRUE
if(screen == RCS_MESSAUTH)
var/obj/item/card/id/T = attacking_item
msgVerified = text("Verified by [T.registered_name], [T.assignment]")
@@ -466,7 +466,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
updateUsrDialog()
return TRUE
else if (istype(attacking_item, /obj/item/stamp))
- if(inoperable(MAINT)) return
+ if(!operable(MAINT)) return
if(screen == RCS_MESSAUTH)
var/obj/item/stamp/T = attacking_item
msgStamped = SPAN_NOTICE("Stamped with the [T.name]")
diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm
index d98fa10e6e0..cab6755cbee 100644
--- a/code/game/machinery/telecomms/machines/message_server.dm
+++ b/code/game/machinery/telecomms/machines/message_server.dm
@@ -99,7 +99,7 @@
/obj/machinery/telecomms/message_server/receive_information(datum/signal/subspace/pda/signal, obj/machinery/telecomms/machine_from)
// can't log non-PDA signals
- if(!istype(signal) || !signal.data["message"] || !use_power || inoperable())
+ if(!istype(signal) || !signal.data["message"] || !use_power || !operable())
return
// log the signal
@@ -119,7 +119,7 @@
authmsg += "[stamp]
"
for (var/obj/machinery/requests_console/Console in allConsoles)
if (ckey(Console.department) == ckey(recipient))
- if(Console.inoperable())
+ if(!Console.operable())
Console.message_log += "Message lost due to console failure.
Please contact [station_name()] system adminsitrator or AI for technical assistance.
"
continue
if(Console.newmessagepriority < priority)
@@ -154,7 +154,7 @@
return
/obj/machinery/telecomms/message_server/attackby(obj/item/attacking_item, mob/user)
- if (use_power && !inoperable(EMPED) && (spamfilter_limit < MESSAGE_SERVER_DEFAULT_SPAM_LIMIT*2) && \
+ if (use_power && operable(EMPED) && (spamfilter_limit < MESSAGE_SERVER_DEFAULT_SPAM_LIMIT*2) && \
istype(attacking_item, /obj/item/circuitboard/message_monitor) && istype(user))
spamfilter_limit += round(MESSAGE_SERVER_DEFAULT_SPAM_LIMIT / 2)
user.drop_from_inventory(attacking_item, get_turf(src))
@@ -164,7 +164,7 @@
..()
/obj/machinery/telecomms/message_server/update_icon()
- if(inoperable(EMPED))
+ if(!operable(EMPED))
icon_state = "server-nopower"
else if (!use_power)
icon_state = "server-off"
diff --git a/code/game/machinery/telecomms/telecommunications.dm b/code/game/machinery/telecomms/telecommunications.dm
index 5226287099d..6ce4eb37c85 100644
--- a/code/game/machinery/telecomms/telecommunications.dm
+++ b/code/game/machinery/telecomms/telecommunications.dm
@@ -114,7 +114,7 @@
/obj/machinery/telecomms/process()
if(!use_power) return PROCESS_KILL
- if(inoperable(EMPED))
+ if(!operable(EMPED))
toggle_power(additional_flags = EMPED)
return PROCESS_KILL
@@ -171,7 +171,7 @@
delay = initial(delay)
/obj/machinery/telecomms/proc/produce_heat()
- if (!produces_heat || !use_power || inoperable(EMPED))
+ if (!produces_heat || !use_power || !operable(EMPED))
return
var/turf/simulated/L = loc
diff --git a/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm b/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
index d45fa1d5a41..b55aa1acede 100644
--- a/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
+++ b/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
@@ -96,7 +96,7 @@
/obj/machinery/atmospherics/binary/oxyregenerator/process()
. = ..()
- if((inoperable()) || !use_power)
+ if((!operable()) || !use_power)
return
var/power_draw = -1
diff --git a/code/modules/holodeck/HolodeckControl.dm b/code/modules/holodeck/HolodeckControl.dm
index 179b1d808a0..e42db8bbe6c 100644
--- a/code/modules/holodeck/HolodeckControl.dm
+++ b/code/modules/holodeck/HolodeckControl.dm
@@ -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))
diff --git a/code/modules/overmap/ships/computers/ship.dm b/code/modules/overmap/ships/computers/ship.dm
index f5cf67c06ea..ee33920cb25 100644
--- a/code/modules/overmap/ships/computers/ship.dm
+++ b/code/modules/overmap/ships/computers/ship.dm
@@ -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
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 22fd0c98209..7c1c870447e 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -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
diff --git a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
index 1ba2bdb6bd8..da8af55b45e 100644
--- a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
+++ b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
@@ -29,7 +29,7 @@
/obj/machinery/fusion_fuel_injector/process()
if(injecting)
- if(inoperable())
+ if(!operable())
StopInjecting()
else
Inject()
diff --git a/code/modules/power/fusion/kinetic_harvester.dm b/code/modules/power/fusion/kinetic_harvester.dm
index e893f9ca35b..eb99d8eb4d0 100644
--- a/code/modules/power/fusion/kinetic_harvester.dm
+++ b/code/modules/power/fusion/kinetic_harvester.dm
@@ -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"
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index a39c8a2e03d..8e3da0385e3 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -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
diff --git a/code/modules/research/xenoarchaeology/tools/suspension_generator.dm b/code/modules/research/xenoarchaeology/tools/suspension_generator.dm
index bc0ce909233..703fdf3f88a 100644
--- a/code/modules/research/xenoarchaeology/tools/suspension_generator.dm
+++ b/code/modules/research/xenoarchaeology/tools/suspension_generator.dm
@@ -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)
diff --git a/html/changelogs/fluffyghost-machineryoperable.yml b/html/changelogs/fluffyghost-machineryoperable.yml
new file mode 100644
index 00000000000..7475968c7a2
--- /dev/null
+++ b/html/changelogs/fluffyghost-machineryoperable.yml
@@ -0,0 +1,59 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# - (fixes bugs)
+# wip
+# - (work in progress)
+# qol
+# - (quality of life)
+# soundadd
+# - (adds a sound)
+# sounddel
+# - (removes a sound)
+# rscadd
+# - (adds a feature)
+# rscdel
+# - (removes a feature)
+# imageadd
+# - (adds an image or sprite)
+# imagedel
+# - (removes an image or sprite)
+# spellcheck
+# - (fixes spelling or grammar)
+# experiment
+# - (experimental change)
+# balance
+# - (balance changes)
+# code_imp
+# - (misc internal code change)
+# refactor
+# - (refactors code)
+# config
+# - (makes a change to the config files)
+# admin
+# - (makes changes to administrator tools)
+# server
+# - (miscellaneous changes to server)
+#################################
+
+# Your name.
+author: FluffyGhost
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
+# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - refactor: "Refactored the machinery operable procs into a single one, DMDoc'd, SDMM marked, made more readable."
+ - bugfix: "Fixed suspension field generator not being able to be used as it was not checking the power cell for operability."