diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm
index 7ec84cca5d0..1a788f77984 100644
--- a/code/datums/holocall.dm
+++ b/code/datums/holocall.dm
@@ -45,7 +45,7 @@
for(var/I in callees)
var/obj/machinery/holopad/H = I
- if(!QDELETED(H) && H.is_operational())
+ if(!QDELETED(H) && H.is_operational)
dialed_holopads += H
if(head_call)
if(H.secure)
@@ -178,13 +178,13 @@
/datum/holocall/proc/Check()
for(var/I in dialed_holopads)
var/obj/machinery/holopad/H = I
- if(!H.is_operational())
+ if(!H.is_operational)
ConnectionFailure(H)
if(QDELETED(src))
return FALSE
- . = !QDELETED(user) && !user.incapacitated() && !QDELETED(calling_holopad) && calling_holopad.is_operational() && user.loc == calling_holopad.loc
+ . = !QDELETED(user) && !user.incapacitated() && !QDELETED(calling_holopad) && calling_holopad.is_operational && user.loc == calling_holopad.loc
if(.)
if(!connected_holopad)
diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 86e06325ffb..e02f51946a6 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -280,7 +280,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(A.fire)
cont = FALSE
break
- if(cont && D.is_operational())
+ if(cont && D.is_operational)
if(D.operating)
D.nextstate = opening ? FIREDOOR_OPEN : FIREDOOR_CLOSED
else if(!(D.density ^ opening))
diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm
index 3aa18d3d889..1234d20c55c 100644
--- a/code/game/machinery/PDApainter.dm
+++ b/code/game/machinery/PDApainter.dm
@@ -76,7 +76,7 @@
if(!(machine_stat & BROKEN))
return
to_chat(user, "You repair [src].")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
obj_integrity = max_integrity
update_icon()
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index acbc92eda34..5ef0eb2bf6e 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -89,7 +89,7 @@
. = ..()
if (. & EMP_PROTECT_SELF)
return
- if(is_operational() && occupant)
+ if(is_operational && occupant)
open_machine()
/obj/machinery/sleeper/MouseDrop_T(mob/target, mob/user)
@@ -220,7 +220,7 @@
. = TRUE
if("inject")
var/chem = text2path(params["chem"])
- if(!is_operational() || !mob_occupant || isnull(chem))
+ if(!is_operational || !mob_occupant || isnull(chem))
return
if(mob_occupant.health < min_health && chem != /datum/reagent/medicine/epinephrine)
return
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 3e10bf6b6f7..c9aafb38716 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -77,9 +77,6 @@ Class Procs:
process_atmos()
Called by the 'air subsystem' once per atmos tick for each machine that is listed in its 'atmos_machines' list.
- is_operational()
- Returns 0 if the machine is unpowered, broken or undergoing maintenance, something else if not
-
Compiled by Aygar
*/
@@ -98,7 +95,7 @@ Class Procs:
anchored = TRUE
interaction_flags_atom = INTERACT_ATOM_ATTACK_HAND | INTERACT_ATOM_UI_INTERACT
- var/machine_stat = 0
+ var/machine_stat = NONE
var/use_power = IDLE_POWER_USE
//0 = dont run the auto
//1 = run auto, use idle
@@ -107,6 +104,8 @@ Class Procs:
var/active_power_usage = 0
var/power_channel = AREA_USAGE_EQUIP
//AREA_USAGE_EQUIP,AREA_USAGE_ENVIRON or AREA_USAGE_LIGHT
+ ///A combination of factors such as having power, not being broken and so on. Boolean.
+ var/is_operational = TRUE
var/wire_compatible = FALSE
var/list/component_parts = null //list of all the parts used to build it, if made from certain kinds of frames.
@@ -179,6 +178,25 @@ Class Procs:
/obj/machinery/proc/process_atmos()//If you dont use process why are you here
return PROCESS_KILL
+
+///Called when we want to change the value of the machine_stat variable. Holds bitflags.
+/obj/machinery/proc/set_machine_stat(new_value)
+ if(new_value == machine_stat)
+ return
+ . = machine_stat
+ machine_stat = new_value
+ on_set_machine_stat(.)
+
+
+///Called when the value of `machine_stat` changes, so we can react to it.
+/obj/machinery/proc/on_set_machine_stat(old_value)
+ if(old_value & (NOPOWER|BROKEN|MAINT))
+ if(!(machine_stat & (NOPOWER|BROKEN|MAINT))) //From off to on.
+ set_is_operational(TRUE)
+ else if(machine_stat & (NOPOWER|BROKEN|MAINT)) //From on to off.
+ set_is_operational(FALSE)
+
+
/obj/machinery/emp_act(severity)
. = ..()
if(use_power && !machine_stat && !(. & EMP_PROTECT_SELF))
@@ -255,8 +273,20 @@ Class Procs:
use_power(active_power_usage,power_channel)
return 1
-/obj/machinery/proc/is_operational()
- return !(machine_stat & (NOPOWER|BROKEN|MAINT))
+
+///Called when we want to change the value of the `is_operational` variable. Boolean.
+/obj/machinery/proc/set_is_operational(new_value)
+ if(new_value == is_operational)
+ return
+ . = is_operational
+ is_operational = new_value
+ on_set_is_operational(.)
+
+
+///Called when the value of `is_operational` changes, so we can react to it.
+/obj/machinery/proc/on_set_is_operational(old_value)
+ return
+
/obj/machinery/can_interact(mob/user)
if((machine_stat & (NOPOWER|BROKEN)) && !(interaction_flags_machine & INTERACT_MACHINE_OFFLINE)) // Check if the machine is broken, and if we can still interact with it if so
@@ -403,7 +433,7 @@ Class Procs:
return
/obj/machinery/proc/default_pry_open(obj/item/I)
- . = !(state_open || panel_open || is_operational() || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
+ . = !(state_open || panel_open || is_operational || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
if(.)
I.play_tool_sound(src, 50)
visible_message("[usr] pries open \the [src].", "You pry open \the [src].")
@@ -440,7 +470,7 @@ Class Procs:
SHOULD_CALL_PARENT(1)
. = ..()
if(!(machine_stat & BROKEN) && !(flags_1 & NODECONSTRUCT_1))
- machine_stat |= BROKEN
+ set_machine_stat(machine_stat | BROKEN)
SEND_SIGNAL(src, COMSIG_MACHINERY_BROKEN, damage_flag)
update_icon()
return TRUE
diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm
index 84f82b165b2..8973051c22f 100644
--- a/code/game/machinery/announcement_system.dm
+++ b/code/game/machinery/announcement_system.dm
@@ -33,7 +33,7 @@ GLOBAL_LIST_EMPTY(announcement_systems)
update_icon()
/obj/machinery/announcement_system/update_icon_state()
- if(is_operational())
+ if(is_operational)
icon_state = (panel_open ? "AAS_On_Open" : "AAS_On")
else
icon_state = (panel_open ? "AAS_Off_Open" : "AAS_Off")
@@ -64,7 +64,7 @@ GLOBAL_LIST_EMPTY(announcement_systems)
return
else if(P.tool_behaviour == TOOL_MULTITOOL && panel_open && (machine_stat & BROKEN))
to_chat(user, "You reset [src]'s firmware.")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
update_icon()
else
return ..()
@@ -75,7 +75,7 @@ GLOBAL_LIST_EMPTY(announcement_systems)
return str
/obj/machinery/announcement_system/proc/announce(message_type, user, rank, list/channels)
- if(!is_operational())
+ if(!is_operational)
return
var/message
diff --git a/code/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm
index fd4f6ed64dc..10f5552a007 100644
--- a/code/game/machinery/aug_manipulator.dm
+++ b/code/game/machinery/aug_manipulator.dm
@@ -86,7 +86,7 @@
if(!(machine_stat & BROKEN))
return
to_chat(user, "You repair [src].")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
obj_integrity = max(obj_integrity, max_integrity)
update_icon()
else
diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index 46f0f3126b9..5b1d2d54f74 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -61,7 +61,7 @@
/obj/machinery/autolathe/ui_interact(mob/user)
. = ..()
- if(!is_operational())
+ if(!is_operational)
return
if(shocked && !(machine_stat & NOPOWER))
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index a0f46ade81c..3b4c117dbcf 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -147,7 +147,7 @@
update_icon()
network = list()
GLOB.cameranet.removeCamera(src)
- machine_stat |= EMPED
+ set_machine_stat(machine_stat | EMPED)
set_light(0)
emped = emped+1 //Increase the number of consecutive EMP's
update_icon()
@@ -166,7 +166,7 @@
if(emped != thisemp) //Only fix it if the camera hasn't been EMP'd again
return
network = previous_network
- machine_stat &= ~EMPED
+ set_machine_stat(machine_stat & ~EMPED)
update_icon()
if(can_use())
GLOB.cameranet.addCamera(src)
@@ -237,7 +237,7 @@
return
toggle_cam(user, 1)
obj_integrity = max_integrity //this is a pretty simplistic way to heal the camera, but there's no reason for this to be complex.
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
I.play_tool_sound(src)
return TRUE
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 569e8fc6bbc..5c83748afea 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -118,5 +118,5 @@
/obj/machinery/computer/AltClick(mob/user)
. = ..()
- if(!user.canUseTopic(src, !issilicon(user)) || !is_operational())
+ if(!user.canUseTopic(src, !issilicon(user)) || !is_operational)
return
diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm
index 2777173442e..025b0f0843a 100644
--- a/code/game/machinery/computer/card.dm
+++ b/code/game/machinery/computer/card.dm
@@ -171,7 +171,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
/obj/machinery/computer/card/AltClick(mob/user)
..()
- if(!user.canUseTopic(src, !issilicon(user)) || !is_operational())
+ if(!user.canUseTopic(src, !issilicon(user)) || !is_operational)
return
if(inserted_modify_id)
if(id_eject(user, inserted_modify_id))
@@ -361,7 +361,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if(..())
return
- if(!usr.canUseTopic(src, !issilicon(usr)) || !is_operational())
+ if(!usr.canUseTopic(src, !issilicon(usr)) || !is_operational)
usr.unset_machine()
usr << browse(null, "window=id_com")
return
diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm
index c0c074a4556..7ae5a3e4933 100644
--- a/code/game/machinery/computer/dna_console.dm
+++ b/code/game/machinery/computer/dna_console.dm
@@ -251,7 +251,7 @@
if(!ui)
ui = new(user, src, "DnaConsole")
ui.open()
-
+
/obj/machinery/computer/scan_consolenew/ui_assets()
. = ..() || list()
. += get_asset_datum(/datum/asset/simple/genetics)
@@ -1462,7 +1462,7 @@
if(!connected_scanner)
return FALSE
- return (connected_scanner && connected_scanner.is_operational())
+ return (connected_scanner && connected_scanner.is_operational)
/**
* Checks if there is a valid DNA Scanner occupant for genetic modification
@@ -1512,7 +1512,7 @@
for(var/direction in GLOB.cardinals)
test_scanner = locate(/obj/machinery/dna_scannernew, get_step(src, direction))
if(!isnull(test_scanner))
- if(test_scanner.is_operational())
+ if(test_scanner.is_operational)
connected_scanner = test_scanner
connected_scanner.linked_console = src
return
diff --git a/code/game/machinery/computer/prisoner/gulag_teleporter.dm b/code/game/machinery/computer/prisoner/gulag_teleporter.dm
index de87b331609..47b3f36d651 100644
--- a/code/game/machinery/computer/prisoner/gulag_teleporter.dm
+++ b/code/game/machinery/computer/prisoner/gulag_teleporter.dm
@@ -123,7 +123,7 @@
for(var/direction in GLOB.cardinals)
teleporterf = locate(/obj/machinery/gulag_teleporter, get_step(src, direction))
- if(teleporterf && teleporterf.is_operational())
+ if(teleporterf?.is_operational)
return teleporterf
/obj/machinery/computer/prisoner/gulag_teleporter_computer/proc/findbeacon()
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index 221bc8a96e3..2fc68b8f542 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -159,12 +159,12 @@
log_game("[key_name(user)] has set the teleporter target to [target_station] at [AREACOORD(T)]")
target = target_station.teleporter_hub
target_station.linked_stations |= power_station
- target_station.machine_stat &= ~NOPOWER
+ target_station.set_machine_stat(target_station.machine_stat & ~NOPOWER)
if(target_station.teleporter_hub)
- target_station.teleporter_hub.machine_stat &= ~NOPOWER
+ target_station.teleporter_hub.set_machine_stat(target_station.teleporter_hub.machine_stat & ~NOPOWER)
target_station.teleporter_hub.update_icon()
if(target_station.teleporter_console)
- target_station.teleporter_console.machine_stat &= ~NOPOWER
+ target_station.teleporter_console.set_machine_stat(target_station.teleporter_console.machine_stat & ~NOPOWER)
target_station.teleporter_console.update_icon()
/obj/machinery/computer/teleporter/proc/is_eligible(atom/movable/AM)
diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm
index c2d4a399bb7..6729611c8c7 100644
--- a/code/game/machinery/defibrillator_mount.dm
+++ b/code/game/machinery/defibrillator_mount.dm
@@ -11,6 +11,7 @@
idle_power_usage = 0
power_channel = AREA_USAGE_EQUIP
req_one_access = list(ACCESS_MEDICAL, ACCESS_HEADS, ACCESS_SECURITY) //used to control clamps
+ processing_flags = NONE
/// The mount's defib
var/obj/item/defibrillator/defib
/// if true, and a defib is loaded, it can't be removed without unlocking the clamps
@@ -178,11 +179,25 @@
idle_power_usage = 1
wallframe_type = /obj/item/wallframe/defib_mount/charging
+
+/obj/machinery/defibrillator_mount/charging/Initialize()
+ . = ..()
+ if(is_operational)
+ begin_processing()
+
+
+/obj/machinery/defibrillator_mount/charging/on_set_is_operational(old_value)
+ if(old_value) //Turned off
+ end_processing()
+ else //Turned on
+ begin_processing()
+
+
/obj/machinery/defibrillator_mount/charging/process()
var/obj/item/stock_parts/cell/C = get_cell()
- if(!C)
+ if(!C || !is_operational)
return PROCESS_KILL
- if(C.charge < C.maxcharge && is_operational())
+ if(C.charge < C.maxcharge)
use_power(100)
C.give(80)
update_icon()
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 82c1dde57a4..32a9a4454f6 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -958,7 +958,7 @@
"You hear welding.")
if(W.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, .proc/weld_checks, W, user)))
obj_integrity = max_integrity
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
user.visible_message("[user] finishes welding [src].", \
"You finish repairing the airlock.")
update_icon()
diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm
index af9cdea2be8..01d85b05dcd 100644
--- a/code/game/machinery/droneDispenser.dm
+++ b/code/game/machinery/droneDispenser.dm
@@ -216,7 +216,7 @@
"[user] fixes [src]!",
"You restore [src] to operation.")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
obj_integrity = max_integrity
update_icon()
else
diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm
index ababba60d17..3d288e64702 100644
--- a/code/game/machinery/electrolyzer.dm
+++ b/code/game/machinery/electrolyzer.dm
@@ -64,7 +64,7 @@
. += "electrolyzer-open"
/obj/machinery/electrolyzer/process()
- if(!is_operational() && on)
+ if(!is_operational && on)
on = FALSE
if(!on)
return PROCESS_KILL
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 13af99cb335..00c0cd2e5a3 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -124,7 +124,7 @@
..()
/obj/machinery/firealarm/proc/alarm(mob/user)
- if(!is_operational() || (last_alarm+FIREALARM_COOLDOWN > world.time))
+ if(!is_operational || (last_alarm+FIREALARM_COOLDOWN > world.time))
return
last_alarm = world.time
var/area/A = get_area(src)
@@ -134,7 +134,7 @@
log_game("[user] triggered a fire alarm at [COORD(src)]")
/obj/machinery/firealarm/proc/reset(mob/user)
- if(!is_operational())
+ if(!is_operational)
return
var/area/A = get_area(src)
A.firereset(src)
@@ -226,7 +226,7 @@
if(buildstage == 1)
if(machine_stat & BROKEN)
to_chat(user, "You remove the destroyed circuit.")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
else
to_chat(user, "You pry out the circuit.")
new /obj/item/electronics/firealarm(user.loc)
diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm
index 6c64d1ae992..d88f7c7e8ab 100644
--- a/code/game/machinery/harvester.dm
+++ b/code/game/machinery/harvester.dm
@@ -155,7 +155,7 @@
return TRUE
/obj/machinery/harvester/default_pry_open(obj/item/I) //wew
- . = !(state_open || panel_open || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR //We removed is_operational() here
+ . = !(state_open || panel_open || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR //We removed is_operational here
if(.)
I.play_tool_sound(src, 50)
visible_message("[usr] pries open \the [src].", "You pry open [src].")
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 31114666c57..034495961a4 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -109,7 +109,7 @@ Possible to do for anyone motivated enough:
/obj/machinery/holopad/tutorial/attack_hand(mob/user)
if(!istype(user))
return
- if(user.incapacitated() || !is_operational())
+ if(user.incapacitated() || !is_operational)
return
if(replay_mode)
replay_stop()
@@ -200,7 +200,7 @@ Possible to do for anyone motivated enough:
return ..()
/obj/machinery/holopad/ui_status(mob/user)
- if(!is_operational())
+ if(!is_operational)
return UI_CLOSE
if(outgoing_call && !calling)
return UI_CLOSE
@@ -357,7 +357,7 @@ Possible to do for anyone motivated enough:
if(!istype(AI))
AI = null
- if(!is_operational() || !validate_user(master))
+ if(!is_operational || !validate_user(master))
clear_holo(master)
if(outgoing_call)
@@ -387,7 +387,7 @@ Possible to do for anyone motivated enough:
if(!istype(AI))
AI = null
- if(is_operational() && (!AI || AI.eyeobj.loc == loc))//If the projector has power and client eye is on it
+ if(is_operational && (!AI || AI.eyeobj.loc == loc))//If the projector has power and client eye is on it
if (AI && istype(AI.current, /obj/machinery/holopad))
to_chat(user, "ERROR: \black Image feed in progress.")
return
diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm
index 91c188188ef..a7acffe21c4 100644
--- a/code/game/machinery/limbgrower.dm
+++ b/code/game/machinery/limbgrower.dm
@@ -39,7 +39,7 @@
/obj/machinery/limbgrower/ui_interact(mob/user)
. = ..()
- if(!is_operational())
+ if(!is_operational)
return
var/dat = main_win(user)
diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm
index 77f35944433..0b2f4f5db77 100644
--- a/code/game/machinery/medical_kiosk.dm
+++ b/code/game/machinery/medical_kiosk.dm
@@ -59,7 +59,7 @@
return
/obj/machinery/medical_kiosk/update_icon_state()
- if(is_operational())
+ if(is_operational)
icon_state = "kiosk_off"
else
icon_state = "kiosk"
diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm
index fea03c25954..04fc034ff8d 100644
--- a/code/game/machinery/newscaster.dm
+++ b/code/game/machinery/newscaster.dm
@@ -733,7 +733,7 @@ GLOBAL_LIST_EMPTY(allCasters)
return
to_chat(user, "You repair [src].")
obj_integrity = max_integrity
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
update_icon()
else
to_chat(user, "[src] does not need repairs.")
diff --git a/code/game/machinery/prisonlabor.dm b/code/game/machinery/prisonlabor.dm
index dc319e665a2..23f252e1a66 100644
--- a/code/game/machinery/prisonlabor.dm
+++ b/code/game/machinery/prisonlabor.dm
@@ -11,7 +11,7 @@
/obj/machinery/plate_press/update_icon()
. = ..()
- if(!is_operational())
+ if(!is_operational)
icon_state = "offline"
else if(pressing)
icon_state = "loop"
@@ -25,7 +25,7 @@
. = ..()
/obj/machinery/plate_press/attackby(obj/item/I, mob/living/user, params)
- if(!is_operational())
+ if(!is_operational)
to_chat(user, "[src] has to be on to do this!")
return FALSE
if(current_plate)
diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm
index f92139f40ca..8cdbcb59b3c 100644
--- a/code/game/machinery/rechargestation.dm
+++ b/code/game/machinery/rechargestation.dm
@@ -11,12 +11,17 @@
state_open = TRUE
circuit = /obj/item/circuitboard/machine/cyborgrecharger
occupant_typecache = list(/mob/living/silicon/robot, /mob/living/carbon/human)
+ processing_flags = NONE
var/recharge_speed
var/repairs
+
/obj/machinery/recharge_station/Initialize()
. = ..()
update_icon()
+ if(is_operational)
+ begin_processing()
+
/obj/machinery/recharge_station/RefreshParts()
recharge_speed = 0
@@ -35,10 +40,15 @@
if(repairs)
. += "[src] has been upgraded to support automatic repairs."
-/obj/machinery/recharge_station/process()
- if(!is_operational())
- return
+/obj/machinery/recharge_station/on_set_is_operational(old_value)
+ if(old_value) //Turned off
+ end_processing()
+ else //Turned on
+ begin_processing()
+
+
+/obj/machinery/recharge_station/process()
if(occupant)
process_occupant()
return 1
@@ -89,7 +99,7 @@
add_fingerprint(occupant)
/obj/machinery/recharge_station/update_icon_state()
- if(is_operational())
+ if(is_operational)
if(state_open)
icon_state = "borgcharger0"
else
diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm
index e7c3f2d9d10..9a9da90bdf0 100644
--- a/code/game/machinery/roulette_machine.dm
+++ b/code/game/machinery/roulette_machine.dm
@@ -368,13 +368,13 @@
to_chat(user, "You start re-attaching the top section of [src]...")
if(I.use_tool(src, user, 30, volume=50))
to_chat(user, "You re-attach the top section of [src].")
- machine_stat &= ~MAINT
+ set_machine_stat(machine_stat & ~MAINT)
icon_state = "idle"
else
to_chat(user, "You start welding the top section from [src]...")
if(I.use_tool(src, user, 30, volume=50))
to_chat(user, "You removed the top section of [src].")
- machine_stat |= MAINT
+ set_machine_stat(machine_stat | MAINT)
icon_state = "open"
/obj/machinery/roulette/proc/shock(mob/user, prb)
diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm
index a6109198188..bba702a85df 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -199,7 +199,7 @@
return
coil.use(1)
obj_integrity = max_integrity
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
to_chat(user, "You repair \the [src].")
update_icon()
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index 73d379324a9..43022f0c058 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -70,7 +70,7 @@
. += "sheater-open"
/obj/machinery/space_heater/process()
- if(!on || !is_operational())
+ if(!on || !is_operational)
if (on) // If it's broken, turn it off too
on = FALSE
return PROCESS_KILL
diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm
index f7478289e5a..028bbfe0aa3 100644
--- a/code/game/machinery/stasis.dm
+++ b/code/game/machinery/stasis.dm
@@ -66,7 +66,7 @@
. = ..()
/obj/machinery/stasis/proc/stasis_running()
- return stasis_enabled && is_operational()
+ return stasis_enabled && is_operational
/obj/machinery/stasis/update_icon_state()
if(machine_stat & BROKEN)
diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm
index 9068ff3a83a..c52a5bccbe3 100644
--- a/code/game/machinery/suit_storage_unit.dm
+++ b/code/game/machinery/suit_storage_unit.dm
@@ -181,7 +181,7 @@
/obj/machinery/suit_storage_unit/power_change()
. = ..()
- if(!is_operational() && state_open)
+ if(!is_operational && state_open)
open_machine()
dump_contents()
update_icon()
@@ -212,7 +212,7 @@
if(!state_open)
to_chat(user, "The unit's doors are shut!")
return
- if(!is_operational())
+ if(!is_operational)
to_chat(user, "The unit is not operational!")
return
if(occupant || helmet || suit || storage)
@@ -366,7 +366,7 @@
open_machine()
/obj/machinery/suit_storage_unit/attackby(obj/item/I, mob/user, params)
- if(state_open && is_operational())
+ if(state_open && is_operational)
if(istype(I, /obj/item/clothing/suit))
if(suit)
to_chat(user, "The unit already contains a suit!.")
@@ -424,7 +424,7 @@
/obj/machinery/suit_storage_unit/default_pry_open(obj/item/I)//needs to check if the storage is locked.
- . = !(state_open || panel_open || is_operational() || locked || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
+ . = !(state_open || panel_open || is_operational || locked || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
if(.)
I.play_tool_sound(src, 50)
visible_message("[usr] pries open \the [src].", "You pry open \the [src].")
diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm
index a2cf4cb71ed..edeec36ef10 100644
--- a/code/game/machinery/syndicatebeacon.dm
+++ b/code/game/machinery/syndicatebeacon.dm
@@ -10,7 +10,6 @@
anchored = FALSE
density = TRUE
layer = BELOW_MOB_LAYER //so people can't hide it and it's REALLY OBVIOUS
- machine_stat = 0
verb_say = "states"
var/cooldown = 0
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index af687355b2b..ecb464acbbe 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -146,9 +146,9 @@ GLOBAL_LIST_EMPTY(telecomms_list)
if(. & EMP_PROTECT_SELF)
return
if(prob(100/severity) && !(machine_stat & EMPED))
- machine_stat |= EMPED
+ set_machine_stat(machine_stat | EMPED)
var/duration = (300 * 10)/severity
addtimer(CALLBACK(src, .proc/de_emp), rand(duration - 20, duration + 20))
/obj/machinery/telecomms/proc/de_emp()
- machine_stat &= ~EMPED
+ set_machine_stat(machine_stat & ~EMPED)
diff --git a/code/modules/NTNet/network.dm b/code/modules/NTNet/network.dm
index e7d64f796ab..7f771d34c17 100644
--- a/code/modules/NTNet/network.dm
+++ b/code/modules/NTNet/network.dm
@@ -128,7 +128,7 @@
var/obj/machinery/ntnet_relay/n = i
if(zlevel && n.z != zlevel)
continue
- if(n.is_operational())
+ if(n.is_operational)
return TRUE
return FALSE
diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm
index 0fbb9d0bc0b..dc3a1876997 100644
--- a/code/modules/NTNet/relays.dm
+++ b/code/modules/NTNet/relays.dm
@@ -11,8 +11,10 @@
circuit = /obj/item/circuitboard/machine/ntnet_relay
var/datum/ntnet/NTNet = null // This is mostly for backwards reference and to allow varedit modifications from ingame.
- var/enabled = 1 // Set to 0 if the relay was turned off
- var/dos_failure = 0 // Set to 1 if the relay failed due to (D)DoS attack
+ ///On / off status for the relay machine, toggleable by the user.
+ var/relay_enabled = TRUE
+ ///(D)DoS-attack-related failure causing it not to be operational any longer.
+ var/dos_failure = FALSE
var/list/dos_sources = list() // Backwards reference for qdel() stuff
var/uid
var/static/gl_uid = 1
@@ -23,24 +25,47 @@
var/dos_dissipate = 1 // Amount of DoS "packets" dissipated over time.
-// TODO: Implement more logic here. For now it's only a placeholder.
-/obj/machinery/ntnet_relay/is_operational()
- if(machine_stat & (BROKEN | NOPOWER | EMPED))
- return FALSE
- if(dos_failure)
- return FALSE
- if(!enabled)
- return FALSE
- return TRUE
+///Proc called to change the value of the `relay_enabled` variable and append behavior related to its change.
+/obj/machinery/ntnet_relay/proc/set_relay_enabled(new_value)
+ if(new_value == relay_enabled)
+ return
+ . = relay_enabled
+ relay_enabled = new_value
+ if(.) //Turned off
+ set_is_operational(FALSE)
+ else if(!dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //Turned on
+ set_is_operational(TRUE)
+
+
+///Proc called to change the value of the `dos_failure` variable and append behavior related to its change.
+/obj/machinery/ntnet_relay/proc/set_dos_failure(new_value)
+ if(new_value == dos_failure)
+ return
+ . = dos_failure
+ dos_failure = new_value
+ if(.) //Failure ended
+ if(relay_enabled && !(machine_stat & (NOPOWER|BROKEN|MAINT)))
+ set_is_operational(TRUE)
+ else //Failure started
+ set_is_operational(FALSE)
+
+
+/obj/machinery/ntnet_relay/on_set_machine_stat(old_value)
+ if(old_value & (NOPOWER|BROKEN|MAINT))
+ if(relay_enabled && !dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //From off to on.
+ set_is_operational(TRUE)
+ else if(machine_stat & (NOPOWER|BROKEN|MAINT)) //From on to off.
+ set_is_operational(FALSE)
+
/obj/machinery/ntnet_relay/update_icon_state()
- if(is_operational())
+ if(is_operational)
icon_state = "bus"
else
icon_state = "bus_off"
/obj/machinery/ntnet_relay/process()
- if(is_operational())
+ if(is_operational)
use_power = ACTIVE_POWER_USE
else
use_power = IDLE_POWER_USE
@@ -52,12 +77,12 @@
// If DoS traffic exceeded capacity, crash.
if((dos_overload > dos_capacity) && !dos_failure)
- dos_failure = 1
+ set_dos_failure(TRUE)
update_icon()
SSnetworks.station_network.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
// If the DoS buffer reaches 0 again, restart.
if((dos_overload == 0) && dos_failure)
- dos_failure = 0
+ set_dos_failure(FALSE)
update_icon()
SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
..()
@@ -70,7 +95,7 @@
/obj/machinery/ntnet_relay/ui_data(mob/user)
var/list/data = list()
- data["enabled"] = enabled
+ data["enabled"] = relay_enabled
data["dos_capacity"] = dos_capacity
data["dos_overload"] = dos_overload
data["dos_crashed"] = dos_failure
@@ -82,13 +107,13 @@
switch(action)
if("restart")
dos_overload = 0
- dos_failure = 0
+ set_dos_failure(FALSE)
update_icon()
SSnetworks.station_network.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
return TRUE
if("toggle")
- enabled = !enabled
- SSnetworks.station_network.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
+ set_relay_enabled(!relay_enabled)
+ SSnetworks.station_network.add_log("Quantum relay manually [relay_enabled ? "enabled" : "disabled"].")
update_icon()
return TRUE
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index 2fbfea08574..c8ad46a47f7 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -73,7 +73,7 @@
update_icon()
/obj/machinery/atmospherics/components/binary/circulator/update_icon()
- if(!is_operational())
+ if(!is_operational)
icon_state = "circ-p-[flipped]"
else if(last_pressure_delta > 0)
if(last_pressure_delta > ONE_ATMOSPHERE)
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm
index d3c5959e2c2..915b246718f 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm
@@ -42,7 +42,7 @@
var/image/cap = getpipeimage(icon, "dpvent_cap", dir, piping_layer = piping_layer)
add_overlay(cap)
- if(!on || !is_operational())
+ if(!on || !is_operational)
icon_state = "vent_off"
else
icon_state = pump_direction ? "vent_out" : "vent_in"
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index d65eecbfca8..c007c8e6138 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -48,11 +48,11 @@
return ..()
/obj/machinery/atmospherics/components/binary/pump/update_icon_nopipes()
- icon_state = (on && is_operational()) ? "pump_on" : "pump_off"
+ icon_state = (on && is_operational) ? "pump_on" : "pump_off"
/obj/machinery/atmospherics/components/binary/pump/process_atmos()
// ..()
- if(!on || !is_operational())
+ if(!on || !is_operational)
return
var/datum/gas_mixture/air1 = airs[1]
@@ -147,7 +147,7 @@
/obj/machinery/atmospherics/components/binary/pump/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
index cbf0cb95f2b..23ca4bd4ec3 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
@@ -67,7 +67,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_OPEN | INTERACT_MACHINE_OPEN_SILICON
/obj/machinery/atmospherics/components/binary/valve/digital/update_icon_nopipes(animation)
- if(!is_operational())
+ if(!is_operational)
normalize_cardinal_directions()
icon_state = "dvalve_nopower"
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
index 6ad675e123f..4d0247863e8 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -47,11 +47,11 @@
return ..()
/obj/machinery/atmospherics/components/binary/volume_pump/update_icon_nopipes()
- icon_state = on && is_operational() ? "volpump_on" : "volpump_off"
+ icon_state = on && is_operational ? "volpump_on" : "volpump_off"
/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos()
// ..()
- if(!on || !is_operational())
+ if(!on || !is_operational)
return
var/datum/gas_mixture/air1 = airs[1]
@@ -175,7 +175,7 @@
/obj/machinery/atmospherics/components/binary/volume_pump/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index f663f0fc9b8..9ed689f0d2f 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -56,12 +56,12 @@
return ..()
/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes()
- var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational()
+ var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
icon_state = "filter_[on_state ? "on" : "off"][flipped ? "_f" : ""]"
/obj/machinery/atmospherics/components/trinary/filter/process_atmos()
..()
- if(!on || !(nodes[1] && nodes[2] && nodes[3]) || !is_operational())
+ if(!on || !(nodes[1] && nodes[2] && nodes[3]) || !is_operational)
return
//Early return
@@ -170,7 +170,7 @@
/obj/machinery/atmospherics/components/trinary/filter/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index 1fb99a2b025..b1fe8d275e1 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -48,7 +48,7 @@
return ..()
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
- var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational()
+ var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
icon_state = "mixer_[on_state ? "on" : "off"][flipped ? "_f" : ""]"
/obj/machinery/atmospherics/components/trinary/mixer/New()
@@ -59,7 +59,7 @@
/obj/machinery/atmospherics/components/trinary/mixer/process_atmos()
..()
- if(!on || !(nodes[1] && nodes[2] && nodes[3]) && !is_operational())
+ if(!on || !(nodes[1] && nodes[2] && nodes[3]) && !is_operational)
return
//Get those gases, mah boiiii
@@ -176,7 +176,7 @@
/obj/machinery/atmospherics/components/trinary/mixer/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 725df459b87..1be2063863e 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -14,6 +14,7 @@
circuit = /obj/item/circuitboard/machine/cryo_tube
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
occupant_typecache = list(/mob/living/carbon, /mob/living/simple_animal)
+ processing_flags = NONE
var/autoeject = TRUE
var/volume = 100
@@ -45,6 +46,8 @@
/obj/machinery/atmospherics/components/unary/cryo_cell/Initialize()
. = ..()
initialize_directions = dir
+ if(is_operational)
+ begin_processing()
radio = new(src)
radio.keyslot = new radio_key
@@ -150,7 +153,7 @@
occupant_overlay.dir = SOUTH
occupant_overlay.pixel_y = 22
- if(on && !running_anim && is_operational())
+ if(on && !running_anim && is_operational)
icon_state = "pod-on"
running_anim = TRUE
run_anim(TRUE, occupant_overlay)
@@ -159,7 +162,7 @@
add_overlay(occupant_overlay)
add_overlay("cover-off")
- else if(on && is_operational())
+ else if(on && is_operational)
icon_state = "pod-on"
add_overlay("cover-on")
else
@@ -167,7 +170,7 @@
add_overlay("cover-off")
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/run_anim(anim_up, image/occupant_overlay)
- if(!on || !occupant || !is_operational())
+ if(!on || !occupant || !is_operational)
running_anim = FALSE
return
cut_overlays()
@@ -184,15 +187,21 @@
/obj/machinery/atmospherics/components/unary/cryo_cell/nap_violation(mob/violator)
open_machine()
+
+/obj/machinery/atmospherics/components/unary/cryo_cell/on_set_is_operational(old_value)
+ if(old_value) //Turned off
+ on = FALSE
+ end_processing()
+ update_icon()
+ else //Turned on
+ begin_processing()
+
+
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
..()
if(!on)
return
- if(!is_operational())
- on = FALSE
- update_icon()
- return
if(!occupant)
return
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
index 5c4886f1397..da677639693 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -47,7 +47,7 @@
// everything is already shifted so don't shift the cap
add_overlay(getpipeimage(icon, "inje_cap", initialize_directions))
- if(!nodes[1] || !on || !is_operational())
+ if(!nodes[1] || !on || !is_operational)
icon_state = "inje_off"
else
icon_state = "inje_on"
@@ -57,7 +57,7 @@
injecting = 0
- if(!on || !is_operational())
+ if(!on || !is_operational)
return
var/datum/gas_mixture/air_contents = airs[1]
@@ -74,7 +74,7 @@
/obj/machinery/atmospherics/components/unary/outlet_injector/proc/inject()
- if(on || injecting || !is_operational())
+ if(on || injecting || !is_operational)
return
var/datum/gas_mixture/air_contents = airs[1]
@@ -179,7 +179,7 @@
/obj/machinery/atmospherics/components/unary/outlet_injector/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
index 0433208cb3e..2281d6a1062 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
@@ -45,7 +45,7 @@
if(panel_open)
icon_state = icon_state_open
- else if(on && is_operational())
+ else if(on && is_operational)
icon_state = icon_state_on
else
icon_state = icon_state_off
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
index d92537aa094..b09a68a1da2 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -59,7 +59,7 @@
icon_state = "vent_welded"
return
- if(!nodes[1] || !on || !is_operational())
+ if(!nodes[1] || !on || !is_operational)
if(icon_state == "vent_welded")
icon_state = "vent_off"
return
@@ -86,7 +86,7 @@
/obj/machinery/atmospherics/components/unary/vent_pump/process_atmos()
..()
- if(!is_operational())
+ if(!is_operational)
return
if(!nodes[1])
on = FALSE
@@ -178,7 +178,7 @@
..()
/obj/machinery/atmospherics/components/unary/vent_pump/receive_signal(datum/signal/signal)
- if(!is_operational())
+ if(!is_operational)
return
// log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/components/unary/vent_pump/receive_signal([signal.debug_print()])")
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
@@ -269,7 +269,7 @@
/obj/machinery/atmospherics/components/unary/vent_pump/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
index 7da78721259..5257c1c2fba 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -51,7 +51,7 @@
return ..()
/obj/machinery/atmospherics/components/unary/vent_scrubber/auto_use_power()
- if(!on || welded || !is_operational() || !powered(power_channel))
+ if(!on || welded || !is_operational || !powered(power_channel))
return FALSE
var/amount = idle_power_usage
@@ -76,7 +76,7 @@
icon_state = "scrub_welded"
return
- if(!nodes[1] || !on || !is_operational())
+ if(!nodes[1] || !on || !is_operational)
icon_state = "scrub_off"
return
@@ -137,7 +137,7 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos()
..()
- if(welded || !is_operational())
+ if(welded || !is_operational)
return FALSE
if(!nodes[1] || !on)
on = FALSE
@@ -217,7 +217,7 @@
adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1)
/obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal)
- if(!is_operational() || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
+ if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
return 0
var/atom/signal_sender = signal.data["user"]
@@ -285,7 +285,7 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/can_unwrench(mob/user)
. = ..()
- if(. && on && is_operational())
+ if(. && on && is_operational)
to_chat(user, "You cannot unwrench [src], turn it off first!")
return FALSE
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 286a373fb6f..d20e3c2392d 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -68,7 +68,7 @@
. = ..()
if(. & EMP_PROTECT_SELF)
return
- if(is_operational())
+ if(is_operational)
if(prob(50 / severity))
on = !on
if(prob(100 / severity))
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 06fa65d6696..fd56cc667e9 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -90,7 +90,7 @@
. = ..()
if(. & EMP_PROTECT_SELF)
return
- if(is_operational())
+ if(is_operational)
if(prob(50 / severity))
on = !on
update_icon()
@@ -171,7 +171,7 @@
icon_state = "scrubber:[on]"
/obj/machinery/portable_atmospherics/scrubber/huge/process_atmos()
- if((!anchored && !movable) || !is_operational())
+ if((!anchored && !movable) || !is_operational)
on = FALSE
update_icon()
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm
index 1b45c0fbb6e..824e1176937 100644
--- a/code/modules/holodeck/computer.dm
+++ b/code/modules/holodeck/computer.dm
@@ -238,7 +238,7 @@
HE.safety(active)
/obj/machinery/computer/holodeck/proc/load_program(area/A, force = FALSE, add_delay = TRUE)
- if(!is_operational())
+ if(!is_operational)
A = offline_program
force = TRUE
diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm
index 490de4148c4..ab7f9451ec2 100644
--- a/code/modules/modular_computers/computers/machinery/modular_computer.dm
+++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm
@@ -100,13 +100,13 @@
visible_message("\The [src]'s screen flickers [battery_module ? "\"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\"" : "\"EXTERNAL POWER LOSS\""] warning as it shuts down unexpectedly.")
if(cpu)
cpu.shutdown_computer(0)
- machine_stat |= NOPOWER
+ set_machine_stat(machine_stat | NOPOWER)
update_icon()
// Modular computers can have battery in them, we handle power in previous proc, so prevent this from messing it up for us.
/obj/machinery/modular_computer/power_change()
if(cpu && cpu.use_power()) // If MC_CPU still has a power source, PC wouldn't go offline.
- machine_stat &= ~NOPOWER
+ set_machine_stat(machine_stat & ~NOPOWER)
update_icon()
return
. = ..()
diff --git a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm
index 803dadc0a06..3fe1d01453b 100644
--- a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm
+++ b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm
@@ -25,7 +25,7 @@
dos_speed = NTNETSPEED_ETHERNET * 10
if(target && executed)
target.dos_overload += dos_speed
- if(!target.is_operational())
+ if(!target.is_operational)
target.dos_sources.Remove(src)
target = null
error = "Connection to destination relay lost."
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 4702d18c80c..fea40b36e16 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -187,7 +187,7 @@
opened = APC_COVER_OPENED
operating = FALSE
name = "\improper [get_area_name(area, TRUE)] APC"
- machine_stat |= MAINT
+ set_machine_stat(machine_stat | MAINT)
update_icon()
addtimer(CALLBACK(src, .proc/update), 5)
@@ -489,12 +489,12 @@
switch (has_electronics)
if (APC_ELECTRONICS_INSTALLED)
has_electronics = APC_ELECTRONICS_SECURED
- machine_stat &= ~MAINT
+ set_machine_stat(machine_stat & ~MAINT)
W.play_tool_sound(src)
to_chat(user, "You screw the circuit electronics into place.")
if (APC_ELECTRONICS_SECURED)
has_electronics = APC_ELECTRONICS_INSTALLED
- machine_stat |= MAINT
+ set_machine_stat(machine_stat | MAINT)
W.play_tool_sound(src)
to_chat(user, "You unfasten the electronics.")
else
@@ -658,7 +658,7 @@
if(do_after(user, 50, target = src))
to_chat(user, "You replace the damaged APC frame with a new one.")
qdel(W)
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
obj_integrity = max_integrity
if (opened==APC_COVER_REMOVED)
opened = APC_COVER_OPENED
@@ -1030,7 +1030,7 @@
return 1
/obj/machinery/power/apc/proc/toggle_breaker(mob/user)
- if(!is_operational() || failure_timer)
+ if(!is_operational || failure_timer)
return
operating = !operating
add_hiddenprint(user)
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index 7c668d36ab2..8d93907e0e7 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -59,7 +59,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
obj_break()
/obj/machinery/gravity_generator/proc/set_fix()
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
/obj/machinery/gravity_generator/part/Destroy()
if(main_part)
diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm
index ef1939ee2a7..a1bf54d61ee 100644
--- a/code/modules/power/power.dm
+++ b/code/modules/power/power.dm
@@ -127,12 +127,12 @@
if(machine_stat & NOPOWER)
SEND_SIGNAL(src, COMSIG_MACHINERY_POWER_RESTORED)
. = TRUE
- machine_stat &= ~NOPOWER
+ set_machine_stat(machine_stat & ~NOPOWER)
else
if(!(machine_stat & NOPOWER))
SEND_SIGNAL(src, COMSIG_MACHINERY_POWER_LOST)
. = TRUE
- machine_stat |= NOPOWER
+ set_machine_stat(machine_stat | NOPOWER)
update_icon()
// connect the machine to a powernet if a node cable or a terminal is present on the turf
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index a2fd977d4f5..a74834b5c36 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -97,7 +97,7 @@
if(!terminal)
to_chat(user, "No power terminal found.")
return
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
update_icon()
return
@@ -194,7 +194,7 @@
terminal = new/obj/machinery/power/terminal(T)
terminal.setDir(get_dir(T,src))
terminal.master = src
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
/obj/machinery/power/smes/disconnect_terminal()
if(terminal)
diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm
index 8924e1dd70c..32bf4ccf046 100644
--- a/code/modules/power/turbine.dm
+++ b/code/modules/power/turbine.dm
@@ -109,7 +109,7 @@
locate_machinery()
if(turbine)
to_chat(user, "Turbine connected.")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
else
to_chat(user, "Turbine not connected.")
obj_break()
@@ -195,7 +195,7 @@
/obj/machinery/power/turbine/process()
if(!compressor)
- machine_stat = BROKEN
+ set_machine_stat(BROKEN)
if((machine_stat & BROKEN) || panel_open)
return
@@ -239,7 +239,7 @@
locate_machinery()
if(compressor)
to_chat(user, "Compressor connected.")
- machine_stat &= ~BROKEN
+ set_machine_stat(machine_stat & ~BROKEN)
else
to_chat(user, "Compressor not connected.")
obj_break()
diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
index 120983e65b8..17020a5e591 100644
--- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
@@ -22,6 +22,7 @@
interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE
resistance_flags = FIRE_PROOF | ACID_PROOF
circuit = /obj/item/circuitboard/machine/chem_dispenser
+ processing_flags = NONE
var/obj/item/stock_parts/cell/cell
var/powerefficiency = 0.1
@@ -90,6 +91,8 @@
emagged_reagents = sortList(emagged_reagents, /proc/cmp_reagents_asc)
if(upgrade_reagents)
upgrade_reagents = sortList(upgrade_reagents, /proc/cmp_reagents_asc)
+ if(is_operational)
+ begin_processing()
update_icon()
/obj/machinery/chem_dispenser/Destroy()
@@ -106,10 +109,16 @@
Recharging [recharge_amount] power units per interval.\n\
Power efficiency increased by [round((powerefficiency*1000)-100, 1)]%."
+
+/obj/machinery/chem_dispenser/on_set_is_operational(old_value)
+ if(old_value) //Turned off
+ end_processing()
+ else //Turned on
+ begin_processing()
+
+
/obj/machinery/chem_dispenser/process()
if (recharge_counter >= 4)
- if(!is_operational())
- return
var/usedpower = cell.give(recharge_amount)
if(usedpower)
use_power(250*recharge_amount)
@@ -223,7 +232,7 @@
return
switch(action)
if("amount")
- if(!is_operational() || QDELETED(beaker))
+ if(!is_operational || QDELETED(beaker))
return
var/target = text2num(params["target"])
if(target in beaker.possible_transfer_amounts)
@@ -231,7 +240,7 @@
work_animation()
. = TRUE
if("dispense")
- if(!is_operational() || QDELETED(cell))
+ if(!is_operational || QDELETED(cell))
return
var/reagent_name = params["reagent"]
if(!recording_recipe)
@@ -251,7 +260,7 @@
recording_recipe[reagent_name] += amount
. = TRUE
if("remove")
- if(!is_operational() || recording_recipe)
+ if(!is_operational || recording_recipe)
return
var/amount = text2num(params["amount"])
if(beaker && (amount in beaker.possible_transfer_amounts))
@@ -262,7 +271,7 @@
replace_beaker(usr)
. = TRUE
if("dispense_recipe")
- if(!is_operational() || QDELETED(cell))
+ if(!is_operational || QDELETED(cell))
return
var/list/chemicals_to_dispense = saved_recipes[params["recipe"]]
if(!LAZYLEN(chemicals_to_dispense))
@@ -288,19 +297,19 @@
recording_recipe[key] += dispense_amount
. = TRUE
if("clear_recipes")
- if(!is_operational())
+ if(!is_operational)
return
var/yesno = alert("Clear all recipes?",, "Yes","No")
if(yesno == "Yes")
saved_recipes = list()
. = TRUE
if("record_recipe")
- if(!is_operational())
+ if(!is_operational)
return
recording_recipe = list()
. = TRUE
if("save_recording")
- if(!is_operational())
+ if(!is_operational)
return
var/name = stripped_input(usr,"Name","What do you want to name this recipe?", "Recipe", MAX_NAME_LEN)
if(!usr.canUseTopic(src, !issilicon(usr)))
@@ -319,7 +328,7 @@
recording_recipe = null
. = TRUE
if("cancel_recording")
- if(!is_operational())
+ if(!is_operational)
return
recording_recipe = null
. = TRUE
diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm
index 41b8c94ffd6..9356550f6c1 100644
--- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm
+++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm
@@ -7,6 +7,7 @@
icon_state = "smoke0"
density = TRUE
circuit = /obj/item/circuitboard/machine/smoke_machine
+ processing_flags = NONE
var/efficiency = 10
var/on = FALSE
@@ -35,9 +36,12 @@
AddComponent(/datum/component/plumbing/simple_demand)
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
reagents.maximum_volume += REAGENTS_BASE_VOLUME * B.rating
+ if(is_operational)
+ begin_processing()
+
/obj/machinery/smoke_machine/update_icon_state()
- if((!is_operational()) || (!on) || (reagents.total_volume == 0))
+ if((!is_operational) || (!on) || (reagents.total_volume == 0))
if (panel_open)
icon_state = "smoke0-o"
else
@@ -63,10 +67,16 @@
max_range += M.rating
max_range = max(3, max_range)
+
+/obj/machinery/smoke_machine/on_set_is_operational(old_value)
+ if(old_value) //Turned off
+ end_processing()
+ else //Turned on
+ begin_processing()
+
+
/obj/machinery/smoke_machine/process()
..()
- if(!is_operational())
- return
if(reagents.total_volume == 0)
on = FALSE
update_icon()
diff --git a/code/modules/research/bepis.dm b/code/modules/research/bepis.dm
index f70c33dfc9d..dafd34ba91d 100644
--- a/code/modules/research/bepis.dm
+++ b/code/modules/research/bepis.dm
@@ -48,7 +48,7 @@
return
if(default_deconstruction_crowbar(O))
return
- if(!is_operational())
+ if(!is_operational)
to_chat(user, "[src] can't accept money when it's not functioning.")
return
if(istype(O, /obj/item/holochip) || istype(O, /obj/item/stack/spacecash))
@@ -169,16 +169,16 @@
if(panel_open == TRUE)
icon_state = "chamber_open"
return
- if((use_power == ACTIVE_POWER_USE) && (banked_cash > 0) && (is_operational()))
+ if((use_power == ACTIVE_POWER_USE) && (banked_cash > 0) && (is_operational))
icon_state = "chamber_active_loaded"
return
- if (((use_power == IDLE_POWER_USE) && (banked_cash > 0)) || (banked_cash > 0) && (!is_operational()))
+ if (((use_power == IDLE_POWER_USE) && (banked_cash > 0)) || (banked_cash > 0) && (!is_operational))
icon_state = "chamber_loaded"
return
- if(use_power == ACTIVE_POWER_USE && is_operational())
+ if(use_power == ACTIVE_POWER_USE && is_operational)
icon_state = "chamber_active"
return
- if(((use_power == IDLE_POWER_USE) && (banked_cash == 0)) || (!is_operational()))
+ if(((use_power == IDLE_POWER_USE) && (banked_cash == 0)) || (!is_operational))
icon_state = "chamber"
return
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index 1538b2450cd..e6b71d7658f 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -62,12 +62,12 @@
. = ..()
if(. & EMP_PROTECT_SELF)
return
- machine_stat |= EMPED
+ set_machine_stat(machine_stat | EMPED)
addtimer(CALLBACK(src, .proc/unemp), 600)
refresh_working()
/obj/machinery/rnd/server/proc/unemp()
- machine_stat &= ~EMPED
+ set_machine_stat(machine_stat & ~EMPED)
refresh_working()
/obj/machinery/rnd/server/proc/toggle_disable()
diff --git a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm
index 550a63a4a56..eb87a784f0f 100644
--- a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm
+++ b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm
@@ -14,7 +14,7 @@
///When we process, we make use of our reagents to try and feed the samples we have.
/obj/machinery/plumbing/growing_vat/process()
- if(!is_operational())
+ if(!is_operational)
return
if(!biological_sample)
return
@@ -79,6 +79,6 @@
base_overlay.appearance_flags = RESET_COLOR
base_overlay.color = reagentcolor
. += base_overlay
- if(biological_sample && is_operational())
+ if(biological_sample && is_operational)
var/mutable_appearance/bubbles_overlay = mutable_appearance(icon, "vat_bubbles")
. += bubbles_overlay