diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
index cc280d97ccb..4698c613a9e 100644
--- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/binary
dir = SOUTH
initialize_directions = SOUTH|NORTH
- use_power = USE_POWER_IDLE
+ use_power = 1
var/datum/gas_mixture/air1
var/datum/gas_mixture/air2
diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
index 2f276160fe7..41ba2cf7058 100644
--- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
@@ -20,7 +20,7 @@
level = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //7500 W ~ 10 HP
@@ -214,10 +214,10 @@
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return 0
if(signal.data["power"])
- update_use_power(text2num(signal.data["power"]))
+ use_power = text2num(signal.data["power"])
if(signal.data["power_toggle"])
- update_use_power(!use_power)
+ use_power = !use_power
if(signal.data["direction"])
pump_direction = text2num(signal.data["direction"])
diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
index 191e6291ea6..92c26fb2809 100644
--- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
@@ -12,7 +12,7 @@
name = "pressure regulator"
desc = "A one-way air valve that can be used to regulate input or output pressure, and flow rate. Does not require power."
- use_power = USE_POWER_OFF
+ use_power = 0
var/unlocked = 0 //If 0, then the valve is locked closed, otherwise it is open(-able, it's a one-way valve so it closes if gas would flow backwards).
var/target_pressure = ONE_ATMOSPHERE
diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm
index e241cc944b9..b4b8187f453 100644
--- a/code/ATMOSPHERICS/components/binary_devices/pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm
@@ -26,7 +26,7 @@ Thus, the two variables affect pump operation are set in New():
//var/max_volume_transfer = 10000
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //7500 W ~ 10 HP
@@ -47,7 +47,7 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump/on
icon_state = "map_on"
- use_power = USE_POWER_IDLE
+ use_power = 1
/obj/machinery/atmospherics/binary/pump/update_icon()
@@ -160,12 +160,12 @@ Thus, the two variables affect pump operation are set in New():
if(signal.data["power"])
if(text2num(signal.data["power"]))
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
else
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if("power_toggle" in signal.data)
- update_use_power(!use_power)
+ use_power = !use_power
if(signal.data["set_output_pressure"])
target_pressure = between(
@@ -199,7 +199,7 @@ Thus, the two variables affect pump operation are set in New():
if(..()) return 1
if(href_list["power"])
- update_use_power(!use_power)
+ use_power = !use_power
switch(href_list["set_press"])
if ("min")
diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
index 8e827505885..fa0aaf4bd0c 100644
--- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
@@ -11,7 +11,7 @@
power_rating = 15000 //15000 W ~ 20 HP
/obj/machinery/atmospherics/binary/pump/high_power/on
- use_power = USE_POWER_IDLE
+ use_power = 1
icon_state = "map_on"
/obj/machinery/atmospherics/binary/pump/high_power/update_icon()
diff --git a/code/ATMOSPHERICS/components/omni_devices/filter.dm b/code/ATMOSPHERICS/components/omni_devices/filter.dm
index 9f0862d8001..074c6c528d0 100644
--- a/code/ATMOSPHERICS/components/omni_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/omni_devices/filter.dm
@@ -11,7 +11,7 @@
var/datum/omni_port/input
var/datum/omni_port/output
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //7500 W ~ 10 HP
@@ -161,13 +161,13 @@
switch(href_list["command"])
if("power")
if(!configuring)
- update_use_power(!use_power)
+ use_power = !use_power
else
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if("configure")
configuring = !configuring
if(configuring)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
//only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on
if(configuring && !use_power)
diff --git a/code/ATMOSPHERICS/components/omni_devices/mixer.dm b/code/ATMOSPHERICS/components/omni_devices/mixer.dm
index 0210d09e691..47c78427f0c 100644
--- a/code/ATMOSPHERICS/components/omni_devices/mixer.dm
+++ b/code/ATMOSPHERICS/components/omni_devices/mixer.dm
@@ -6,7 +6,7 @@
icon_state = "map_mixer"
pipe_state = "omni_mixer"
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 3700 //3700 W ~ 5 HP
@@ -178,13 +178,13 @@
switch(href_list["command"])
if("power")
if(!configuring)
- update_use_power(!use_power)
+ use_power = !use_power
else
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if("configure")
configuring = !configuring
if(configuring)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
//only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on
if(configuring && !use_power)
diff --git a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm
index 54acc3db99f..6f78a7d0640 100644
--- a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm
+++ b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm
@@ -5,7 +5,7 @@
name = "omni device"
icon = 'icons/atmos/omni_devices_vr.dmi' //VOREStation Edit - New Icon
icon_state = "base"
- use_power = USE_POWER_IDLE
+ use_power = 1
initialize_directions = 0
construction_type = /obj/item/pipe/quaternary
level = 1
@@ -67,7 +67,7 @@
last_flow_rate = 0
if(error_check())
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if((stat & (NOPOWER|BROKEN)) || !use_power)
return 0
diff --git a/code/ATMOSPHERICS/components/portables_connector.dm b/code/ATMOSPHERICS/components/portables_connector.dm
index fd5033100b1..b30bc9b0389 100644
--- a/code/ATMOSPHERICS/components/portables_connector.dm
+++ b/code/ATMOSPHERICS/components/portables_connector.dm
@@ -18,7 +18,7 @@
var/datum/pipe_network/network
var/on = 0
- use_power = USE_POWER_OFF
+ use_power = 0
level = 1
/obj/machinery/atmospherics/portables_connector/init_dir()
diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
index 21e1a34d333..e900303e222 100755
--- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
@@ -9,7 +9,7 @@
name = "Gas filter"
desc = "Filters one type of gas from an input, and pushes it out the side."
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //This also doubles as a measure of how powerful the filter is, in Watts. 7500 W ~ 10 HP
@@ -73,7 +73,7 @@
icon_state += use_power ? "on" : "off"
else
icon_state += "off"
- update_use_power(USE_POWER_OFF)
+ use_power = 0
/obj/machinery/atmospherics/trinary/atmos_filter/process()
..()
diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
index 62b4b763b83..8bf3d3477cb 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
@@ -8,7 +8,7 @@
name = "Gas mixer"
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 3700 //This also doubles as a measure of how powerful the mixer is, in Watts. 3700 W ~ 5 HP
@@ -35,7 +35,7 @@
icon_state += use_power ? "on" : "off"
else
icon_state += "off"
- update_use_power(USE_POWER_OFF)
+ use_power = 0
/obj/machinery/atmospherics/trinary/mixer/New()
..()
@@ -114,7 +114,7 @@
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
if(..()) return 1
if(href_list["power"])
- update_use_power(!use_power)
+ use_power = !use_power
if(href_list["set_press"])
var/max_flow_rate = min(air1.volume, air2.volume)
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",src.set_flow_rate) as num
diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
index 10d7403541b..394dbceeda9 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/trinary
dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST
- use_power = USE_POWER_OFF
+ use_power = 0
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
var/mirrored = FALSE
diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm
index f665ba987a2..d4bfb73311d 100644
--- a/code/ATMOSPHERICS/components/unary/cold_sink.dm
+++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm
@@ -8,7 +8,7 @@
icon_state = "freezer_0"
density = 1
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 5 // 5 Watts for thermostat related circuitry
circuit = /obj/item/weapon/circuitboard/unary_atmos/cooler
@@ -99,7 +99,7 @@
if(..())
return 1
if(href_list["toggleStatus"])
- update_use_power(!use_power)
+ use_power = !use_power
update_icon()
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm
index 7fbe8818916..9729e1d3876 100644
--- a/code/ATMOSPHERICS/components/unary/heat_source.dm
+++ b/code/ATMOSPHERICS/components/unary/heat_source.dm
@@ -8,7 +8,7 @@
icon_state = "heater_0"
density = 1
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 5 //5 Watts for thermostat related circuitry
circuit = /obj/item/weapon/circuitboard/unary_atmos/heater
@@ -119,7 +119,7 @@
if(..())
return 1
if(href_list["toggleStatus"])
- update_use_power(!use_power)
+ use_power = !use_power
update_icon()
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm
index 3c342c3cdbe..5e62fe58021 100644
--- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm
+++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm
@@ -10,7 +10,7 @@
name = "air injector"
desc = "Passively injects air into its surroundings. Has a valve attached to it that can control flow rate."
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 15000 //15000 W ~ 20 HP
@@ -132,10 +132,10 @@
return 0
if(signal.data["power"])
- update_use_power(text2num(signal.data["power"]))
+ use_power = text2num(signal.data["power"])
if(signal.data["power_toggle"])
- update_use_power(!use_power)
+ use_power = !use_power
if(signal.data["inject"])
spawn inject()
@@ -160,7 +160,7 @@
/obj/machinery/atmospherics/unary/outlet_injector/attack_hand(mob/user as mob)
to_chat(user, "You toggle \the [src].")
injecting = !injecting
- update_use_power(injecting ? USE_POWER_IDLE : USE_POWER_OFF)
+ use_power = injecting
update_icon()
/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm
index 534d8e01305..cddcb530ed1 100644
--- a/code/ATMOSPHERICS/components/unary/vent_pump.dm
+++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm
@@ -14,7 +14,7 @@
name = "Air Vent"
desc = "Has a valve and pump attached to it"
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 30000 //7500 W ~ 10 HP //VOREStation Edit - 30000 W
@@ -50,18 +50,18 @@
//var/datum/looping_sound/air_pump/soundloop //VOREStation Removal
/obj/machinery/atmospherics/unary/vent_pump/on
- use_power = USE_POWER_IDLE
+ use_power = 1
icon_state = "map_vent_out"
/obj/machinery/atmospherics/unary/vent_pump/siphon
pump_direction = 0
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
- use_power = USE_POWER_IDLE
+ use_power = 1
icon_state = "map_vent_in"
/obj/machinery/atmospherics/unary/vent_pump/siphon/on/atmos
- use_power = USE_POWER_IDLE
+ use_power = 1
icon_state = "map_vent_in"
external_pressure_bound = 0
external_pressure_bound_default = 0
@@ -189,7 +189,7 @@
return 1
if (!node)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if(!can_pump())
return 0
@@ -311,10 +311,10 @@
pump_direction = 1
if(signal.data["power"] != null)
- update_use_power(text2num(signal.data["power"]))
+ use_power = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
- update_use_power(!use_power)
+ use_power = !use_power
if(signal.data["checks"] != null)
if (signal.data["checks"] == "default")
diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
index 6e3f9ef0422..34897b66efb 100644
--- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
+++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
@@ -5,7 +5,7 @@
name = "Air Scrubber"
desc = "Has a valve and pump attached to it"
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //7500 W ~ 10 HP
@@ -29,7 +29,7 @@
var/radio_filter_in
/obj/machinery/atmospherics/unary/vent_scrubber/on
- use_power = USE_POWER_IDLE
+ use_power = 1
icon_state = "map_scrubber_on"
/obj/machinery/atmospherics/unary/vent_scrubber/New()
@@ -135,7 +135,7 @@
return 1
if (!node)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
//broadcast_status()
if(!use_power || (stat & (NOPOWER|BROKEN)))
return 0
@@ -180,21 +180,21 @@
return 0
if(signal.data["power"] != null)
- update_use_power(text2num(signal.data["power"]))
+ use_power = text2num(signal.data["power"])
if(signal.data["power_toggle"] != null)
- update_use_power(!use_power)
+ use_power = !use_power
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
panic = text2num(signal.data["panic_siphon"])
if(panic)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
scrubbing = 0
else
scrubbing = 1
if(signal.data["toggle_panic_siphon"] != null)
panic = !panic
if(panic)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
scrubbing = 0
else
scrubbing = 1
diff --git a/code/ATMOSPHERICS/pipes/pipe_base.dm b/code/ATMOSPHERICS/pipes/pipe_base.dm
index e627fcbb46d..d1bb92fac77 100644
--- a/code/ATMOSPHERICS/pipes/pipe_base.dm
+++ b/code/ATMOSPHERICS/pipes/pipe_base.dm
@@ -9,7 +9,7 @@
var/leaking = FALSE // Do not set directly, use set_leaking(TRUE/FALSE)
layer = PIPES_LAYER
- use_power = USE_POWER_OFF
+ use_power = 0
pipe_flags = 0 // Does not have PIPING_DEFAULT_LAYER_ONLY flag.
diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm
index 6b4794dff41..e4744693aba 100644
--- a/code/game/dna/dna_modifier.dm
+++ b/code/game/dna/dna_modifier.dm
@@ -46,7 +46,7 @@
icon_state = "scanner_0"
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 50
active_power_usage = 300
interact_offline = 1
@@ -260,7 +260,7 @@
var/obj/item/weapon/disk/data/disk = null
var/selected_menu_key = null
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 400
var/waiting_for_user_input=0 // Fix for #274 (Mash create block injector without answering dialog to make unlimited injectors) - N3X
diff --git a/code/game/machinery/Beacon.dm b/code/game/machinery/Beacon.dm
index b6f6cb25ac7..b34d1565a03 100644
--- a/code/game/machinery/Beacon.dm
+++ b/code/game/machinery/Beacon.dm
@@ -6,7 +6,7 @@
level = 1 // underfloor
layer = UNDER_JUNK_LAYER
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 0
var/obj/item/device/radio/beacon/Beacon
diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm
index 5de15434268..8eae094aebe 100644
--- a/code/game/machinery/OpTable.dm
+++ b/code/game/machinery/OpTable.dm
@@ -5,7 +5,7 @@
icon_state = "table2-idle"
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 1
active_power_usage = 5
surgery_odds = 100
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index 67b34ac19bc..3bfc1fdf699 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -7,7 +7,7 @@
anchored = 1 //About time someone fixed this.
density = 1 //VOREStation Edit - Big console
dir = 8
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 40
interact_offline = 1
circuit = /obj/item/weapon/circuitboard/sleeper_console
@@ -179,7 +179,7 @@
var/stasis_level = 0 //Every 'this' life ticks are applied to the mob (when life_ticks%stasis_level == 1)
var/stasis_choices = list("Complete (1%)" = 100, "Deep (10%)" = 10, "Moderate (20%)" = 5, "Light (50%)" = 2, "None (100%)" = 0)
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 15
active_power_usage = 200 //builtin health analyzer, dialysis machine, injectors.
@@ -388,7 +388,7 @@
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.loc = src
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
occupant = M
update_icon()
@@ -408,7 +408,7 @@
if(A in component_parts)
continue
A.loc = src.loc
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
update_icon()
toggle_filter()
toggle_pump()
diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm
index f5034bcf713..1e3afe81500 100644
--- a/code/game/machinery/adv_med.dm
+++ b/code/game/machinery/adv_med.dm
@@ -9,7 +9,7 @@
density = 1
anchored = 1
circuit = /obj/item/weapon/circuitboard/body_scanner
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 60
active_power_usage = 10000 //10 kW. It's a big all-body scanner.
light_color = "#00FF00"
diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm
index aead0c79f1e..2e4ec6956d4 100644
--- a/code/game/machinery/ai_slipper.dm
+++ b/code/game/machinery/ai_slipper.dm
@@ -3,7 +3,7 @@
icon = 'icons/obj/device.dmi'
icon_state = "liquid_dispenser"
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
var/uses = 20
var/disabled = 1
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/air_alarm.dm
similarity index 70%
rename from code/game/machinery/alarm.dm
rename to code/game/machinery/air_alarm.dm
index ea13bbaf024..ac5295db42a 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/air_alarm.dm
@@ -1,1127 +1,787 @@
-#define AALARM_MODE_SCRUBBING 1
-#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster.
-#define AALARM_MODE_PANIC 3 //constantly sucks all air
-#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and switches to scrubbing
-#define AALARM_MODE_FILL 5 //emergency fill
-#define AALARM_MODE_OFF 6 //Shuts it all down.
-
-#define AALARM_SCREEN_MAIN 1
-#define AALARM_SCREEN_VENT 2
-#define AALARM_SCREEN_SCRUB 3
-#define AALARM_SCREEN_MODE 4
-#define AALARM_SCREEN_SENSORS 5
-
-#define AALARM_REPORT_TIMEOUT 100
-
-#define MAX_TEMPERATURE 90
-#define MIN_TEMPERATURE -40
-
-//all air alarms in area are connected via magic
-/area
- var/obj/machinery/alarm/master_air_alarm
- var/list/air_vent_names = list()
- var/list/air_scrub_names = list()
- var/list/air_vent_info = list()
- var/list/air_scrub_info = list()
-
-/obj/machinery/alarm
- name = "alarm"
- desc = "Used to control various station atmospheric systems. The light indicates the current air status of the area."
- icon = 'icons/obj/monitors_vr.dmi' //VOREStation Edit - Other icons
- icon_state = "alarm0"
- plane = TURF_PLANE
- layer = ABOVE_TURF_LAYER
- anchored = 1
- use_power = USE_POWER_IDLE
- idle_power_usage = 80
- active_power_usage = 1000 //For heating/cooling rooms. 1000 joules equates to about 1 degree every 2 seconds for a single tile of air.
- power_channel = ENVIRON
- req_one_access = list(access_atmospherics, access_engine_equip)
- clicksound = "button"
- clickvol = 30
- var/alarm_id = null
- var/breach_detection = 1 // Whether to use automatic breach detection or not
- var/frequency = 1439
- //var/skipprocess = 0 //Experimenting
- var/alarm_frequency = 1437
- var/remote_control = 0
- var/rcon_setting = 2
- var/rcon_time = 0
- var/locked = 1
- panel_open = 0 // If it's been screwdrivered open.
- var/aidisabled = 0
- var/shorted = 0
- circuit = /obj/item/weapon/circuitboard/airalarm
-
- var/datum/wires/alarm/wires
-
- var/mode = AALARM_MODE_SCRUBBING
- var/screen = AALARM_SCREEN_MAIN
- var/area_uid
- var/area/alarm_area
-
- var/target_temperature = T0C+20
- var/regulating_temperature = 0
-
- var/datum/radio_frequency/radio_connection
-
- var/list/TLV = list()
- var/list/trace_gas = list("sleeping_agent", "volatile_fuel") //list of other gases that this air alarm is able to detect
-
- var/danger_level = 0
- var/pressure_dangerlevel = 0
- var/oxygen_dangerlevel = 0
- var/co2_dangerlevel = 0
- var/phoron_dangerlevel = 0
- var/temperature_dangerlevel = 0
- var/other_dangerlevel = 0
-
- var/report_danger_level = 1
-
- var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles
-
-/obj/machinery/alarm/nobreach
- breach_detection = 0
-
-/obj/machinery/alarm/monitor
- report_danger_level = 0
- breach_detection = 0
-
-/obj/machinery/alarm/alarms_hidden
- alarms_hidden = TRUE
-
-/obj/machinery/alarm/server/Initialize(mapload)
- . = ..()
- req_access = list(access_rd, access_atmospherics, access_engine_equip)
- TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa
- TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
- TLV["phoron"] = list(-1.0, -1.0, 0, 0.5) // Partial pressure, kpa
- TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
- TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
- TLV["temperature"] = list(20, 40, 140, 160) // K
- target_temperature = 90
-
-/obj/machinery/alarm/Initialize(mapload)
- . = ..()
- first_run()
-
-/obj/machinery/alarm/Destroy()
- unregister_radio(src, frequency)
- qdel(wires)
- wires = null
- if(alarm_area && alarm_area.master_air_alarm == src)
- alarm_area.master_air_alarm = null
- elect_master(exclude_self = TRUE)
- return ..()
-
-/obj/machinery/alarm/proc/first_run()
- alarm_area = get_area(src)
- area_uid = alarm_area.uid
- if(name == "alarm")
- name = "[alarm_area.name] Air Alarm"
-
- if(!wires)
- wires = new(src)
-
- // breathable air according to human/Life()
- TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
- TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
- TLV["phoron"] = list(-1.0, -1.0, 0, 0.5) // Partial pressure, kpa
- TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
- TLV["pressure"] = list(ONE_ATMOSPHERE * 0.80, ONE_ATMOSPHERE * 0.90, ONE_ATMOSPHERE * 1.10, ONE_ATMOSPHERE * 1.20) /* kpa */
- TLV["temperature"] = list(T0C - 26, T0C, T0C + 40, T0C + 66) // K
-
-
-/obj/machinery/alarm/Initialize()
- . = ..()
- set_frequency(frequency)
- if(!master_is_operating())
- elect_master()
-
-/obj/machinery/alarm/process()
- if((stat & (NOPOWER|BROKEN)) || shorted)
- return
-
- var/turf/simulated/location = src.loc
- if(!istype(location)) return//returns if loc is not simulated
-
- var/datum/gas_mixture/environment = location.return_air()
-
- //Handle temperature adjustment here.
- handle_heating_cooling(environment)
-
- var/old_level = danger_level
- var/old_pressurelevel = pressure_dangerlevel
- danger_level = overall_danger_level(environment)
-
- if(old_level != danger_level)
- apply_danger_level(danger_level)
-
- if(old_pressurelevel != pressure_dangerlevel)
- if(breach_detected())
- mode = AALARM_MODE_OFF
- apply_mode()
-
- if(mode == AALARM_MODE_CYCLE && environment.return_pressure() < ONE_ATMOSPHERE * 0.05)
- mode = AALARM_MODE_FILL
- apply_mode()
-
- //atmos computer remote controll stuff
- switch(rcon_setting)
- if(RCON_NO)
- remote_control = 0
- if(RCON_AUTO)
- if(danger_level == 2)
- remote_control = 1
- else
- remote_control = 0
- if(RCON_YES)
- remote_control = 1
-
- return
-
-/obj/machinery/alarm/proc/handle_heating_cooling(var/datum/gas_mixture/environment)
- if(!regulating_temperature)
- //check for when we should start adjusting temperature
- if(!get_danger_level(target_temperature, TLV["temperature"]) && abs(environment.temperature - target_temperature) > 2.0)
- update_use_power(USE_POWER_ACTIVE)
- regulating_temperature = 1
- audible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
- "You hear a click and a faint electronic hum.")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- else
- //check for when we should stop adjusting temperature
- if(get_danger_level(target_temperature, TLV["temperature"]) || abs(environment.temperature - target_temperature) <= 0.5)
- update_use_power(USE_POWER_IDLE)
- regulating_temperature = 0
- audible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
- "You hear a click as a faint electronic humming stops.")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
-
- if(regulating_temperature)
- if(target_temperature > T0C + MAX_TEMPERATURE)
- target_temperature = T0C + MAX_TEMPERATURE
-
- if(target_temperature < T0C + MIN_TEMPERATURE)
- target_temperature = T0C + MIN_TEMPERATURE
-
- var/datum/gas_mixture/gas
- gas = environment.remove(0.25 * environment.total_moles)
- if(gas)
-
- if(gas.temperature <= target_temperature) //gas heating
- var/energy_used = min(gas.get_thermal_energy_change(target_temperature) , active_power_usage)
-
- gas.add_thermal_energy(energy_used)
- //use_power(energy_used, ENVIRON) //handle by update_use_power instead
- else //gas cooling
- var/heat_transfer = min(abs(gas.get_thermal_energy_change(target_temperature)), active_power_usage)
-
- //Assume the heat is being pumped into the hull which is fixed at 20 C
- //none of this is really proper thermodynamics but whatever
-
- var/cop = gas.temperature / T20C //coefficient of performance -> power used = heat_transfer/cop
-
- heat_transfer = min(heat_transfer, cop * active_power_usage) //this ensures that we don't use more than active_power_usage amount of power
-
- heat_transfer = -gas.add_thermal_energy(-heat_transfer) //get the actual heat transfer
-
- //use_power(heat_transfer / cop, ENVIRON) //handle by update_use_power instead
-
- environment.merge(gas)
-
-/obj/machinery/alarm/proc/overall_danger_level(var/datum/gas_mixture/environment)
- var/partial_pressure = R_IDEAL_GAS_EQUATION * environment.temperature/environment.volume
- var/environment_pressure = environment.return_pressure()
-
- var/other_moles = 0
- for(var/g in trace_gas)
- other_moles += environment.gas[g] //this is only going to be used in a partial pressure calc, so we don't need to worry about group_multiplier here.
-
- pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
- oxygen_dangerlevel = get_danger_level(environment.gas["oxygen"]*partial_pressure, TLV["oxygen"])
- co2_dangerlevel = get_danger_level(environment.gas["carbon_dioxide"]*partial_pressure, TLV["carbon dioxide"])
- phoron_dangerlevel = get_danger_level(environment.gas["phoron"]*partial_pressure, TLV["phoron"])
- temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
- other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
-
- return max(
- pressure_dangerlevel,
- oxygen_dangerlevel,
- co2_dangerlevel,
- phoron_dangerlevel,
- other_dangerlevel,
- temperature_dangerlevel
- )
-
-// Returns whether this air alarm thinks there is a breach, given the sensors that are available to it.
-/obj/machinery/alarm/proc/breach_detected()
- var/turf/simulated/location = src.loc
-
- if(!istype(location))
- return 0
-
- if(breach_detection == 0)
- return 0
-
- var/datum/gas_mixture/environment = location.return_air()
- var/environment_pressure = environment.return_pressure()
- var/pressure_levels = TLV["pressure"]
-
- if(environment_pressure <= pressure_levels[1]) //low pressures
- if(!(mode == AALARM_MODE_PANIC || mode == AALARM_MODE_CYCLE))
- playsound(src.loc, 'sound/machines/airalarm.ogg', 25, 0, 4)
- return 1
-
- return 0
-
-/obj/machinery/alarm/proc/master_is_operating()
- return alarm_area && alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER | BROKEN))
-
-/obj/machinery/alarm/proc/elect_master(exclude_self = FALSE)
- for(var/obj/machinery/alarm/AA in alarm_area)
- if(exclude_self && AA == src)
- continue
- if(!(AA.stat & (NOPOWER|BROKEN)))
- alarm_area.master_air_alarm = AA
- return 1
- return 0
-
-/obj/machinery/alarm/proc/get_danger_level(var/current_value, var/list/danger_levels)
- if((current_value >= danger_levels[4] && danger_levels[4] > 0) || current_value <= danger_levels[1])
- return 2
- if((current_value >= danger_levels[3] && danger_levels[3] > 0) || current_value <= danger_levels[2])
- return 1
- return 0
-
-/obj/machinery/alarm/update_icon()
- if(panel_open)
- icon_state = "alarmx"
- set_light(0)
- return
- if((stat & (NOPOWER|BROKEN)) || shorted)
- icon_state = "alarmp"
- set_light(0)
- return
-
- var/icon_level = danger_level
- if(alarm_area?.atmosalm)
- icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow
-
- var/new_color = null
- switch(icon_level)
- if(0)
- icon_state = "alarm0"
- new_color = "#03A728"
- if(1)
- icon_state = "alarm2" //yes, alarm2 is yellow alarm
- new_color = "#EC8B2F"
- if(2)
- icon_state = "alarm1"
- new_color = "#DA0205"
-
- set_light(l_range = 2, l_power = 0.25, l_color = new_color)
-
-/obj/machinery/alarm/receive_signal(datum/signal/signal)
- if(stat & (NOPOWER|BROKEN))
- return
- if(alarm_area.master_air_alarm != src)
- if(master_is_operating())
- return
- elect_master()
- if(alarm_area.master_air_alarm != src)
- return
- if(!signal || signal.encryption)
- return
- var/id_tag = signal.data["tag"]
- if(!id_tag)
- return
- if(signal.data["area"] != area_uid)
- return
- if(signal.data["sigtype"] != "status")
- return
-
- var/dev_type = signal.data["device"]
- if(!(id_tag in alarm_area.air_scrub_names) && !(id_tag in alarm_area.air_vent_names))
- register_env_machine(id_tag, dev_type)
- if(dev_type == "AScr")
- alarm_area.air_scrub_info[id_tag] = signal.data
- else if(dev_type == "AVP")
- alarm_area.air_vent_info[id_tag] = signal.data
-
-/obj/machinery/alarm/proc/register_env_machine(var/m_id, var/device_type)
- var/new_name
- if(device_type == "AVP")
- new_name = "[alarm_area.name] Vent Pump #[alarm_area.air_vent_names.len+1]"
- alarm_area.air_vent_names[m_id] = new_name
- else if(device_type == "AScr")
- new_name = "[alarm_area.name] Air Scrubber #[alarm_area.air_scrub_names.len+1]"
- alarm_area.air_scrub_names[m_id] = new_name
- else
- return
- spawn(10)
- send_signal(m_id, list("init" = new_name))
-
-/obj/machinery/alarm/proc/refresh_all()
- for(var/id_tag in alarm_area.air_vent_names)
- var/list/I = alarm_area.air_vent_info[id_tag]
- if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time)
- continue
- send_signal(id_tag, list("status"))
- for(var/id_tag in alarm_area.air_scrub_names)
- var/list/I = alarm_area.air_scrub_info[id_tag]
- if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time)
- continue
- send_signal(id_tag, list("status"))
-
-/obj/machinery/alarm/proc/set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- radio_connection = radio_controller.add_object(src, frequency, RADIO_TO_AIRALARM)
-
-/obj/machinery/alarm/proc/send_signal(var/target, var/list/command)//sends signal 'command' to 'target'. Returns 0 if no radio connection, 1 otherwise
- if(!radio_connection)
- return 0
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- signal.data = command
- signal.data["tag"] = target
- signal.data["sigtype"] = "command"
-
- radio_connection.post_signal(src, signal, RADIO_FROM_AIRALARM)
-// to_world("Signal [command] Broadcasted to [target]")
-
- return 1
-
-/obj/machinery/alarm/proc/apply_mode()
- //propagate mode to other air alarms in the area
- //TODO: make it so that players can choose between applying the new mode to the room they are in (related area) vs the entire alarm area
- for(var/obj/machinery/alarm/AA in alarm_area)
- AA.mode = mode
-
- switch(mode)
- if(AALARM_MODE_SCRUBBING)
- for(var/device_id in alarm_area.air_scrub_names)
- send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "scrubbing"= 1, "panic_siphon"= 0))
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
-
- if(AALARM_MODE_PANIC, AALARM_MODE_CYCLE)
- for(var/device_id in alarm_area.air_scrub_names)
- send_signal(device_id, list("power"= 1, "panic_siphon"= 1))
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 0))
-
- if(AALARM_MODE_REPLACEMENT)
- for(var/device_id in alarm_area.air_scrub_names)
- send_signal(device_id, list("power"= 1, "panic_siphon"= 1))
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
-
- if(AALARM_MODE_FILL)
- for(var/device_id in alarm_area.air_scrub_names)
- send_signal(device_id, list("power"= 0))
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
-
- if(AALARM_MODE_OFF)
- for(var/device_id in alarm_area.air_scrub_names)
- send_signal(device_id, list("power"= 0))
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 0))
-
-/obj/machinery/alarm/proc/apply_danger_level(var/new_danger_level)
- if(report_danger_level && alarm_area.atmosalert(new_danger_level, src))
- post_alert(new_danger_level)
-
- update_icon()
-
-/obj/machinery/alarm/proc/post_alert(alert_level)
- var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency)
- if(!frequency)
- return
-
- var/datum/signal/alert_signal = new
- alert_signal.source = src
- alert_signal.transmission_method = 1
- alert_signal.data["zone"] = alarm_area.name
- alert_signal.data["type"] = "Atmospheric"
-
- if(alert_level==2)
- alert_signal.data["alert"] = "severe"
- else if(alert_level==1)
- alert_signal.data["alert"] = "minor"
- else if(alert_level==0)
- alert_signal.data["alert"] = "clear"
-
- frequency.post_signal(src, alert_signal)
-
-/obj/machinery/alarm/attack_ai(mob/user)
- ui_interact(user)
-
-/obj/machinery/alarm/attack_hand(mob/user)
- . = ..()
- if(.)
- return
- return interact(user)
-
-/obj/machinery/alarm/interact(mob/user)
- ui_interact(user)
- wires.Interact(user)
-
-/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = default_state)
- var/data[0]
- var/remote_connection = 0
- var/remote_access = 0
- if(state)
- var/list/href = state.href_list(user)
- remote_connection = href["remote_connection"] // Remote connection means we're non-adjacent/connecting from another computer
- remote_access = href["remote_access"] // Remote access means we also have the privilege to alter the air alarm.
-
- data["locked"] = locked && !issilicon(user)
- data["remote_connection"] = remote_connection
- data["remote_access"] = remote_access
- data["rcon"] = rcon_setting
- data["screen"] = screen
-
- populate_status(data)
-
- if(!(locked && !remote_connection) || remote_access || issilicon(user))
- populate_controls(data)
-
- ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
- if(!ui)
- ui = new(user, src, ui_key, "air_alarm.tmpl", name, 325, 625, master_ui = master_ui, state = state)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
-
-/obj/machinery/alarm/proc/populate_status(var/data)
- var/turf/location = get_turf(src)
- var/datum/gas_mixture/environment = location.return_air()
- var/total = environment.total_moles
-
- var/list/environment_data = new
- data["has_environment"] = total
- if(total)
- var/pressure = environment.return_pressure()
- environment_data[++environment_data.len] = list("name" = "Pressure", "value" = pressure, "unit" = "kPa", "danger_level" = pressure_dangerlevel)
- environment_data[++environment_data.len] = list("name" = "Oxygen", "value" = environment.gas["oxygen"] / total * 100, "unit" = "%", "danger_level" = oxygen_dangerlevel)
- environment_data[++environment_data.len] = list("name" = "Carbon dioxide", "value" = environment.gas["carbon_dioxide"] / total * 100, "unit" = "%", "danger_level" = co2_dangerlevel)
- environment_data[++environment_data.len] = list("name" = "Toxins", "value" = environment.gas["phoron"] / total * 100, "unit" = "%", "danger_level" = phoron_dangerlevel)
- environment_data[++environment_data.len] = list("name" = "Temperature", "value" = environment.temperature, "unit" = "K ([round(environment.temperature - T0C, 0.1)]C)", "danger_level" = temperature_dangerlevel)
- data["total_danger"] = danger_level
- data["environment"] = environment_data
- data["atmos_alarm"] = alarm_area.atmosalm
- data["fire_alarm"] = alarm_area.fire != null
- data["target_temperature"] = "[target_temperature - T0C]C"
-
-/obj/machinery/alarm/proc/populate_controls(var/list/data)
- switch(screen)
- if(AALARM_SCREEN_MAIN)
- data["mode"] = mode
- if(AALARM_SCREEN_VENT)
- var/vents[0]
- for(var/id_tag in alarm_area.air_vent_names)
- var/long_name = alarm_area.air_vent_names[id_tag]
- var/list/info = alarm_area.air_vent_info[id_tag]
- if(!info)
- continue
- vents[++vents.len] = list(
- "id_tag" = id_tag,
- "long_name" = sanitize(long_name),
- "power" = info["power"],
- "checks" = info["checks"],
- "direction" = info["direction"],
- "external" = info["external"]
- )
- data["vents"] = vents
- if(AALARM_SCREEN_SCRUB)
- var/scrubbers[0]
- for(var/id_tag in alarm_area.air_scrub_names)
- var/long_name = alarm_area.air_scrub_names[id_tag]
- var/list/info = alarm_area.air_scrub_info[id_tag]
- if(!info)
- continue
- scrubbers[++scrubbers.len] = list(
- "id_tag" = id_tag,
- "long_name" = sanitize(long_name),
- "power" = info["power"],
- "scrubbing" = info["scrubbing"],
- "panic" = info["panic"],
- "filters" = list()
- )
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Oxygen", "command" = "o2_scrub", "val" = info["filter_o2"]))
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrogen", "command" = "n2_scrub", "val" = info["filter_n2"]))
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Carbon Dioxide", "command" = "co2_scrub","val" = info["filter_co2"]))
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Toxin" , "command" = "tox_scrub","val" = info["filter_phoron"]))
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrous Oxide", "command" = "n2o_scrub","val" = info["filter_n2o"]))
- scrubbers[scrubbers.len]["filters"] += list(list("name" = "Fuel", "command" = "fuel_scrub","val" = info["filter_fuel"]))
- data["scrubbers"] = scrubbers
- if(AALARM_SCREEN_MODE)
- var/modes[0]
- modes[++modes.len] = list("name" = "Filtering - Scrubs out contaminants", "mode" = AALARM_MODE_SCRUBBING, "selected" = mode == AALARM_MODE_SCRUBBING, "danger" = 0)
- modes[++modes.len] = list("name" = "Replace Air - Siphons out air while replacing", "mode" = AALARM_MODE_REPLACEMENT, "selected" = mode == AALARM_MODE_REPLACEMENT, "danger" = 0)
- modes[++modes.len] = list("name" = "Panic - Siphons air out of the room", "mode" = AALARM_MODE_PANIC, "selected" = mode == AALARM_MODE_PANIC, "danger" = 1)
- modes[++modes.len] = list("name" = "Cycle - Siphons air before replacing", "mode" = AALARM_MODE_CYCLE, "selected" = mode == AALARM_MODE_CYCLE, "danger" = 1)
- modes[++modes.len] = list("name" = "Fill - Shuts off scrubbers and opens vents", "mode" = AALARM_MODE_FILL, "selected" = mode == AALARM_MODE_FILL, "danger" = 0)
- modes[++modes.len] = list("name" = "Off - Shuts off vents and scrubbers", "mode" = AALARM_MODE_OFF, "selected" = mode == AALARM_MODE_OFF, "danger" = 0)
- data["modes"] = modes
- data["mode"] = mode
- if(AALARM_SCREEN_SENSORS)
- var/list/selected
- var/thresholds[0]
-
- var/list/gas_names = list(
- "oxygen" = "O2",
- "carbon dioxide" = "CO2",
- "phoron" = "Toxin",
- "other" = "Other")
- for(var/g in gas_names)
- thresholds[++thresholds.len] = list("name" = gas_names[g], "settings" = list())
- selected = TLV[g]
- for(var/i = 1, i <= 4, i++)
- thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = i, "selected" = selected[i]))
-
- selected = TLV["pressure"]
- thresholds[++thresholds.len] = list("name" = "Pressure", "settings" = list())
- for(var/i = 1, i <= 4, i++)
- thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = i, "selected" = selected[i]))
-
- selected = TLV["temperature"]
- thresholds[++thresholds.len] = list("name" = "Temperature", "settings" = list())
- for(var/i = 1, i <= 4, i++)
- thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = i, "selected" = selected[i]))
-
- data["thresholds"] = thresholds
-
-/obj/machinery/alarm/CanUseTopic(var/mob/user, var/datum/topic_state/state, var/href_list = list())
- if(aidisabled && isAI(user))
- to_chat(user, "AI control for \the [src] interface has been disabled.")
- return STATUS_CLOSE
-
- . = shorted ? STATUS_DISABLED : STATUS_INTERACTIVE
-
- if(. == STATUS_INTERACTIVE)
- var/extra_href = state.href_list(usr)
- // Prevent remote users from altering RCON settings unless they already have access
- if(href_list["rcon"] && extra_href["remote_connection"] && !extra_href["remote_access"])
- . = STATUS_UPDATE
-
- return min(..(), .)
-
-/obj/machinery/alarm/Topic(href, href_list, var/datum/topic_state/state)
- if(..(href, href_list, state))
- return 1
-
- // hrefs that can always be called -walter0o
- if(href_list["rcon"])
- var/attempted_rcon_setting = text2num(href_list["rcon"])
-
- switch(attempted_rcon_setting)
- if(RCON_NO)
- rcon_setting = RCON_NO
- if(RCON_AUTO)
- rcon_setting = RCON_AUTO
- if(RCON_YES)
- rcon_setting = RCON_YES
- return 1
-
- if(href_list["temperature"])
- var/list/selected = TLV["temperature"]
- var/max_temperature = min(selected[3] - T0C, MAX_TEMPERATURE)
- var/min_temperature = max(selected[2] - T0C, MIN_TEMPERATURE)
- var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature] and [max_temperature]C)", "Thermostat Controls", target_temperature - T0C) as num|null
- if(isnum(input_temperature))
- if(input_temperature > max_temperature || input_temperature < min_temperature)
- to_chat(usr, "Temperature must be between [min_temperature]C and [max_temperature]C")
- else
- target_temperature = input_temperature + T0C
- return 1
-
- // hrefs that need the AA unlocked -walter0o
- var/extra_href = state.href_list(usr)
- if(!(locked && !extra_href["remote_connection"]) || extra_href["remote_access"] || issilicon(usr))
- if(href_list["command"])
- var/device_id = href_list["id_tag"]
- switch(href_list["command"])
- if("set_external_pressure")
- var/input_pressure = input("What pressure you like the system to mantain?", "Pressure Controls") as num|null
- if(isnum(input_pressure))
- send_signal(device_id, list(href_list["command"] = input_pressure))
- return 1
-
- if("reset_external_pressure")
- send_signal(device_id, list(href_list["command"] = ONE_ATMOSPHERE))
- return 1
-
- if( "power",
- "adjust_external_pressure",
- "checks",
- "o2_scrub",
- "n2_scrub",
- "co2_scrub",
- "tox_scrub",
- "n2o_scrub",
- "fuel_scrub",
- "panic_siphon",
- "scrubbing",
- "direction")
-
- send_signal(device_id, list(href_list["command"] = text2num(href_list["val"])))
- return 1
-
- if("set_threshold")
- var/env = href_list["env"]
- var/threshold = text2num(href_list["var"])
- var/list/selected = TLV[env]
- var/list/thresholds = list("lower bound", "low warning", "high warning", "upper bound")
- var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null | num
- if(isnull(newval))
- return 1
- if(newval<0)
- selected[threshold] = -1.0
- else if(env=="temperature" && newval>5000)
- selected[threshold] = 5000
- else if(env=="pressure" && newval>50*ONE_ATMOSPHERE)
- selected[threshold] = 50*ONE_ATMOSPHERE
- else if(env!="temperature" && env!="pressure" && newval>200)
- selected[threshold] = 200
- else
- newval = round(newval,0.01)
- selected[threshold] = newval
- if(threshold == 1)
- if(selected[1] > selected[2])
- selected[2] = selected[1]
- if(selected[1] > selected[3])
- selected[3] = selected[1]
- if(selected[1] > selected[4])
- selected[4] = selected[1]
- if(threshold == 2)
- if(selected[1] > selected[2])
- selected[1] = selected[2]
- if(selected[2] > selected[3])
- selected[3] = selected[2]
- if(selected[2] > selected[4])
- selected[4] = selected[2]
- if(threshold == 3)
- if(selected[1] > selected[3])
- selected[1] = selected[3]
- if(selected[2] > selected[3])
- selected[2] = selected[3]
- if(selected[3] > selected[4])
- selected[4] = selected[3]
- if(threshold == 4)
- if(selected[1] > selected[4])
- selected[1] = selected[4]
- if(selected[2] > selected[4])
- selected[2] = selected[4]
- if(selected[3] > selected[4])
- selected[3] = selected[4]
-
- apply_mode()
- return 1
-
- if(href_list["screen"])
- screen = text2num(href_list["screen"])
- return 1
-
- if(href_list["atmos_unlock"])
- switch(href_list["atmos_unlock"])
- if("0")
- alarm_area.firedoors_close()
- if("1")
- alarm_area.firedoors_open()
- return 1
-
- if(href_list["atmos_alarm"])
- if(alarm_area.atmosalert(2, src))
- apply_danger_level(2)
- update_icon()
- return 1
-
- if(href_list["atmos_reset"])
- if(alarm_area.atmosalert(0, src))
- apply_danger_level(0)
- update_icon()
- return 1
-
- if(href_list["mode"])
- mode = text2num(href_list["mode"])
- apply_mode()
- return 1
-
-/obj/machinery/alarm/attackby(obj/item/W as obj, mob/user as mob)
- add_fingerprint(user)
- if(alarm_deconstruction_screwdriver(user, W))
- return
- if(alarm_deconstruction_wirecutters(user, W))
- return
-
- if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))// trying to unlock the interface with an ID card
- togglelock()
- return ..()
-
-/obj/machinery/alarm/verb/togglelock(mob/user as mob)
- if(stat & (NOPOWER|BROKEN))
- to_chat(user, "It does nothing.")
- return
- else
- if(allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
- locked = !locked
- to_chat(user, "You [locked ? "lock" : "unlock"] the Air Alarm interface.")
- else
- to_chat(user, "Access denied.")
- return
-
-/obj/machinery/alarm/AltClick()
- ..()
- togglelock()
-
-/obj/machinery/alarm/power_change()
- ..()
- spawn(rand(0,15))
- update_icon()
-
-/obj/machinery/alarm/examine(mob/user)
- ..(user)
-
-/*
-AIR ALARM CIRCUIT
-Just a object used in constructing air alarms
-/obj/item/weapon/airalarm_electronics
- name = "air alarm electronics"
- icon = 'icons/obj/doors/door_assembly.dmi'
- icon_state = "door_electronics"
- desc = "Looks like a circuit. Probably is."
- w_class = ITEMSIZE_SMALL
- matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50)
-*/
-/*
-FIRE ALARM
-*/
-/obj/machinery/firealarm
- name = "fire alarm"
- desc = "\"Pull this in case of emergency\". Thus, keep pulling it forever."
- icon = 'icons/obj/monitors.dmi'
- icon_state = "fire0"
- plane = TURF_PLANE
- layer = ABOVE_TURF_LAYER
- var/detecting = 1.0
- var/working = 1.0
- var/time = 10.0
- var/timing = 0.0
- var/lockdownbyai = 0
- anchored = 1.0
- use_power = USE_POWER_IDLE
- idle_power_usage = 2
- active_power_usage = 6
- power_channel = ENVIRON
- var/last_process = 0
- panel_open = 0
- var/seclevel
- circuit = /obj/item/weapon/circuitboard/firealarm
- var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles
-
-/obj/machinery/firealarm/alarms_hidden
- alarms_hidden = TRUE
-
-/obj/machinery/firealarm/update_icon()
- cut_overlays()
-
- if(panel_open)
- set_light(0)
- return
-
- if(stat & BROKEN)
- icon_state = "firex"
- set_light(0)
- else if(stat & NOPOWER)
- icon_state = "firep"
- set_light(0)
- else
- if(!detecting)
- icon_state = "fire1"
- set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000")
- else
- icon_state = "fire0"
- switch(seclevel)
- if("green") set_light(l_range = 2, l_power = 0.25, l_color = "#00ff00")
- if("yellow") set_light(l_range = 2, l_power = 0.25, l_color = "#ffff00")
- if("violet") set_light(l_range = 2, l_power = 0.25, l_color = "#9933ff")
- if("orange") set_light(l_range = 2, l_power = 0.25, l_color = "#ff9900")
- if("blue") set_light(l_range = 2, l_power = 0.25, l_color = "#1024A9")
- if("red") set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000")
- if("delta") set_light(l_range = 4, l_power = 0.9, l_color = "#FF6633")
- add_overlay("overlay_[seclevel]")
-
-/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume)
- if(detecting)
- if(temperature > T0C + 200)
- alarm() // added check of detector status here
- return
-
-/obj/machinery/firealarm/attack_ai(mob/user as mob)
- return attack_hand(user)
-
-/obj/machinery/firealarm/bullet_act()
- return alarm()
-
-/obj/machinery/firealarm/emp_act(severity)
- if(prob(50 / severity))
- alarm(rand(30 / severity, 60 / severity))
- ..()
-
-/obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob)
- add_fingerprint(user)
-
- if(alarm_deconstruction_screwdriver(user, W))
- return
- if(alarm_deconstruction_wirecutters(user, W))
- return
-
- if(panel_open)
- if(istype(W, /obj/item/device/multitool))
- detecting = !(detecting)
- if(detecting)
- user.visible_message("\The [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.")
- else
- user.visible_message("\The [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.")
- return
-
- alarm()
- return
-
-/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed
- if(stat & (NOPOWER|BROKEN))
- return
-
- if(timing)
- if(time > 0)
- time = time - ((world.timeofday - last_process) / 10)
- else
- alarm()
- time = 0
- timing = 0
- STOP_PROCESSING(SSobj, src)
- updateDialog()
- last_process = world.timeofday
-
- if(locate(/obj/fire) in src.loc)
- alarm()
-
- return
-
-/obj/machinery/firealarm/power_change()
- ..()
- spawn(rand(0,15))
- update_icon()
-
-/obj/machinery/firealarm/attack_hand(mob/user as mob)
- if(user.stat || stat & (NOPOWER | BROKEN))
- return
-
- user.set_machine(src)
- var/area/A = src.loc
- var/d1
- var/d2
- if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon))
- A = A.loc
-
- if(A.fire)
- d1 = text("Reset - Lockdown", src)
- else
- d1 = text("Alarm - Lockdown", src)
- if(timing)
- d2 = text("Stop Time Lock", src)
- else
- d2 = text("Initiate Time Lock", src)
- var/second = round(time) % 60
- var/minute = (round(time) - second) / 60
- var/dat = "
Fire alarm [d1]\n
The current alert level is: [get_security_level()]
\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n"
- user << browse(dat, "window=firealarm")
- onclose(user, "firealarm")
- else
- A = A.loc
- if(A.fire)
- d1 = text("[]", src, stars("Reset - Lockdown"))
- else
- d1 = text("[]", src, stars("Alarm - Lockdown"))
- if(timing)
- d2 = text("[]", src, stars("Stop Time Lock"))
- else
- d2 = text("[]", src, stars("Initiate Time Lock"))
- var/second = round(time) % 60
- var/minute = (round(time) - second) / 60
- var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]
\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n"
- user << browse(dat, "window=firealarm")
- onclose(user, "firealarm")
- return
-
-/obj/machinery/firealarm/Topic(href, href_list)
- ..()
- if(usr.stat || stat & (BROKEN | NOPOWER))
- return
-
- if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
- usr.set_machine(src)
- if(href_list["reset"])
- reset()
- else if(href_list["alarm"])
- alarm()
- else if(href_list["time"])
- timing = text2num(href_list["time"])
- last_process = world.timeofday
- START_PROCESSING(SSobj, src)
- else if(href_list["tp"])
- var/tp = text2num(href_list["tp"])
- time += tp
- time = min(max(round(time), 0), 120)
-
- updateUsrDialog()
-
- add_fingerprint(usr)
- else
- usr << browse(null, "window=firealarm")
- return
- return
-
-/obj/machinery/firealarm/proc/reset()
- if(!(working))
- return
- var/area/area = get_area(src)
- for(var/obj/machinery/firealarm/FA in area)
- fire_alarm.clearAlarm(src.loc, FA)
- update_icon()
- return
-
-/obj/machinery/firealarm/proc/alarm(var/duration = 0)
- if(!(working))
- return
- var/area/area = get_area(src)
- for(var/obj/machinery/firealarm/FA in area)
- fire_alarm.triggerAlarm(loc, FA, duration, hidden = alarms_hidden)
- update_icon()
- playsound(src.loc, 'sound/machines/airalarm.ogg', 25, 0, 4) //VOREStation Edit
- return
-
-/obj/machinery/firealarm/proc/set_security_level(var/newlevel)
- if(seclevel != newlevel)
- seclevel = newlevel
- update_icon()
-
-/obj/machinery/firealarm/Initialize()
- . = ..()
- if(z in using_map.contact_levels)
- set_security_level(security_level? get_security_level() : "green")
-
-/*
-FIRE ALARM CIRCUIT
-Just a object used in constructing fire alarms
-
-/obj/item/weapon/firealarm_electronics
- name = "fire alarm electronics"
- icon = 'icons/obj/doors/door_assembly.dmi'
- icon_state = "door_electronics"
- desc = "A circuit. It has a label on it, it says \"Can handle heat levels up to 40 degrees celsius!\""
- w_class = ITEMSIZE_SMALL
- matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50)
-*/
-/obj/machinery/partyalarm
- name = "\improper PARTY BUTTON"
- desc = "Cuban Pete is in the house!"
- icon = 'icons/obj/monitors.dmi'
- icon_state = "fire0"
- var/detecting = 1.0
- var/working = 1.0
- var/time = 10.0
- var/timing = 0.0
- var/lockdownbyai = 0
- anchored = 1.0
- use_power = USE_POWER_IDLE
- idle_power_usage = 2
- active_power_usage = 6
-
-/obj/machinery/partyalarm/attack_hand(mob/user as mob)
- if(user.stat || stat & (NOPOWER|BROKEN))
- return
-
- user.machine = src
- var/area/A = get_area(src)
- ASSERT(isarea(A))
- var/d1
- var/d2
- if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai))
-
- if(A.party)
- d1 = text("No Party :(", src)
- else
- d1 = text("PARTY!!!", src)
- if(timing)
- d2 = text("Stop Time Lock", src)
- else
- d2 = text("Initiate Time Lock", src)
- var/second = time % 60
- var/minute = (time - second) / 60
- var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src)
- user << browse(dat, "window=partyalarm")
- onclose(user, "partyalarm")
- else
- if(A.fire)
- d1 = text("[]", src, stars("No Party :("))
- else
- d1 = text("[]", src, stars("PARTY!!!"))
- if(timing)
- d2 = text("[]", src, stars("Stop Time Lock"))
- else
- d2 = text("[]", src, stars("Initiate Time Lock"))
- var/second = time % 60
- var/minute = (time - second) / 60
- var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src)
- user << browse(dat, "window=partyalarm")
- onclose(user, "partyalarm")
- return
-
-/obj/machinery/partyalarm/proc/reset()
- if(!(working))
- return
- var/area/A = get_area(src)
- ASSERT(isarea(A))
- A.partyreset()
- return
-
-/obj/machinery/partyalarm/proc/alarm()
- if(!(working))
- return
- var/area/A = get_area(src)
- ASSERT(isarea(A))
- A.partyalert()
- return
-
-/obj/machinery/partyalarm/Topic(href, href_list)
- ..()
- if(usr.stat || stat & (BROKEN|NOPOWER))
- return
- if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
- usr.machine = src
- if(href_list["reset"])
- reset()
- else if(href_list["alarm"])
- alarm()
- else if(href_list["time"])
- timing = text2num(href_list["time"])
- else if(href_list["tp"])
- var/tp = text2num(href_list["tp"])
- time += tp
- time = min(max(round(time), 0), 120)
- updateUsrDialog()
-
- add_fingerprint(usr)
- else
- usr << browse(null, "window=partyalarm")
- return
- return
-
+#define AALARM_MODE_SCRUBBING 1
+#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster.
+#define AALARM_MODE_PANIC 3 //constantly sucks all air
+#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and switches to scrubbing
+#define AALARM_MODE_FILL 5 //emergency fill
+#define AALARM_MODE_OFF 6 //Shuts it all down.
+
+#define AALARM_SCREEN_MAIN 1
+#define AALARM_SCREEN_VENT 2
+#define AALARM_SCREEN_SCRUB 3
+#define AALARM_SCREEN_MODE 4
+#define AALARM_SCREEN_SENSORS 5
+
+#define AALARM_REPORT_TIMEOUT 100
+
+#define MAX_TEMPERATURE 90
+#define MIN_TEMPERATURE -40
+
+//all air alarms in area are connected via magic
+/area
+ var/obj/machinery/alarm/master_air_alarm
+ var/list/air_vent_names = list()
+ var/list/air_scrub_names = list()
+ var/list/air_vent_info = list()
+ var/list/air_scrub_info = list()
+
+/obj/machinery/alarm
+ name = "alarm"
+ desc = "Used to control various station atmospheric systems. The light indicates the current air status of the area."
+ icon = 'icons/obj/monitors_vr.dmi' //VOREStation Edit - Other icons
+ icon_state = "alarm0"
+ plane = TURF_PLANE
+ layer = ABOVE_TURF_LAYER
+ anchored = 1
+ use_power = 1
+ idle_power_usage = 80
+ active_power_usage = 1000 //For heating/cooling rooms. 1000 joules equates to about 1 degree every 2 seconds for a single tile of air.
+ power_channel = ENVIRON
+ req_one_access = list(access_atmospherics, access_engine_equip)
+ clicksound = "button"
+ clickvol = 30
+ var/alarm_id = null
+ var/breach_detection = 1 // Whether to use automatic breach detection or not
+ var/frequency = 1439
+ //var/skipprocess = 0 //Experimenting
+ var/alarm_frequency = 1437
+ var/remote_control = 0
+ var/rcon_setting = 2
+ var/rcon_time = 0
+ var/locked = 1
+ panel_open = 0 // If it's been screwdrivered open.
+ var/aidisabled = 0
+ var/shorted = 0
+ circuit = /obj/item/weapon/circuitboard/airalarm
+
+ var/datum/wires/alarm/wires
+
+ var/mode = AALARM_MODE_SCRUBBING
+ var/screen = AALARM_SCREEN_MAIN
+ var/area_uid
+ var/area/alarm_area
+
+ var/target_temperature = T0C+20
+ var/regulating_temperature = 0
+
+ var/datum/radio_frequency/radio_connection
+
+ var/list/TLV = list()
+ var/list/trace_gas = list("sleeping_agent", "volatile_fuel") //list of other gases that this air alarm is able to detect
+
+ var/danger_level = 0
+ var/pressure_dangerlevel = 0
+ var/oxygen_dangerlevel = 0
+ var/co2_dangerlevel = 0
+ var/phoron_dangerlevel = 0
+ var/temperature_dangerlevel = 0
+ var/other_dangerlevel = 0
+
+ var/report_danger_level = 1
+
+ var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles
+
+/obj/machinery/alarm/nobreach
+ breach_detection = 0
+
+/obj/machinery/alarm/monitor
+ report_danger_level = 0
+ breach_detection = 0
+
+/obj/machinery/alarm/alarms_hidden
+ alarms_hidden = TRUE
+
+/obj/machinery/alarm/server/Initialize(mapload)
+ . = ..()
+ req_access = list(access_rd, access_atmospherics, access_engine_equip)
+ TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa
+ TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
+ TLV["phoron"] = list(-1.0, -1.0, 0, 0.5) // Partial pressure, kpa
+ TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
+ TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
+ TLV["temperature"] = list(20, 40, 140, 160) // K
+ target_temperature = 90
+
+/obj/machinery/alarm/Initialize(mapload)
+ . = ..()
+ first_run()
+
+/obj/machinery/alarm/Destroy()
+ unregister_radio(src, frequency)
+ qdel(wires)
+ wires = null
+ if(alarm_area && alarm_area.master_air_alarm == src)
+ alarm_area.master_air_alarm = null
+ elect_master(exclude_self = TRUE)
+ return ..()
+
+/obj/machinery/alarm/proc/first_run()
+ alarm_area = get_area(src)
+ area_uid = alarm_area.uid
+ if(name == "alarm")
+ name = "[alarm_area.name] Air Alarm"
+
+ if(!wires)
+ wires = new(src)
+
+ // breathable air according to human/Life()
+ TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
+ TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
+ TLV["phoron"] = list(-1.0, -1.0, 0, 0.5) // Partial pressure, kpa
+ TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
+ TLV["pressure"] = list(ONE_ATMOSPHERE * 0.80, ONE_ATMOSPHERE * 0.90, ONE_ATMOSPHERE * 1.10, ONE_ATMOSPHERE * 1.20) /* kpa */
+ TLV["temperature"] = list(T0C - 26, T0C, T0C + 40, T0C + 66) // K
+
+
+/obj/machinery/alarm/Initialize()
+ . = ..()
+ set_frequency(frequency)
+ if(!master_is_operating())
+ elect_master()
+
+/obj/machinery/alarm/process()
+ if((stat & (NOPOWER|BROKEN)) || shorted)
+ return
+
+ var/turf/simulated/location = src.loc
+ if(!istype(location)) return//returns if loc is not simulated
+
+ var/datum/gas_mixture/environment = location.return_air()
+
+ //Handle temperature adjustment here.
+ handle_heating_cooling(environment)
+
+ var/old_level = danger_level
+ var/old_pressurelevel = pressure_dangerlevel
+ danger_level = overall_danger_level(environment)
+
+ if(old_level != danger_level)
+ apply_danger_level(danger_level)
+
+ if(old_pressurelevel != pressure_dangerlevel)
+ if(breach_detected())
+ mode = AALARM_MODE_OFF
+ apply_mode()
+
+ if(mode == AALARM_MODE_CYCLE && environment.return_pressure() < ONE_ATMOSPHERE * 0.05)
+ mode = AALARM_MODE_FILL
+ apply_mode()
+
+ //atmos computer remote controll stuff
+ switch(rcon_setting)
+ if(RCON_NO)
+ remote_control = 0
+ if(RCON_AUTO)
+ if(danger_level == 2)
+ remote_control = 1
+ else
+ remote_control = 0
+ if(RCON_YES)
+ remote_control = 1
+
+ return
+
+/obj/machinery/alarm/proc/handle_heating_cooling(var/datum/gas_mixture/environment)
+ if(!regulating_temperature)
+ //check for when we should start adjusting temperature
+ if(!get_danger_level(target_temperature, TLV["temperature"]) && abs(environment.temperature - target_temperature) > 2.0)
+ update_use_power(2)
+ regulating_temperature = 1
+ audible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
+ "You hear a click and a faint electronic hum.")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ else
+ //check for when we should stop adjusting temperature
+ if(get_danger_level(target_temperature, TLV["temperature"]) || abs(environment.temperature - target_temperature) <= 0.5)
+ update_use_power(1)
+ regulating_temperature = 0
+ audible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
+ "You hear a click as a faint electronic humming stops.")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+
+ if(regulating_temperature)
+ if(target_temperature > T0C + MAX_TEMPERATURE)
+ target_temperature = T0C + MAX_TEMPERATURE
+
+ if(target_temperature < T0C + MIN_TEMPERATURE)
+ target_temperature = T0C + MIN_TEMPERATURE
+
+ var/datum/gas_mixture/gas
+ gas = environment.remove(0.25 * environment.total_moles)
+ if(gas)
+
+ if(gas.temperature <= target_temperature) //gas heating
+ var/energy_used = min(gas.get_thermal_energy_change(target_temperature) , active_power_usage)
+
+ gas.add_thermal_energy(energy_used)
+ //use_power(energy_used, ENVIRON) //handle by update_use_power instead
+ else //gas cooling
+ var/heat_transfer = min(abs(gas.get_thermal_energy_change(target_temperature)), active_power_usage)
+
+ //Assume the heat is being pumped into the hull which is fixed at 20 C
+ //none of this is really proper thermodynamics but whatever
+
+ var/cop = gas.temperature / T20C //coefficient of performance -> power used = heat_transfer/cop
+
+ heat_transfer = min(heat_transfer, cop * active_power_usage) //this ensures that we don't use more than active_power_usage amount of power
+
+ heat_transfer = -gas.add_thermal_energy(-heat_transfer) //get the actual heat transfer
+
+ //use_power(heat_transfer / cop, ENVIRON) //handle by update_use_power instead
+
+ environment.merge(gas)
+
+/obj/machinery/alarm/proc/overall_danger_level(var/datum/gas_mixture/environment)
+ var/partial_pressure = R_IDEAL_GAS_EQUATION * environment.temperature/environment.volume
+ var/environment_pressure = environment.return_pressure()
+
+ var/other_moles = 0
+ for(var/g in trace_gas)
+ other_moles += environment.gas[g] //this is only going to be used in a partial pressure calc, so we don't need to worry about group_multiplier here.
+
+ pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
+ oxygen_dangerlevel = get_danger_level(environment.gas["oxygen"]*partial_pressure, TLV["oxygen"])
+ co2_dangerlevel = get_danger_level(environment.gas["carbon_dioxide"]*partial_pressure, TLV["carbon dioxide"])
+ phoron_dangerlevel = get_danger_level(environment.gas["phoron"]*partial_pressure, TLV["phoron"])
+ temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
+ other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
+
+ return max(
+ pressure_dangerlevel,
+ oxygen_dangerlevel,
+ co2_dangerlevel,
+ phoron_dangerlevel,
+ other_dangerlevel,
+ temperature_dangerlevel
+ )
+
+// Returns whether this air alarm thinks there is a breach, given the sensors that are available to it.
+/obj/machinery/alarm/proc/breach_detected()
+ var/turf/simulated/location = src.loc
+
+ if(!istype(location))
+ return 0
+
+ if(breach_detection == 0)
+ return 0
+
+ var/datum/gas_mixture/environment = location.return_air()
+ var/environment_pressure = environment.return_pressure()
+ var/pressure_levels = TLV["pressure"]
+
+ if(environment_pressure <= pressure_levels[1]) //low pressures
+ if(!(mode == AALARM_MODE_PANIC || mode == AALARM_MODE_CYCLE))
+ playsound(src.loc, 'sound/machines/airalarm.ogg', 25, 0, 4)
+ return 1
+
+ return 0
+
+/obj/machinery/alarm/proc/master_is_operating()
+ return alarm_area && alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER | BROKEN))
+
+/obj/machinery/alarm/proc/elect_master(exclude_self = FALSE)
+ for(var/obj/machinery/alarm/AA in alarm_area)
+ if(exclude_self && AA == src)
+ continue
+ if(!(AA.stat & (NOPOWER|BROKEN)))
+ alarm_area.master_air_alarm = AA
+ return 1
+ return 0
+
+/obj/machinery/alarm/proc/get_danger_level(var/current_value, var/list/danger_levels)
+ if((current_value >= danger_levels[4] && danger_levels[4] > 0) || current_value <= danger_levels[1])
+ return 2
+ if((current_value >= danger_levels[3] && danger_levels[3] > 0) || current_value <= danger_levels[2])
+ return 1
+ return 0
+
+/obj/machinery/alarm/update_icon()
+ if(panel_open)
+ icon_state = "alarmx"
+ set_light(0)
+ return
+ if((stat & (NOPOWER|BROKEN)) || shorted)
+ icon_state = "alarmp"
+ set_light(0)
+ return
+
+ var/icon_level = danger_level
+ if(alarm_area?.atmosalm)
+ icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow
+
+ var/new_color = null
+ switch(icon_level)
+ if(0)
+ icon_state = "alarm0"
+ new_color = "#03A728"
+ if(1)
+ icon_state = "alarm2" //yes, alarm2 is yellow alarm
+ new_color = "#EC8B2F"
+ if(2)
+ icon_state = "alarm1"
+ new_color = "#DA0205"
+
+ set_light(l_range = 2, l_power = 0.25, l_color = new_color)
+
+/obj/machinery/alarm/receive_signal(datum/signal/signal)
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if(alarm_area.master_air_alarm != src)
+ if(master_is_operating())
+ return
+ elect_master()
+ if(alarm_area.master_air_alarm != src)
+ return
+ if(!signal || signal.encryption)
+ return
+ var/id_tag = signal.data["tag"]
+ if(!id_tag)
+ return
+ if(signal.data["area"] != area_uid)
+ return
+ if(signal.data["sigtype"] != "status")
+ return
+
+ var/dev_type = signal.data["device"]
+ if(!(id_tag in alarm_area.air_scrub_names) && !(id_tag in alarm_area.air_vent_names))
+ register_env_machine(id_tag, dev_type)
+ if(dev_type == "AScr")
+ alarm_area.air_scrub_info[id_tag] = signal.data
+ else if(dev_type == "AVP")
+ alarm_area.air_vent_info[id_tag] = signal.data
+
+/obj/machinery/alarm/proc/register_env_machine(var/m_id, var/device_type)
+ var/new_name
+ if(device_type == "AVP")
+ new_name = "[alarm_area.name] Vent Pump #[alarm_area.air_vent_names.len+1]"
+ alarm_area.air_vent_names[m_id] = new_name
+ else if(device_type == "AScr")
+ new_name = "[alarm_area.name] Air Scrubber #[alarm_area.air_scrub_names.len+1]"
+ alarm_area.air_scrub_names[m_id] = new_name
+ else
+ return
+ spawn(10)
+ send_signal(m_id, list("init" = new_name))
+
+/obj/machinery/alarm/proc/refresh_all()
+ for(var/id_tag in alarm_area.air_vent_names)
+ var/list/I = alarm_area.air_vent_info[id_tag]
+ if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time)
+ continue
+ send_signal(id_tag, list("status"))
+ for(var/id_tag in alarm_area.air_scrub_names)
+ var/list/I = alarm_area.air_scrub_info[id_tag]
+ if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time)
+ continue
+ send_signal(id_tag, list("status"))
+
+/obj/machinery/alarm/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ radio_connection = radio_controller.add_object(src, frequency, RADIO_TO_AIRALARM)
+
+/obj/machinery/alarm/proc/send_signal(var/target, var/list/command)//sends signal 'command' to 'target'. Returns 0 if no radio connection, 1 otherwise
+ if(!radio_connection)
+ return 0
+
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+
+ signal.data = command
+ signal.data["tag"] = target
+ signal.data["sigtype"] = "command"
+
+ radio_connection.post_signal(src, signal, RADIO_FROM_AIRALARM)
+// to_world("Signal [command] Broadcasted to [target]")
+
+ return 1
+
+/obj/machinery/alarm/proc/apply_mode()
+ //propagate mode to other air alarms in the area
+ //TODO: make it so that players can choose between applying the new mode to the room they are in (related area) vs the entire alarm area
+ for(var/obj/machinery/alarm/AA in alarm_area)
+ AA.mode = mode
+
+ switch(mode)
+ if(AALARM_MODE_SCRUBBING)
+ for(var/device_id in alarm_area.air_scrub_names)
+ send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "scrubbing"= 1, "panic_siphon"= 0))
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
+
+ if(AALARM_MODE_PANIC, AALARM_MODE_CYCLE)
+ for(var/device_id in alarm_area.air_scrub_names)
+ send_signal(device_id, list("power"= 1, "panic_siphon"= 1))
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 0))
+
+ if(AALARM_MODE_REPLACEMENT)
+ for(var/device_id in alarm_area.air_scrub_names)
+ send_signal(device_id, list("power"= 1, "panic_siphon"= 1))
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
+
+ if(AALARM_MODE_FILL)
+ for(var/device_id in alarm_area.air_scrub_names)
+ send_signal(device_id, list("power"= 0))
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default"))
+
+ if(AALARM_MODE_OFF)
+ for(var/device_id in alarm_area.air_scrub_names)
+ send_signal(device_id, list("power"= 0))
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 0))
+
+/obj/machinery/alarm/proc/apply_danger_level(var/new_danger_level)
+ if(report_danger_level && alarm_area.atmosalert(new_danger_level, src))
+ post_alert(new_danger_level)
+
+ update_icon()
+
+/obj/machinery/alarm/proc/post_alert(alert_level)
+ var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency)
+ if(!frequency)
+ return
+
+ var/datum/signal/alert_signal = new
+ alert_signal.source = src
+ alert_signal.transmission_method = 1
+ alert_signal.data["zone"] = alarm_area.name
+ alert_signal.data["type"] = "Atmospheric"
+
+ if(alert_level==2)
+ alert_signal.data["alert"] = "severe"
+ else if(alert_level==1)
+ alert_signal.data["alert"] = "minor"
+ else if(alert_level==0)
+ alert_signal.data["alert"] = "clear"
+
+ frequency.post_signal(src, alert_signal)
+
+/obj/machinery/alarm/attack_ai(mob/user)
+ ui_interact(user)
+
+/obj/machinery/alarm/attack_hand(mob/user)
+ . = ..()
+ if(.)
+ return
+ return interact(user)
+
+/obj/machinery/alarm/interact(mob/user)
+ ui_interact(user)
+ wires.Interact(user)
+
+/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = default_state)
+ var/data[0]
+ var/remote_connection = 0
+ var/remote_access = 0
+ if(state)
+ var/list/href = state.href_list(user)
+ remote_connection = href["remote_connection"] // Remote connection means we're non-adjacent/connecting from another computer
+ remote_access = href["remote_access"] // Remote access means we also have the privilege to alter the air alarm.
+
+ data["locked"] = locked && !issilicon(user)
+ data["remote_connection"] = remote_connection
+ data["remote_access"] = remote_access
+ data["rcon"] = rcon_setting
+ data["screen"] = screen
+
+ populate_status(data)
+
+ if(!(locked && !remote_connection) || remote_access || issilicon(user))
+ populate_controls(data)
+
+ ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
+ if(!ui)
+ ui = new(user, src, ui_key, "air_alarm.tmpl", name, 325, 625, master_ui = master_ui, state = state)
+ ui.set_initial_data(data)
+ ui.open()
+ ui.set_auto_update(1)
+
+/obj/machinery/alarm/proc/populate_status(var/data)
+ var/turf/location = get_turf(src)
+ var/datum/gas_mixture/environment = location.return_air()
+ var/total = environment.total_moles
+
+ var/list/environment_data = new
+ data["has_environment"] = total
+ if(total)
+ var/pressure = environment.return_pressure()
+ environment_data[++environment_data.len] = list("name" = "Pressure", "value" = pressure, "unit" = "kPa", "danger_level" = pressure_dangerlevel)
+ environment_data[++environment_data.len] = list("name" = "Oxygen", "value" = environment.gas["oxygen"] / total * 100, "unit" = "%", "danger_level" = oxygen_dangerlevel)
+ environment_data[++environment_data.len] = list("name" = "Carbon dioxide", "value" = environment.gas["carbon_dioxide"] / total * 100, "unit" = "%", "danger_level" = co2_dangerlevel)
+ environment_data[++environment_data.len] = list("name" = "Toxins", "value" = environment.gas["phoron"] / total * 100, "unit" = "%", "danger_level" = phoron_dangerlevel)
+ environment_data[++environment_data.len] = list("name" = "Temperature", "value" = environment.temperature, "unit" = "K ([round(environment.temperature - T0C, 0.1)]C)", "danger_level" = temperature_dangerlevel)
+ data["total_danger"] = danger_level
+ data["environment"] = environment_data
+ data["atmos_alarm"] = alarm_area.atmosalm
+ data["fire_alarm"] = alarm_area.fire != null
+ data["target_temperature"] = "[target_temperature - T0C]C"
+
+/obj/machinery/alarm/proc/populate_controls(var/list/data)
+ switch(screen)
+ if(AALARM_SCREEN_MAIN)
+ data["mode"] = mode
+ if(AALARM_SCREEN_VENT)
+ var/vents[0]
+ for(var/id_tag in alarm_area.air_vent_names)
+ var/long_name = alarm_area.air_vent_names[id_tag]
+ var/list/info = alarm_area.air_vent_info[id_tag]
+ if(!info)
+ continue
+ vents[++vents.len] = list(
+ "id_tag" = id_tag,
+ "long_name" = sanitize(long_name),
+ "power" = info["power"],
+ "checks" = info["checks"],
+ "direction" = info["direction"],
+ "external" = info["external"]
+ )
+ data["vents"] = vents
+ if(AALARM_SCREEN_SCRUB)
+ var/scrubbers[0]
+ for(var/id_tag in alarm_area.air_scrub_names)
+ var/long_name = alarm_area.air_scrub_names[id_tag]
+ var/list/info = alarm_area.air_scrub_info[id_tag]
+ if(!info)
+ continue
+ scrubbers[++scrubbers.len] = list(
+ "id_tag" = id_tag,
+ "long_name" = sanitize(long_name),
+ "power" = info["power"],
+ "scrubbing" = info["scrubbing"],
+ "panic" = info["panic"],
+ "filters" = list()
+ )
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Oxygen", "command" = "o2_scrub", "val" = info["filter_o2"]))
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrogen", "command" = "n2_scrub", "val" = info["filter_n2"]))
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Carbon Dioxide", "command" = "co2_scrub","val" = info["filter_co2"]))
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Toxin" , "command" = "tox_scrub","val" = info["filter_phoron"]))
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrous Oxide", "command" = "n2o_scrub","val" = info["filter_n2o"]))
+ scrubbers[scrubbers.len]["filters"] += list(list("name" = "Fuel", "command" = "fuel_scrub","val" = info["filter_fuel"]))
+ data["scrubbers"] = scrubbers
+ if(AALARM_SCREEN_MODE)
+ var/modes[0]
+ modes[++modes.len] = list("name" = "Filtering - Scrubs out contaminants", "mode" = AALARM_MODE_SCRUBBING, "selected" = mode == AALARM_MODE_SCRUBBING, "danger" = 0)
+ modes[++modes.len] = list("name" = "Replace Air - Siphons out air while replacing", "mode" = AALARM_MODE_REPLACEMENT, "selected" = mode == AALARM_MODE_REPLACEMENT, "danger" = 0)
+ modes[++modes.len] = list("name" = "Panic - Siphons air out of the room", "mode" = AALARM_MODE_PANIC, "selected" = mode == AALARM_MODE_PANIC, "danger" = 1)
+ modes[++modes.len] = list("name" = "Cycle - Siphons air before replacing", "mode" = AALARM_MODE_CYCLE, "selected" = mode == AALARM_MODE_CYCLE, "danger" = 1)
+ modes[++modes.len] = list("name" = "Fill - Shuts off scrubbers and opens vents", "mode" = AALARM_MODE_FILL, "selected" = mode == AALARM_MODE_FILL, "danger" = 0)
+ modes[++modes.len] = list("name" = "Off - Shuts off vents and scrubbers", "mode" = AALARM_MODE_OFF, "selected" = mode == AALARM_MODE_OFF, "danger" = 0)
+ data["modes"] = modes
+ data["mode"] = mode
+ if(AALARM_SCREEN_SENSORS)
+ var/list/selected
+ var/thresholds[0]
+
+ var/list/gas_names = list(
+ "oxygen" = "O2",
+ "carbon dioxide" = "CO2",
+ "phoron" = "Toxin",
+ "other" = "Other")
+ for(var/g in gas_names)
+ thresholds[++thresholds.len] = list("name" = gas_names[g], "settings" = list())
+ selected = TLV[g]
+ for(var/i = 1, i <= 4, i++)
+ thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = i, "selected" = selected[i]))
+
+ selected = TLV["pressure"]
+ thresholds[++thresholds.len] = list("name" = "Pressure", "settings" = list())
+ for(var/i = 1, i <= 4, i++)
+ thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = i, "selected" = selected[i]))
+
+ selected = TLV["temperature"]
+ thresholds[++thresholds.len] = list("name" = "Temperature", "settings" = list())
+ for(var/i = 1, i <= 4, i++)
+ thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = i, "selected" = selected[i]))
+
+ data["thresholds"] = thresholds
+
+/obj/machinery/alarm/CanUseTopic(var/mob/user, var/datum/topic_state/state, var/href_list = list())
+ if(aidisabled && isAI(user))
+ to_chat(user, "AI control for \the [src] interface has been disabled.")
+ return STATUS_CLOSE
+
+ . = shorted ? STATUS_DISABLED : STATUS_INTERACTIVE
+
+ if(. == STATUS_INTERACTIVE)
+ var/extra_href = state.href_list(usr)
+ // Prevent remote users from altering RCON settings unless they already have access
+ if(href_list["rcon"] && extra_href["remote_connection"] && !extra_href["remote_access"])
+ . = STATUS_UPDATE
+
+ return min(..(), .)
+
+/obj/machinery/alarm/Topic(href, href_list, var/datum/topic_state/state)
+ if(..(href, href_list, state))
+ return 1
+
+ // hrefs that can always be called -walter0o
+ if(href_list["rcon"])
+ var/attempted_rcon_setting = text2num(href_list["rcon"])
+
+ switch(attempted_rcon_setting)
+ if(RCON_NO)
+ rcon_setting = RCON_NO
+ if(RCON_AUTO)
+ rcon_setting = RCON_AUTO
+ if(RCON_YES)
+ rcon_setting = RCON_YES
+ return 1
+
+ if(href_list["temperature"])
+ var/list/selected = TLV["temperature"]
+ var/max_temperature = min(selected[3] - T0C, MAX_TEMPERATURE)
+ var/min_temperature = max(selected[2] - T0C, MIN_TEMPERATURE)
+ var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature] and [max_temperature]C)", "Thermostat Controls", target_temperature - T0C) as num|null
+ if(isnum(input_temperature))
+ if(input_temperature > max_temperature || input_temperature < min_temperature)
+ to_chat(usr, "Temperature must be between [min_temperature]C and [max_temperature]C")
+ else
+ target_temperature = input_temperature + T0C
+ return 1
+
+ // hrefs that need the AA unlocked -walter0o
+ var/extra_href = state.href_list(usr)
+ if(!(locked && !extra_href["remote_connection"]) || extra_href["remote_access"] || issilicon(usr))
+ if(href_list["command"])
+ var/device_id = href_list["id_tag"]
+ switch(href_list["command"])
+ if("set_external_pressure")
+ var/input_pressure = input("What pressure you like the system to mantain?", "Pressure Controls") as num|null
+ if(isnum(input_pressure))
+ send_signal(device_id, list(href_list["command"] = input_pressure))
+ return 1
+
+ if("reset_external_pressure")
+ send_signal(device_id, list(href_list["command"] = ONE_ATMOSPHERE))
+ return 1
+
+ if( "power",
+ "adjust_external_pressure",
+ "checks",
+ "o2_scrub",
+ "n2_scrub",
+ "co2_scrub",
+ "tox_scrub",
+ "n2o_scrub",
+ "fuel_scrub",
+ "panic_siphon",
+ "scrubbing",
+ "direction")
+
+ send_signal(device_id, list(href_list["command"] = text2num(href_list["val"])))
+ return 1
+
+ if("set_threshold")
+ var/env = href_list["env"]
+ var/threshold = text2num(href_list["var"])
+ var/list/selected = TLV[env]
+ var/list/thresholds = list("lower bound", "low warning", "high warning", "upper bound")
+ var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null | num
+ if(isnull(newval))
+ return 1
+ if(newval<0)
+ selected[threshold] = -1.0
+ else if(env=="temperature" && newval>5000)
+ selected[threshold] = 5000
+ else if(env=="pressure" && newval>50*ONE_ATMOSPHERE)
+ selected[threshold] = 50*ONE_ATMOSPHERE
+ else if(env!="temperature" && env!="pressure" && newval>200)
+ selected[threshold] = 200
+ else
+ newval = round(newval,0.01)
+ selected[threshold] = newval
+ if(threshold == 1)
+ if(selected[1] > selected[2])
+ selected[2] = selected[1]
+ if(selected[1] > selected[3])
+ selected[3] = selected[1]
+ if(selected[1] > selected[4])
+ selected[4] = selected[1]
+ if(threshold == 2)
+ if(selected[1] > selected[2])
+ selected[1] = selected[2]
+ if(selected[2] > selected[3])
+ selected[3] = selected[2]
+ if(selected[2] > selected[4])
+ selected[4] = selected[2]
+ if(threshold == 3)
+ if(selected[1] > selected[3])
+ selected[1] = selected[3]
+ if(selected[2] > selected[3])
+ selected[2] = selected[3]
+ if(selected[3] > selected[4])
+ selected[4] = selected[3]
+ if(threshold == 4)
+ if(selected[1] > selected[4])
+ selected[1] = selected[4]
+ if(selected[2] > selected[4])
+ selected[2] = selected[4]
+ if(selected[3] > selected[4])
+ selected[3] = selected[4]
+
+ apply_mode()
+ return 1
+
+ if(href_list["screen"])
+ screen = text2num(href_list["screen"])
+ return 1
+
+ if(href_list["atmos_unlock"])
+ switch(href_list["atmos_unlock"])
+ if("0")
+ alarm_area.firedoors_close()
+ if("1")
+ alarm_area.firedoors_open()
+ return 1
+
+ if(href_list["atmos_alarm"])
+ if(alarm_area.atmosalert(2, src))
+ apply_danger_level(2)
+ update_icon()
+ return 1
+
+ if(href_list["atmos_reset"])
+ if(alarm_area.atmosalert(0, src))
+ apply_danger_level(0)
+ update_icon()
+ return 1
+
+ if(href_list["mode"])
+ mode = text2num(href_list["mode"])
+ apply_mode()
+ return 1
+
+/obj/machinery/alarm/attackby(obj/item/W as obj, mob/user as mob)
+ add_fingerprint(user)
+ if(alarm_deconstruction_screwdriver(user, W))
+ return
+ if(alarm_deconstruction_wirecutters(user, W))
+ return
+
+ if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))// trying to unlock the interface with an ID card
+ togglelock()
+ return ..()
+
+/obj/machinery/alarm/verb/togglelock(mob/user as mob)
+ if(stat & (NOPOWER|BROKEN))
+ to_chat(user, "It does nothing.")
+ return
+ else
+ if(allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
+ locked = !locked
+ to_chat(user, "You [locked ? "lock" : "unlock"] the Air Alarm interface.")
+ else
+ to_chat(user, "Access denied.")
+ return
+
+/obj/machinery/alarm/AltClick()
+ ..()
+ togglelock()
+
+/obj/machinery/alarm/power_change()
+ ..()
+ spawn(rand(0,15))
+ update_icon()
diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm
index ef74905a502..e462e0eed6e 100644
--- a/code/game/machinery/atmoalter/canister.dm
+++ b/code/game/machinery/atmoalter/canister.dm
@@ -18,7 +18,7 @@
pressure_resistance = 7 * ONE_ATMOSPHERE
var/temperature_resistance = 1000 + T0C
volume = 1000
- use_power = USE_POWER_OFF
+ use_power = 0
interact_offline = 1 // Allows this to be used when not in powered area.
var/release_log = ""
var/update_flag = 0
diff --git a/code/game/machinery/atmoalter/meter.dm b/code/game/machinery/atmoalter/meter.dm
index 13d782f18f5..e1fe956e63d 100644
--- a/code/game/machinery/atmoalter/meter.dm
+++ b/code/game/machinery/atmoalter/meter.dm
@@ -9,7 +9,7 @@
power_channel = ENVIRON
var/frequency = 0
var/id
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 15
/obj/machinery/meter/Initialize()
diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm
index 180dde355d9..085c070f7d8 100644
--- a/code/game/machinery/atmoalter/portable_atmospherics.dm
+++ b/code/game/machinery/atmoalter/portable_atmospherics.dm
@@ -1,6 +1,6 @@
/obj/machinery/portable_atmospherics
name = "atmoalter"
- use_power = USE_POWER_OFF
+ use_power = 0
layer = OBJ_LAYER // These are mobile, best not be under everything.
var/datum/gas_mixture/air_contents = new
diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm
index dd81a926162..34f4bf9bc3e 100644
--- a/code/game/machinery/atmoalter/scrubber.dm
+++ b/code/game/machinery/atmoalter/scrubber.dm
@@ -152,10 +152,10 @@
volume = 500000
volume_rate = 7000
- use_power = USE_POWER_IDLE
- idle_power_usage = 50 //VOREStation Edit //internal circuitry, friction losses and stuff
- active_power_usage = 1000 //VOREStation Edit // Blowers running
- power_rating = 100000 //VOREStation Add //100 kW ~ 135 HP
+ use_power = 1
+ idle_power_usage = 50 //internal circuitry, friction losses and stuff
+ active_power_usage = 1000 // Blowers running
+ power_rating = 100000 //100 kW ~ 135 HP
var/global/gid = 1
var/id = 0
diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index 653d3bb3749..42e04481868 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -5,7 +5,7 @@
icon_state = "autolathe"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 2000
clicksound = "keyboard"
@@ -247,7 +247,7 @@
return
busy = 1
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
//Check if we still have the materials.
var/coeff = (making.no_scale ? 1 : mat_efficiency) //stacks are unaffected by production coefficient
@@ -266,7 +266,7 @@
sleep(build_time)
busy = 0
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
update_icon() // So lid opens
//Sanity check.
diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm
index 5cce3a63531..d886a0faf15 100644
--- a/code/game/machinery/biogenerator.dm
+++ b/code/game/machinery/biogenerator.dm
@@ -6,7 +6,7 @@
density = 1
anchored = 1
circuit = /obj/item/weapon/circuitboard/biogenerator
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 40
var/processing = 0
var/obj/item/weapon/reagent_containers/glass/beaker = null
diff --git a/code/game/machinery/bioprinter.dm b/code/game/machinery/bioprinter.dm
index f7e4749fe33..60143fadd36 100644
--- a/code/game/machinery/bioprinter.dm
+++ b/code/game/machinery/bioprinter.dm
@@ -9,7 +9,7 @@
anchored = 1
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 40
active_power_usage = 300
@@ -161,7 +161,7 @@
container.reagents.remove_reagent("biomass", possible_list[choice][2])
- use_power = USE_POWER_ACTIVE
+ use_power = 2
printing = 1
update_icon()
@@ -169,7 +169,7 @@
sleep(print_delay)
- use_power = USE_POWER_IDLE
+ use_power = 1
printing = 0
update_icon()
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index 786761b3b1a..cec980c54e8 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -8,7 +8,7 @@
var/id = null
var/active = 0
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index f20c05d6279..73ec15c32a9 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -3,7 +3,7 @@
desc = "It's used to monitor rooms."
icon = 'icons/obj/monitors_vr.dmi' //VOREStation Edit - New Icons
icon_state = "camera"
- use_power = USE_POWER_ACTIVE
+ use_power = 2
idle_power_usage = 5
active_power_usage = 10
plane = MOB_PLANE
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index 636bcca6c0f..0ceae52046c 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -4,7 +4,7 @@
icon = 'icons/obj/power.dmi'
icon_state = "ccharger0"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
active_power_usage = 60000 //60 kW. (this the power drawn when charging)
var/efficiency = 60000 //will provide the modified power rate when upgraded
@@ -118,16 +118,16 @@
/obj/machinery/cell_charger/process()
//to_world("ccpt [charging] [stat]")
if((stat & (BROKEN|NOPOWER)) || !anchored)
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
return
if(charging && !charging.fully_charged())
charging.give(efficiency*CELLRATE)
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
update_icon()
else
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
/obj/machinery/cell_charger/RefreshParts()
var/E = 0
diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm
index 57d6d01c6e2..856634f03f3 100644
--- a/code/game/machinery/computer/camera.dm
+++ b/code/game/machinery/computer/camera.dm
@@ -170,7 +170,7 @@
src.current_camera = C
if(current_camera)
current_camera.camera_computers_using_this.Add(src)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
var/mob/living/L = current_camera.loc
if(istype(L))
L.tracking_initiated()
@@ -182,7 +182,7 @@
if(istype(L))
L.tracking_cancelled()
current_camera = null
- use_power = USE_POWER_IDLE
+ use_power = 1
//Camera control: mouse.
/atom/DblClick()
diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm
index c6c44160b5b..40a75517390 100644
--- a/code/game/machinery/computer/computer.dm
+++ b/code/game/machinery/computer/computer.dm
@@ -4,7 +4,7 @@
icon_state = "computer"
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 300
active_power_usage = 300
var/processing = 0
diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm
index 9342e0b5e91..0c6c33928a6 100644
--- a/code/game/machinery/computer/crew.dm
+++ b/code/game/machinery/computer/crew.dm
@@ -4,7 +4,7 @@
icon_keyboard = "med_key"
icon_screen = "crew"
light_color = "#315ab4"
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 250
active_power_usage = 500
circuit = /obj/item/weapon/circuitboard/crew
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index aa9c230e226..e74ffb7cf94 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -7,7 +7,7 @@
icon_state = "box_0"
density = 1
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/obj/item/weapon/circuitboard/circuit = null
var/list/components = null
var/list/req_components = null
diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm
index 9db22b92702..22cbf06b3dd 100644
--- a/code/game/machinery/cryo.dm
+++ b/code/game/machinery/cryo.dm
@@ -11,7 +11,7 @@
interact_offline = 1
var/on = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 20
active_power_usage = 200
buckle_lying = FALSE
@@ -291,7 +291,7 @@
unbuckle_mob(occupant, force = TRUE)
occupant = null
current_heat_capacity = initial(current_heat_capacity)
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
return
/obj/machinery/atmospherics/unary/cryo_cell/proc/put_mob(mob/living/carbon/M as mob)
if(stat & (NOPOWER|BROKEN))
@@ -322,7 +322,7 @@
vis_contents |= occupant
occupant.pixel_y += 19
current_heat_capacity = HEAT_CAPACITY_HUMAN
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
// M.metabslow = 1
add_fingerprint(usr)
update_icon()
diff --git a/code/game/machinery/door_control.dm b/code/game/machinery/door_control.dm
index f3f4489d782..290ff6745ef 100644
--- a/code/game/machinery/door_control.dm
+++ b/code/game/machinery/door_control.dm
@@ -14,7 +14,7 @@
*/
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index 4ad97c9066c..d5043af6efd 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -38,7 +38,7 @@
var/hatch_open = 0
power_channel = ENVIRON
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
var/list/tile_info[4]
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 1396b5f5549..a1e05d5e1e9 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -9,7 +9,7 @@
maxhealth = 150 //If you change this, consiter changing ../door/window/brigdoor/ health at the bottom of this .dm file
health = 150
visible = 0.0
- use_power = USE_POWER_OFF
+ use_power = 0
flags = ON_BORDER
opacity = 0
var/obj/item/weapon/airlock_electronics/electronics = null
diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm
index 714d27d5609..67d8dc4a7fd 100644
--- a/code/game/machinery/embedded_controller/embedded_controller_base.dm
+++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm
@@ -1,7 +1,7 @@
/obj/machinery/embedded_controller
name = "Embedded Controller"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
var/datum/computer/file/embedded_program/program //the currently executing program
var/on = 1
diff --git a/code/game/machinery/fire_alarm.dm b/code/game/machinery/fire_alarm.dm
new file mode 100644
index 00000000000..a9b4a0705e6
--- /dev/null
+++ b/code/game/machinery/fire_alarm.dm
@@ -0,0 +1,324 @@
+/*
+FIRE ALARM
+*/
+/obj/machinery/firealarm
+ name = "fire alarm"
+ desc = "\"Pull this in case of emergency\". Thus, keep pulling it forever."
+ icon = 'icons/obj/monitors.dmi'
+ icon_state = "fire0"
+ plane = TURF_PLANE
+ layer = ABOVE_TURF_LAYER
+ var/detecting = 1.0
+ var/working = 1.0
+ var/time = 10.0
+ var/timing = 0.0
+ var/lockdownbyai = 0
+ anchored = 1.0
+ use_power = 1
+ idle_power_usage = 2
+ active_power_usage = 6
+ power_channel = ENVIRON
+ var/last_process = 0
+ panel_open = 0
+ var/seclevel
+ circuit = /obj/item/weapon/circuitboard/firealarm
+ var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles
+
+/obj/machinery/firealarm/alarms_hidden
+ alarms_hidden = TRUE
+
+/obj/machinery/firealarm/Initialize()
+ . = ..()
+ if(z in using_map.contact_levels)
+ set_security_level(security_level ? get_security_level() : "green")
+
+/obj/machinery/firealarm/update_icon()
+ cut_overlays()
+
+ if(panel_open)
+ set_light(0)
+ return
+
+ if(stat & BROKEN)
+ icon_state = "firex"
+ set_light(0)
+ else if(stat & NOPOWER)
+ icon_state = "firep"
+ set_light(0)
+ else
+ if(!detecting)
+ icon_state = "fire1"
+ set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000")
+ else
+ icon_state = "fire0"
+ switch(seclevel)
+ if("green") set_light(l_range = 2, l_power = 0.25, l_color = "#00ff00")
+ if("yellow") set_light(l_range = 2, l_power = 0.25, l_color = "#ffff00")
+ if("violet") set_light(l_range = 2, l_power = 0.25, l_color = "#9933ff")
+ if("orange") set_light(l_range = 2, l_power = 0.25, l_color = "#ff9900")
+ if("blue") set_light(l_range = 2, l_power = 0.25, l_color = "#1024A9")
+ if("red") set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000")
+ if("delta") set_light(l_range = 4, l_power = 0.9, l_color = "#FF6633")
+ add_overlay("overlay_[seclevel]")
+
+/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume)
+ if(detecting)
+ if(temperature > T0C + 200)
+ alarm() // added check of detector status here
+ return
+
+/obj/machinery/firealarm/attack_ai(mob/user as mob)
+ return attack_hand(user)
+
+/obj/machinery/firealarm/bullet_act()
+ return alarm()
+
+/obj/machinery/firealarm/emp_act(severity)
+ if(prob(50 / severity))
+ alarm(rand(30 / severity, 60 / severity))
+ ..()
+
+/obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob)
+ add_fingerprint(user)
+
+ if(alarm_deconstruction_screwdriver(user, W))
+ return
+ if(alarm_deconstruction_wirecutters(user, W))
+ return
+
+ if(panel_open)
+ if(istype(W, /obj/item/device/multitool))
+ detecting = !(detecting)
+ if(detecting)
+ user.visible_message("\The [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.")
+ else
+ user.visible_message("\The [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.")
+ return
+
+ alarm()
+ return
+
+/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed
+ if(stat & (NOPOWER|BROKEN))
+ return
+
+ if(timing)
+ if(time > 0)
+ time = time - ((world.timeofday - last_process) / 10)
+ else
+ alarm()
+ time = 0
+ timing = 0
+ STOP_PROCESSING(SSobj, src)
+ updateDialog()
+ last_process = world.timeofday
+
+ if(locate(/obj/fire) in src.loc)
+ alarm()
+
+ return
+
+/obj/machinery/firealarm/power_change()
+ ..()
+ spawn(rand(0,15))
+ update_icon()
+
+/obj/machinery/firealarm/attack_hand(mob/user as mob)
+ if(user.stat || stat & (NOPOWER | BROKEN))
+ return
+
+ user.set_machine(src)
+ var/area/A = src.loc
+ var/d1
+ var/d2
+ if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon))
+ A = A.loc
+
+ if(A.fire)
+ d1 = text("Reset - Lockdown", src)
+ else
+ d1 = text("Alarm - Lockdown", src)
+ if(timing)
+ d2 = text("Stop Time Lock", src)
+ else
+ d2 = text("Initiate Time Lock", src)
+ var/second = round(time) % 60
+ var/minute = (round(time) - second) / 60
+ var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]
\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n"
+ user << browse(dat, "window=firealarm")
+ onclose(user, "firealarm")
+ else
+ A = A.loc
+ if(A.fire)
+ d1 = text("[]", src, stars("Reset - Lockdown"))
+ else
+ d1 = text("[]", src, stars("Alarm - Lockdown"))
+ if(timing)
+ d2 = text("[]", src, stars("Stop Time Lock"))
+ else
+ d2 = text("[]", src, stars("Initiate Time Lock"))
+ var/second = round(time) % 60
+ var/minute = (round(time) - second) / 60
+ var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]
\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n"
+ user << browse(dat, "window=firealarm")
+ onclose(user, "firealarm")
+ return
+
+/obj/machinery/firealarm/Topic(href, href_list)
+ ..()
+ if(usr.stat || stat & (BROKEN | NOPOWER))
+ return
+
+ if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
+ usr.set_machine(src)
+ if(href_list["reset"])
+ reset()
+ else if(href_list["alarm"])
+ alarm()
+ else if(href_list["time"])
+ timing = text2num(href_list["time"])
+ last_process = world.timeofday
+ START_PROCESSING(SSobj, src)
+ else if(href_list["tp"])
+ var/tp = text2num(href_list["tp"])
+ time += tp
+ time = min(max(round(time), 0), 120)
+
+ updateUsrDialog()
+
+ add_fingerprint(usr)
+ else
+ usr << browse(null, "window=firealarm")
+ return
+ return
+
+/obj/machinery/firealarm/proc/reset()
+ if(!(working))
+ return
+ var/area/area = get_area(src)
+ for(var/obj/machinery/firealarm/FA in area)
+ fire_alarm.clearAlarm(src.loc, FA)
+ update_icon()
+ return
+
+/obj/machinery/firealarm/proc/alarm(var/duration = 0)
+ if(!(working))
+ return
+ var/area/area = get_area(src)
+ for(var/obj/machinery/firealarm/FA in area)
+ fire_alarm.triggerAlarm(loc, FA, duration, hidden = alarms_hidden)
+ update_icon()
+ playsound(src.loc, 'sound/machines/airalarm.ogg', 25, 0, 4)
+ return
+
+/obj/machinery/firealarm/proc/set_security_level(var/newlevel)
+ if(seclevel != newlevel)
+ seclevel = newlevel
+ update_icon()
+
+/*
+FIRE ALARM CIRCUIT
+Just a object used in constructing fire alarms
+
+/obj/item/weapon/firealarm_electronics
+ name = "fire alarm electronics"
+ icon = 'icons/obj/doors/door_assembly.dmi'
+ icon_state = "door_electronics"
+ desc = "A circuit. It has a label on it, it says \"Can handle heat levels up to 40 degrees celsius!\""
+ w_class = ITEMSIZE_SMALL
+ matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50)
+*/
+/obj/machinery/partyalarm
+ name = "\improper PARTY BUTTON"
+ desc = "Cuban Pete is in the house!"
+ icon = 'icons/obj/monitors.dmi'
+ icon_state = "fire0"
+ var/detecting = 1.0
+ var/working = 1.0
+ var/time = 10.0
+ var/timing = 0.0
+ var/lockdownbyai = 0
+ anchored = 1.0
+ use_power = 1
+ idle_power_usage = 2
+ active_power_usage = 6
+
+/obj/machinery/partyalarm/attack_hand(mob/user as mob)
+ if(user.stat || stat & (NOPOWER|BROKEN))
+ return
+
+ user.machine = src
+ var/area/A = get_area(src)
+ ASSERT(isarea(A))
+ var/d1
+ var/d2
+ if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai))
+
+ if(A.party)
+ d1 = text("No Party :(", src)
+ else
+ d1 = text("PARTY!!!", src)
+ if(timing)
+ d2 = text("Stop Time Lock", src)
+ else
+ d2 = text("Initiate Time Lock", src)
+ var/second = time % 60
+ var/minute = (time - second) / 60
+ var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src)
+ user << browse(dat, "window=partyalarm")
+ onclose(user, "partyalarm")
+ else
+ if(A.fire)
+ d1 = text("[]", src, stars("No Party :("))
+ else
+ d1 = text("[]", src, stars("PARTY!!!"))
+ if(timing)
+ d2 = text("[]", src, stars("Stop Time Lock"))
+ else
+ d2 = text("[]", src, stars("Initiate Time Lock"))
+ var/second = time % 60
+ var/minute = (time - second) / 60
+ var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src)
+ user << browse(dat, "window=partyalarm")
+ onclose(user, "partyalarm")
+ return
+
+/obj/machinery/partyalarm/proc/reset()
+ if(!(working))
+ return
+ var/area/A = get_area(src)
+ ASSERT(isarea(A))
+ A.partyreset()
+ return
+
+/obj/machinery/partyalarm/proc/alarm()
+ if(!(working))
+ return
+ var/area/A = get_area(src)
+ ASSERT(isarea(A))
+ A.partyalert()
+ return
+
+/obj/machinery/partyalarm/Topic(href, href_list)
+ ..()
+ if(usr.stat || stat & (BROKEN|NOPOWER))
+ return
+ if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
+ usr.machine = src
+ if(href_list["reset"])
+ reset()
+ else if(href_list["alarm"])
+ alarm()
+ else if(href_list["time"])
+ timing = text2num(href_list["time"])
+ else if(href_list["tp"])
+ var/tp = text2num(href_list["tp"])
+ time += tp
+ time = min(max(round(time), 0), 120)
+ updateUsrDialog()
+
+ add_fingerprint(usr)
+ else
+ usr << browse(null, "window=partyalarm")
+ return
+ return
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index 572977ceb43..169bc8c6d7c 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -11,7 +11,7 @@
var/strength = 10 //How weakened targets are when flashed.
var/base_state = "mflash"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
flags = PROXMOVE
diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm
index 11f5fc26fdd..59dca1966ec 100644
--- a/code/game/machinery/floor_light.dm
+++ b/code/game/machinery/floor_light.dm
@@ -7,7 +7,7 @@ var/list/floor_light_cache = list()
desc = "A backlit floor panel."
layer = TURF_LAYER+0.001
anchored = 0
- use_power = USE_POWER_ACTIVE
+ use_power = 2
idle_power_usage = 2
active_power_usage = 20
power_channel = LIGHT
@@ -72,7 +72,7 @@ var/list/floor_light_cache = list()
return
on = !on
- if(on) update_use_power(USE_POWER_ACTIVE)
+ if(on) use_power = 2
//visible_message("\The [user] turns \the [src] [on ? "on" : "off"].") //VOREStation Edit - No thankouuuu. Too spammy.
update_brightness()
return
@@ -81,21 +81,21 @@ var/list/floor_light_cache = list()
..()
var/need_update
if((!anchored || broken()) && on)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
on = 0
need_update = 1
else if(use_power && !on)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
need_update = 1
if(need_update)
update_brightness()
/obj/machinery/floor_light/proc/update_brightness()
- if(on && use_power == USE_POWER_ACTIVE)
+ if(on && use_power == 2)
if(light_range != default_light_range || light_power != default_light_power || light_color != default_light_colour)
set_light(default_light_range, default_light_power, default_light_colour)
else
- update_use_power(USE_POWER_OFF)
+ use_power = 0
if(light_range || light_power)
set_light(0)
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 4fec2cba827..1d7308f56ea 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -39,7 +39,7 @@ var/const/HOLOPAD_MODE = RANGE_BASED
layer = ABOVE_TURF_LAYER
var/power_per_hologram = 500 //per usage per hologram
idle_power_usage = 5
- use_power = USE_POWER_IDLE
+ use_power = 1
var/list/mob/living/silicon/ai/masters = new() //List of AIs that use the holopad
var/last_request = 0 //to prevent request spam. ~Carn
var/holo_range = 5 // Change to change how far the AI can move away from the holopad before deactivating.
@@ -196,7 +196,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
/obj/machinery/hologram
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
active_power_usage = 100
diff --git a/code/game/machinery/holosign.dm b/code/game/machinery/holosign.dm
index 7a3cd8c861e..9a656ac3bed 100644
--- a/code/game/machinery/holosign.dm
+++ b/code/game/machinery/holosign.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/holosign.dmi'
icon_state = "sign_off"
plane = MOB_PLANE
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
anchored = 1
@@ -19,7 +19,7 @@
if(stat & (BROKEN|NOPOWER))
return
lit = !lit
- update_use_power(lit ? USE_POWER_ACTIVE : USE_POWER_IDLE)
+ use_power = lit ? 2 : 1
update_icon()
/obj/machinery/holosign/update_icon()
@@ -34,7 +34,7 @@
..()
if(stat & NOPOWER)
lit = 0
- update_use_power(USE_POWER_OFF)
+ use_power = 0
update_icon()
diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm
index ee887db2f5e..5cb521d4230 100755
--- a/code/game/machinery/igniter.dm
+++ b/code/game/machinery/igniter.dm
@@ -6,7 +6,7 @@
var/id = null
var/on = 1.0
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
@@ -53,7 +53,7 @@
var/last_spark = 0
var/base_state = "migniter"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm
index a0ef0503fde..8bd43417140 100644
--- a/code/game/machinery/jukebox.dm
+++ b/code/game/machinery/jukebox.dm
@@ -17,7 +17,7 @@
anchored = 1
density = 1
power_channel = EQUIP
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 100
circuit = /obj/item/weapon/circuitboard/jukebox
@@ -321,7 +321,7 @@
/obj/machinery/media/jukebox/proc/StopPlaying()
playing = 0
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
update_icon()
start_stop_song()
@@ -329,7 +329,7 @@
if(!current_track)
return
playing = 1
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
update_icon()
start_stop_song()
updateDialog()
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index ccfd1a3730d..2a1a7f6e898 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -7,7 +7,7 @@
icon = 'icons/obj/power_vr.dmi' // VOREStation Edit
icon_state = "light1"
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
power_channel = LIGHT
var/on = 1
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index ecbf2fa911c..d7f4b8f581d 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -101,7 +101,7 @@ Class Procs:
var/stat = 0
var/emagged = 0
- var/use_power = USE_POWER_IDLE
+ var/use_power = 1
//0 = dont run the auto
//1 = run auto, use idle
//2 = run auto, use active
@@ -199,9 +199,9 @@ Class Procs:
/obj/machinery/proc/auto_use_power()
if(!powered(power_channel))
return 0
- if(use_power == USE_POWER_IDLE)
+ if(use_power == 1)
use_power(idle_power_usage, power_channel, 1)
- else if(use_power >= USE_POWER_ACTIVE)
+ else if(use_power >= 2)
use_power(active_power_usage, power_channel, 1)
return 1
diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm
index 9d36b082021..9f97ab0360d 100644
--- a/code/game/machinery/magnet.dm
+++ b/code/game/machinery/magnet.dm
@@ -11,7 +11,7 @@
desc = "A device that uses station power to create points of magnetic energy."
plane = PLATING_PLANE
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 50
var/freq = 1449 // radio frequency
@@ -142,10 +142,10 @@
// Update power usage:
if(on)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
active_power_usage = electricity_level*15
else
- update_use_power(USE_POWER_OFF)
+ use_power = 0
// Overload conditions:
/* // Eeeehhh kinda stupid
@@ -190,7 +190,7 @@
icon_state = "airlock_control_standby"
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 45
var/frequency = 1449
var/code = 0
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index 7c184c27de4..1d13a36c3a0 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -6,7 +6,7 @@
icon = 'icons/obj/stationobjs.dmi'
icon_state = "mass_driver"
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 50
circuit = /obj/item/weapon/circuitboard/mass_driver
diff --git a/code/game/machinery/neonsign.dm b/code/game/machinery/neonsign.dm
index bdaa3b62fde..fe5d5370a86 100644
--- a/code/game/machinery/neonsign.dm
+++ b/code/game/machinery/neonsign.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/neonsigns.dmi'
icon_state = "sign_off"
plane = MOB_PLANE
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 4
anchored = 1
@@ -19,7 +19,7 @@
if(stat & (BROKEN|NOPOWER))
return
lit = !lit
- update_use_power(lit ? USE_POWER_ACTIVE : USE_POWER_IDLE)
+ use_power = lit ? 2 : 1
update_icon()
/obj/machinery/neonsign/update_icon()
@@ -34,7 +34,7 @@
..()
if(stat & NOPOWER)
lit = 0
- update_use_power(USE_POWER_OFF)
+ use_power = 0
update_icon()
diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm
index 8d6a55b3fd0..f32e57b9b12 100644
--- a/code/game/machinery/nuclear_bomb.dm
+++ b/code/game/machinery/nuclear_bomb.dm
@@ -23,7 +23,7 @@ var/bomb_set
var/timing_wire
var/removal_stage = 0 // 0 is no removal, 1 is covers removed, 2 is covers open,
// 3 is sealant open, 4 is unwrenched, 5 is removed from bolts.
- use_power = USE_POWER_OFF
+ use_power = 0
/obj/machinery/nuclearbomb/New()
..()
diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm
index 10c96a6b6a7..7f2b310ed60 100644
--- a/code/game/machinery/oxygen_pump.dm
+++ b/code/game/machinery/oxygen_pump.dm
@@ -73,7 +73,7 @@
if(breather.internals)
breather.internals.icon_state = "internal0"
breather = null
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
/obj/machinery/oxygen_pump/attack_ai(mob/user as mob)
ui_interact(user)
@@ -90,7 +90,7 @@
breather.internal = tank
if(breather.internals)
breather.internals.icon_state = "internal1"
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
/obj/machinery/oxygen_pump/proc/can_apply_to_target(var/mob/living/carbon/human/target, mob/user as mob)
if(!user)
@@ -162,7 +162,7 @@
contained.forceMove(src)
src.visible_message("\The [contained] rapidly retracts back into \the [src]!")
breather = null
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
else if(!breather.internal && tank)
breather.internal = tank
if(breather.internals)
@@ -287,7 +287,7 @@
contained.forceMove(src)
src.visible_message("\The [contained] rapidly retracts back into \the [src]!")
breather = null
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
else if(!breather.internal && tank)
breather.internal = tank
if(breather.internals)
diff --git a/code/game/machinery/pda_multicaster.dm b/code/game/machinery/pda_multicaster.dm
index aab6a31dedc..3388de0c313 100644
--- a/code/game/machinery/pda_multicaster.dm
+++ b/code/game/machinery/pda_multicaster.dm
@@ -6,7 +6,7 @@
density = 1
anchored = 1
circuit = /obj/item/weapon/circuitboard/telecomms/pda_multicaster
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 750
var/on = 1 // If we're currently active,
var/toggle = 1 // If we /should/ be active or not,
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index 0d8e9603b6b..dd400904934 100644
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/stationobjs_vr.dmi' //VOREStation Edit
icon_state = "recharger0"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 4
active_power_usage = 40000 //40 kW
var/efficiency = 40000 //will provide the modified power rate when upgraded
@@ -117,12 +117,12 @@
/obj/machinery/recharger/process()
if(stat & (NOPOWER|BROKEN) || !anchored)
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
icon_state = icon_state_idle
return
if(!charging)
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
icon_state = icon_state_idle
else
var/obj/item/weapon/cell/C = charging.get_cell()
@@ -130,10 +130,10 @@
if(!C.fully_charged())
icon_state = icon_state_charging
C.give(CELLRATE*efficiency)
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
else
icon_state = icon_state_charged
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
//VOREStation Add - NSFW Batteries
else if(istype(charging, /obj/item/ammo_casing/microbattery))
diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm
index 3f60e0ae070..f702f3cf254 100644
--- a/code/game/machinery/rechargestation.dm
+++ b/code/game/machinery/rechargestation.dm
@@ -6,7 +6,7 @@
density = 1
anchored = 1
circuit = /obj/item/weapon/circuitboard/recharge_station
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 50
var/mob/occupant = null
var/obj/item/weapon/cell/cell = null
@@ -78,9 +78,9 @@
if(!has_cell_power())
return 0
- if(use_power == USE_POWER_IDLE)
+ if(use_power == 1)
cell.use(idle_power_usage * CELLRATE)
- else if(use_power >= USE_POWER_ACTIVE)
+ else if(use_power >= 2)
cell.use(active_power_usage * CELLRATE)
return 1
diff --git a/code/game/machinery/robot_fabricator.dm b/code/game/machinery/robot_fabricator.dm
index 5bbb4ac6be0..7c5f8cafa02 100644
--- a/code/game/machinery/robot_fabricator.dm
+++ b/code/game/machinery/robot_fabricator.dm
@@ -7,7 +7,7 @@
var/metal_amount = 0
var/operating = 0
var/obj/item/robot_parts/being_built = null
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 40
active_power_usage = 10000
@@ -115,7 +115,7 @@ Please wait until completion...
if(!isnull(building))
if(metal_amount >= build_cost)
operating = 1
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
metal_amount = max(0, metal_amount - build_cost)
@@ -128,7 +128,7 @@ Please wait until completion...
if(!isnull(being_built))
being_built.loc = get_turf(src)
being_built = null
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
operating = 0
overlays -= "fab-active"
return
diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm
index 33d6fc14be3..2c2d385ac8e 100644
--- a/code/game/machinery/status_display.dm
+++ b/code/game/machinery/status_display.dm
@@ -17,7 +17,7 @@
name = "status display"
anchored = 1
density = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
circuit = /obj/item/weapon/circuitboard/status_display
var/mode = 1 // 0 = Blank
diff --git a/code/game/machinery/supplybeacon.dm b/code/game/machinery/supplybeacon.dm
index df40ba1a7df..9f228be5d47 100644
--- a/code/game/machinery/supplybeacon.dm
+++ b/code/game/machinery/supplybeacon.dm
@@ -58,7 +58,7 @@
/obj/machinery/power/supply_beacon/attack_hand(var/mob/user)
if(expended)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
to_chat (user, "\The [src] has used up its charge.")
return
@@ -80,7 +80,7 @@
return
set_light(3, 3, "#00CCAA")
icon_state = "beacon_active"
- use_power = USE_POWER_IDLE
+ use_power = 1
if(user) to_chat(user, "You activate the beacon. The supply drop will be dispatched soon.")
/obj/machinery/power/supply_beacon/proc/deactivate(var/mob/user, var/permanent)
@@ -90,7 +90,7 @@
else
icon_state = "beacon"
set_light(0)
- use_power = USE_POWER_OFF
+ use_power = 0
target_drop_time = null
if(user) to_chat(user, "You deactivate the beacon.")
diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm
index 057a8fd5c16..ed3a4ba4d44 100644
--- a/code/game/machinery/telecomms/broadcaster.dm
+++ b/code/game/machinery/telecomms/broadcaster.dm
@@ -17,7 +17,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
desc = "A dish-shaped machine used to broadcast processed subspace signals."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 25
machinetype = 5
produces_heat = 0
@@ -127,7 +127,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
desc = "A compact machine used for portable subspace telecommuniations processing."
density = 1
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 0
machinetype = 6
produces_heat = 0
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index c2e9126fc15..4ba184a102c 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -251,7 +251,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "This machine has a dish-like shape and green lights. It is designed to detect and process subspace radio activity."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 600
machinetype = 1
produces_heat = 0
@@ -318,7 +318,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "A mighty piece of hardware used to send/receive massive amounts of data."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 1600
machinetype = 7
circuit = /obj/item/weapon/circuitboard/telecomms/hub
@@ -377,7 +377,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "A mighty piece of hardware used to send massive amounts of data far away."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 600
machinetype = 8
produces_heat = 0
@@ -443,7 +443,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "A mighty piece of hardware used to send massive amounts of data quickly."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 1000
machinetype = 2
circuit = /obj/item/weapon/circuitboard/telecomms/bus
@@ -504,7 +504,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "This machine is used to process large quantities of information."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 600
machinetype = 3
delay = 5
@@ -556,7 +556,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
desc = "A machine used to store data and network statistics."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 300
machinetype = 4
circuit = /obj/item/weapon/circuitboard/telecomms/server
diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm
index bfc8e308a3e..e698e000ea5 100644
--- a/code/game/machinery/teleporter.dm
+++ b/code/game/machinery/teleporter.dm
@@ -171,7 +171,7 @@
icon_state = "tele0"
dir = 4
var/accurate = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 2000
circuit = /obj/item/weapon/circuitboard/teleporter_hub
@@ -327,7 +327,7 @@
dir = 4
var/active = 0
var/engaged = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 2000
circuit = /obj/item/weapon/circuitboard/teleporter_station
@@ -364,8 +364,8 @@
if(com)
com.icon_state = "tele1"
use_power(5000)
- update_use_power(USE_POWER_ACTIVE)
- com.update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
+ com.update_use_power(2)
for(var/mob/O in hearers(src, null))
O.show_message("Teleporter engaged!", 2)
add_fingerprint(usr)
@@ -379,8 +379,8 @@
if(com)
com.icon_state = "tele0"
com.accurate = 0
- com.update_use_power(USE_POWER_IDLE)
- update_use_power(USE_POWER_IDLE)
+ com.update_use_power(1)
+ update_use_power(1)
for(var/mob/O in hearers(src, null))
O.show_message("Teleporter disengaged!", 2)
add_fingerprint(usr)
diff --git a/code/game/machinery/transportpod.dm b/code/game/machinery/transportpod.dm
index 0b499096fea..96401c09082 100644
--- a/code/game/machinery/transportpod.dm
+++ b/code/game/machinery/transportpod.dm
@@ -6,7 +6,7 @@
density = 1 //thicc
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/in_transit = 0
var/mob/occupant = null
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 29888758f54..3672c2d524c 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -14,7 +14,7 @@
var/icon_deny //Icon_state when denying access
// Power
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
var/vend_power_usage = 150 //actuators and stuff
diff --git a/code/game/machinery/virtual_reality/ar_console.dm b/code/game/machinery/virtual_reality/ar_console.dm
index f4c6049487e..1f4c8c16fe8 100644
--- a/code/game/machinery/virtual_reality/ar_console.dm
+++ b/code/game/machinery/virtual_reality/ar_console.dm
@@ -73,7 +73,7 @@
if(A in component_parts)
continue
A.loc = src.loc
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
update_icon()
/obj/machinery/vr_sleeper/alien/enter_vr()
diff --git a/code/game/machinery/virtual_reality/vr_console.dm b/code/game/machinery/virtual_reality/vr_console.dm
index 8a417a98bcb..dcd6e555b94 100644
--- a/code/game/machinery/virtual_reality/vr_console.dm
+++ b/code/game/machinery/virtual_reality/vr_console.dm
@@ -18,7 +18,7 @@
var/mirror_first_occupant = TRUE // Do we force the newly produced body to look like the occupant?
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 15
active_power_usage = 200
light_color = "#FF0000"
@@ -174,7 +174,7 @@
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.loc = src
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
occupant = M
update_icon()
@@ -203,7 +203,7 @@
if(A in component_parts)
continue
A.loc = src.loc
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
update_icon()
/obj/machinery/vr_sleeper/proc/enter_vr()
diff --git a/code/game/machinery/wishgranter.dm b/code/game/machinery/wishgranter.dm
index 81c720bacdb..a3911a2efab 100644
--- a/code/game/machinery/wishgranter.dm
+++ b/code/game/machinery/wishgranter.dm
@@ -3,7 +3,7 @@
desc = "You're not so sure about this, anymore..."
icon = 'icons/obj/device.dmi'
icon_state = "syndbeacon"
- use_power = USE_POWER_OFF
+ use_power = 0
anchored = 1
density = 1
var/charges = 1
diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm
index a881cdb7200..f2a28672208 100644
--- a/code/game/mecha/mech_fabricator.dm
+++ b/code/game/mecha/mech_fabricator.dm
@@ -5,7 +5,7 @@
desc = "A machine used for construction of mechas."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 20
active_power_usage = 5000
req_access = list(access_robotics)
@@ -48,11 +48,11 @@
if(stat)
return
if(busy)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
progress += speed
check_build()
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
update_icon()
/obj/machinery/mecha_part_fabricator/update_icon()
diff --git a/code/game/mecha/mech_prosthetics.dm b/code/game/mecha/mech_prosthetics.dm
index 5e93378a0c0..81baddd719e 100644
--- a/code/game/mecha/mech_prosthetics.dm
+++ b/code/game/mecha/mech_prosthetics.dm
@@ -5,7 +5,7 @@
desc = "A machine used for construction of prosthetics."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 20
active_power_usage = 5000
req_access = list(access_robotics)
@@ -52,11 +52,11 @@
if(stat)
return
if(busy)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
progress += speed
check_build()
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
update_icon()
/obj/machinery/pros_fabricator/update_icon()
diff --git a/code/game/mecha/mech_sensor.dm b/code/game/mecha/mech_sensor.dm
index 33147e0ab11..72202788b9f 100644
--- a/code/game/mecha/mech_sensor.dm
+++ b/code/game/mecha/mech_sensor.dm
@@ -6,7 +6,7 @@
anchored = 1
density = 1
throwpass = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
layer = ON_WINDOW_LAYER
power_channel = EQUIP
var/on = 0
diff --git a/code/game/objects/structures/holoplant.dm b/code/game/objects/structures/holoplant.dm
index 9a46b8ca15d..bbd92b81ee7 100644
--- a/code/game/objects/structures/holoplant.dm
+++ b/code/game/objects/structures/holoplant.dm
@@ -48,13 +48,13 @@
plant = prepare_icon(emagged ? "emagged" : null)
overlays += plant
set_light(2)
- use_power = USE_POWER_ACTIVE
+ use_power = 2
/obj/machinery/holoplant/proc/deactivate()
overlays -= plant
QDEL_NULL(plant)
set_light(0)
- use_power = USE_POWER_OFF
+ use_power = 0
/obj/machinery/holoplant/power_change()
..()
diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm
index 467579a225c..4b4d0e90cc0 100644
--- a/code/game/objects/structures/watercloset.dm
+++ b/code/game/objects/structures/watercloset.dm
@@ -124,7 +124,7 @@
icon_state = "shower"
density = 0
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/on = 0
var/obj/effect/mist/mymist = null
var/ismist = 0 //needs a var so we can make it linger~
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 1bbb72fd990..1092ce48bbc 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -539,7 +539,7 @@
Pump.air2.gas["nitrogen"] = 3750 //The contents of 2 canisters.
Pump.air2.temperature = 50
Pump.air2.update_values()
- Pump.update_use_power(USE_POWER_IDLE)
+ Pump.use_power=1
Pump.target_pressure = 4500
Pump.update_icon()
diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm
index 987d395992d..71746a9a9e6 100644
--- a/code/modules/awaymissions/gateway.dm
+++ b/code/modules/awaymissions/gateway.dm
@@ -26,7 +26,7 @@
/obj/machinery/gateway/centerstation
density = 1
icon_state = "offcenter"
- use_power = USE_POWER_IDLE
+ use_power = 1
//warping vars
var/list/linked = list()
@@ -165,7 +165,7 @@ obj/machinery/gateway/centerstation/process()
/obj/machinery/gateway/centeraway
density = 1
icon_state = "offcenter"
- use_power = USE_POWER_OFF
+ use_power = 0
var/calibrated = 1
var/list/linked = list() //a list of the connected gateway chunks
var/ready = 0
diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm
index b02660b69da..cdecd93ee61 100644
--- a/code/modules/economy/ATM.dm
+++ b/code/modules/economy/ATM.dm
@@ -20,7 +20,7 @@ log transactions
icon = 'icons/obj/terminals_vr.dmi' //VOREStation Edit
icon_state = "atm"
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
circuit = /obj/item/weapon/circuitboard/atm
var/datum/money_account/authenticated_account
diff --git a/code/modules/food/kitchen/cooking_machines/_cooker.dm b/code/modules/food/kitchen/cooking_machines/_cooker.dm
index 008910c2531..0f39b1f0e61 100644
--- a/code/modules/food/kitchen/cooking_machines/_cooker.dm
+++ b/code/modules/food/kitchen/cooking_machines/_cooker.dm
@@ -10,7 +10,7 @@
icon = 'icons/obj/cooking_machines.dmi'
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
var/on_icon // Icon state used when cooking.
diff --git a/code/modules/food/kitchen/gibber.dm b/code/modules/food/kitchen/gibber.dm
index a3253560053..062fa42fc03 100644
--- a/code/modules/food/kitchen/gibber.dm
+++ b/code/modules/food/kitchen/gibber.dm
@@ -14,7 +14,7 @@
var/gib_time = 40 // Time from starting until meat appears
var/gib_throw_dir = WEST // Direction to spit meat and gibs in.
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 500
diff --git a/code/modules/food/kitchen/icecream.dm b/code/modules/food/kitchen/icecream.dm
index 2b53b657ce1..87920a3e735 100644
--- a/code/modules/food/kitchen/icecream.dm
+++ b/code/modules/food/kitchen/icecream.dm
@@ -14,7 +14,7 @@
icon_state = "icecream_vat"
density = 1
anchored = 0
- use_power = USE_POWER_OFF
+ use_power = 0
flags = OPENCONTAINER | NOREACT
var/list/product_types = list()
diff --git a/code/modules/food/kitchen/microwave.dm b/code/modules/food/kitchen/microwave.dm
index b9beeed09b3..53b13c9d49c 100644
--- a/code/modules/food/kitchen/microwave.dm
+++ b/code/modules/food/kitchen/microwave.dm
@@ -5,7 +5,7 @@
icon_state = "mw"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
active_power_usage = 100
clicksound = "button"
diff --git a/code/modules/food/kitchen/smartfridge.dm b/code/modules/food/kitchen/smartfridge.dm
index 56c6dee7e60..0213ef089bb 100644
--- a/code/modules/food/kitchen/smartfridge.dm
+++ b/code/modules/food/kitchen/smartfridge.dm
@@ -6,7 +6,7 @@
icon_state = "smartfridge"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
active_power_usage = 100
flags = NOREACT
diff --git a/code/modules/holodeck/HolodeckControl.dm b/code/modules/holodeck/HolodeckControl.dm
index 5783bfc398f..ed1ced9c78c 100644
--- a/code/modules/holodeck/HolodeckControl.dm
+++ b/code/modules/holodeck/HolodeckControl.dm
@@ -4,7 +4,7 @@
icon_keyboard = "tech_key"
icon_screen = "holocontrol"
- use_power = USE_POWER_IDLE
+ use_power = 1
active_power_usage = 8000 //8kW for the scenery + 500W per holoitem
var/item_power_usage = 500
@@ -224,7 +224,7 @@
damaged = 1
loadProgram(powerdown_program, 0)
active = 0
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
for(var/mob/M in range(10,src))
M.show_message("The holodeck overloads!")
@@ -271,7 +271,7 @@
linkedholodeck.gravitychange(1)
active = 0
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
/obj/machinery/computer/HolodeckControl/proc/loadProgram(var/prog, var/check_delay = 1)
@@ -301,7 +301,7 @@
last_change = world.time
active = 1
- use_power = USE_POWER_ACTIVE
+ use_power = 2
for(var/item in holographic_objs)
derez(item)
@@ -362,7 +362,7 @@
last_gravity_change = world.time
active = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
if(A.has_gravity)
A.gravitychange(0)
@@ -377,4 +377,4 @@
linkedholodeck.gravitychange(1)
active = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
diff --git a/code/modules/holodeck/HolodeckObjects.dm b/code/modules/holodeck/HolodeckObjects.dm
index 6bb678466bd..7b923d8c533 100644
--- a/code/modules/holodeck/HolodeckObjects.dm
+++ b/code/modules/holodeck/HolodeckObjects.dm
@@ -397,7 +397,7 @@ datum/unarmed_attack/holopugilism/unarmed_override(var/mob/living/carbon/human/u
var/eventstarted = 0
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON
diff --git a/code/modules/holomap/station_holomap.dm b/code/modules/holomap/station_holomap.dm
index 4d4e500a8fa..d38875f220d 100644
--- a/code/modules/holomap/station_holomap.dm
+++ b/code/modules/holomap/station_holomap.dm
@@ -8,7 +8,7 @@
icon_state = "station_map"
anchored = 1
density = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 500
circuit = /obj/item/weapon/circuitboard/station_map
@@ -126,7 +126,7 @@
GLOB.moved_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
GLOB.dir_set_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
GLOB.destroyed_event.register(watching_mob, src, /obj/machinery/station_map/proc/stopWatching)
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
if(bogus)
to_chat(user, "The holomap failed to initialize. This area of space cannot be mapped.")
@@ -156,7 +156,7 @@
GLOB.dir_set_event.unregister(watching_mob, src)
GLOB.destroyed_event.unregister(watching_mob, src)
watching_mob = null
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
/obj/machinery/station_map/power_change()
. = ..()
diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm
index affddf1168e..d5c185befc8 100644
--- a/code/modules/hydroponics/seed_machines.dm
+++ b/code/modules/hydroponics/seed_machines.dm
@@ -37,7 +37,7 @@
icon_state = "hydrotray3"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
var/obj/item/seeds/seed // Currently loaded seed packet.
var/obj/item/weapon/disk/botany/loaded_disk //Currently loaded data disk.
diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm
index 788b6bad67f..602947abb78 100644
--- a/code/modules/hydroponics/seed_storage.dm
+++ b/code/modules/hydroponics/seed_storage.dm
@@ -24,7 +24,7 @@
icon_state = "seeds"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 100
var/seeds_initialized = 0 // Map-placed ones break if seeds are loaded right at the start of the round, so we do it on the first interaction
diff --git a/code/modules/hydroponics/trays/tray_soil.dm b/code/modules/hydroponics/trays/tray_soil.dm
index 76a34176450..d6297a67666 100644
--- a/code/modules/hydroponics/trays/tray_soil.dm
+++ b/code/modules/hydroponics/trays/tray_soil.dm
@@ -2,7 +2,7 @@
name = "soil"
icon_state = "soil"
density = 0
- use_power = USE_POWER_OFF
+ use_power = 0
mechanical = 0
tray_light = 0
frozen = -1
diff --git a/code/modules/mining/drilling/drill.dm b/code/modules/mining/drilling/drill.dm
index 3c38927910c..bdfab8f92bb 100644
--- a/code/modules/mining/drilling/drill.dm
+++ b/code/modules/mining/drilling/drill.dm
@@ -1,7 +1,7 @@
/obj/machinery/mining
icon = 'icons/obj/mining_drill.dmi'
anchored = 0
- use_power = USE_POWER_OFF //The drill takes power directly from a cell.
+ use_power = 0 //The drill takes power directly from a cell.
density = 1
layer = MOB_LAYER+0.1 //So it draws over mobs in the tile north of it.
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 4a5e3182d82..3ac9df72994 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -297,7 +297,7 @@ var/list/ai_verbs_default = list(
/obj/machinery/ai_powersupply
name="Power Supply"
active_power_usage=50000 // Station AIs use significant amounts of power. This, when combined with charged SMES should mean AI lasts for 1hr without external power.
- use_power = USE_POWER_ACTIVE
+ use_power = 2
power_channel = EQUIP
var/mob/living/silicon/ai/powered_ai = null
invisibility = 100
@@ -325,14 +325,14 @@ var/list/ai_verbs_default = list(
qdel(src)
return
if(powered_ai.APU_power)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
return
if(!powered_ai.anchored)
loc = powered_ai.loc
- update_use_power(USE_POWER_OFF)
+ use_power = 0
use_power(50000) // Less optimalised but only called if AI is unwrenched. This prevents usage of wrenching as method to keep AI operational without power. Intellicard is for that.
if(powered_ai.anchored)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
/mob/living/silicon/ai/proc/pick_icon()
set category = "AI Settings"
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
index 6287859ae6c..048408773f8 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
@@ -11,7 +11,7 @@
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 20
active_power_usage = 5000
diff --git a/code/modules/modular_computers/NTNet/NTNet_relay.dm b/code/modules/modular_computers/NTNet/NTNet_relay.dm
index 2e4d43c7318..d659caaf404 100644
--- a/code/modules/modular_computers/NTNet/NTNet_relay.dm
+++ b/code/modules/modular_computers/NTNet/NTNet_relay.dm
@@ -2,7 +2,7 @@
/obj/machinery/ntnet_relay
name = "NTNet Quantum Relay"
desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile."
- use_power = USE_POWER_ACTIVE
+ use_power = 2
active_power_usage = 20000 //20kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational.
idle_power_usage = 100
icon_state = "bus"
@@ -38,9 +38,9 @@
/obj/machinery/ntnet_relay/process()
if(operable())
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
if(dos_overload)
dos_overload = max(0, dos_overload - dos_dissipate)
diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm
index 706ccda8e05..f522ff72504 100644
--- a/code/modules/paperwork/faxmachine.dm
+++ b/code/modules/paperwork/faxmachine.dm
@@ -12,7 +12,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
insert_anim = "faxsend"
req_one_access = list(access_lawyer, access_heads, access_armory, access_qm)
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 30
active_power_usage = 200
circuit = /obj/item/weapon/circuitboard/fax
diff --git a/code/modules/paperwork/papershredder.dm b/code/modules/paperwork/papershredder.dm
index 4c927b376e7..d626e6f04b4 100644
--- a/code/modules/paperwork/papershredder.dm
+++ b/code/modules/paperwork/papershredder.dm
@@ -9,7 +9,7 @@
var/shred_anim = "shredder-shredding"
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 200
power_channel = EQUIP
diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm
index eab9984d0f7..d5e04d97a48 100644
--- a/code/modules/paperwork/photocopier.dm
+++ b/code/modules/paperwork/photocopier.dm
@@ -6,7 +6,7 @@
var/insert_anim = "bigscanner1"
anchored = 1
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 30
active_power_usage = 200
power_channel = EQUIP
diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm
index 46f05bfd809..260730391ce 100644
--- a/code/modules/power/antimatter/control.dm
+++ b/code/modules/power/antimatter/control.dm
@@ -5,7 +5,7 @@
icon_state = "control"
anchored = 1
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 100
active_power_usage = 1000
@@ -211,10 +211,10 @@
/obj/machinery/power/am_control_unit/proc/toggle_power()
active = !active
if(active)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
visible_message("The [src.name] starts up.")
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
visible_message("The [src.name] shuts down.")
update_icon()
return
diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm
index 2b7b881b091..a3549b7a2f9 100644
--- a/code/modules/power/antimatter/shielding.dm
+++ b/code/modules/power/antimatter/shielding.dm
@@ -16,7 +16,7 @@ proc/cardinalrange(var/center)
anchored = 1
density = 1
dir = 1
- use_power = USE_POWER_OFF //Living things generally dont use power
+ use_power = 0//Living things generally dont use power
idle_power_usage = 0
active_power_usage = 0
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 3f25e63d2ec..ac082d739bc 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -67,7 +67,7 @@
plane = TURF_PLANE
layer = ABOVE_TURF_LAYER
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
clicksound = "switch"
req_access = list(access_engine_equip)
var/area/area
diff --git a/code/modules/power/fusion/core/_core.dm b/code/modules/power/fusion/core/_core.dm
index 9cc907e0522..99b0346e621 100644
--- a/code/modules/power/fusion/core/_core.dm
+++ b/code/modules/power/fusion/core/_core.dm
@@ -13,7 +13,7 @@ var/list/fusion_cores = list()
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core0"
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
anchored = 0
@@ -70,7 +70,7 @@ var/list/fusion_cores = list()
owned_field = new(loc, src)
owned_field.ChangeFieldStrength(field_strength)
icon_state = "core1"
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
. = 1
/obj/machinery/power/fusion_core/proc/Shutdown(var/force_rupture)
@@ -82,7 +82,7 @@ var/list/fusion_cores = list()
owned_field.RadiateAll()
qdel(owned_field)
owned_field = null
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
/obj/machinery/power/fusion_core/proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
diff --git a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
index 0ffab7db079..80a512b91b0 100644
--- a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
+++ b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm
@@ -7,7 +7,7 @@ var/list/fuel_injectors = list()
density = 1
anchored = 0
req_access = list(access_engine)
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 500
@@ -103,13 +103,13 @@ var/list/fuel_injectors = list()
if(!injecting && cur_assembly)
icon_state = "injector1"
injecting = 1
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
/obj/machinery/fusion_fuel_injector/proc/StopInjecting()
if(injecting)
injecting = 0
icon_state = "injector0"
- update_use_power(USE_POWER_OFF)
+ use_power = 0
/obj/machinery/fusion_fuel_injector/proc/Inject()
if(!injecting)
diff --git a/code/modules/power/fusion/gyrotron/gyrotron.dm b/code/modules/power/fusion/gyrotron/gyrotron.dm
index bdbdf9a3df3..539e9cbda6b 100644
--- a/code/modules/power/fusion/gyrotron/gyrotron.dm
+++ b/code/modules/power/fusion/gyrotron/gyrotron.dm
@@ -6,7 +6,7 @@ var/list/gyrotrons = list()
desc = "It is a heavy duty industrial gyrotron suited for powering fusion reactors."
icon_state = "emitter-off"
req_access = list(access_engine)
- use_power = USE_POWER_IDLE
+ use_power = 1
active_power_usage = 50000
circuit = /obj/item/weapon/circuitboard/gyrotron
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index 5e4493d476c..2eadfc520ad 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -5,7 +5,7 @@
density = 1
anchored = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things.
var/max_power = 500000
@@ -156,7 +156,7 @@
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \
"You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \
"You hear a ratchet.")
- update_use_power(anchored ? USE_POWER_IDLE : USE_POWER_ACTIVE)
+ use_power = anchored
if(anchored) // Powernet connection stuff.
connect_to_network()
else
diff --git a/code/modules/power/generator_type2.dm b/code/modules/power/generator_type2.dm
index 1271287796e..cc1e855a91c 100644
--- a/code/modules/power/generator_type2.dm
+++ b/code/modules/power/generator_type2.dm
@@ -4,7 +4,7 @@
icon_state = "teg"
anchored = 1
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/obj/machinery/atmospherics/unary/generator_input/input1
var/obj/machinery/atmospherics/unary/generator_input/input2
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index ad8af4352c7..ad02676e9b9 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -16,7 +16,7 @@
icon_state = "TheSingGen"
anchored = 1
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 200
active_power_usage = 1000
var/on = 1
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 495656ad339..a281ff7b0f5 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -212,7 +212,7 @@ var/global/list/light_type_cache = list()
anchored = 1
plane = MOB_PLANE
layer = ABOVE_MOB_LAYER
- use_power = USE_POWER_ACTIVE
+ use_power = 2
idle_power_usage = 2
active_power_usage = 10
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
@@ -435,14 +435,14 @@ var/global/list/light_type_cache = list()
on = 0
set_light(0)
else
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
set_light(brightness_range, brightness_power, brightness_color)
else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off())
use_power = 1
emergency_mode = TRUE
START_PROCESSING(SSobj, src)
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
set_light(0)
active_power_usage = ((light_range * light_power) * LIGHTING_POWER_FACTOR)
diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm
index 4515b6125cd..2443f3ea279 100644
--- a/code/modules/power/port_gen.dm
+++ b/code/modules/power/port_gen.dm
@@ -6,7 +6,7 @@
icon_state = "portgen0"
density = 1
anchored = 0
- use_power = USE_POWER_OFF
+ use_power = 0
var/active = 0
var/power_gen = 5000
diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm
index a88d0dafdc3..4fce8ba1584 100644
--- a/code/modules/power/power.dm
+++ b/code/modules/power/power.dm
@@ -11,7 +11,7 @@
icon = 'icons/obj/power.dmi'
anchored = 1.0
var/datum/powernet/powernet = null
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 0
active_power_usage = 0
diff --git a/code/modules/power/sensors/sensor_monitoring.dm b/code/modules/power/sensors/sensor_monitoring.dm
index 2e280e28ae6..7868e16786e 100644
--- a/code/modules/power/sensors/sensor_monitoring.dm
+++ b/code/modules/power/sensors/sensor_monitoring.dm
@@ -15,7 +15,7 @@
anchored = 1.0
circuit = /obj/item/weapon/circuitboard/powermonitor
var/alerting = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 300
active_power_usage = 300
var/datum/nano_module/power_monitor/power_monitor
diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm
index 6478ff999a2..d8712a0e4c1 100644
--- a/code/modules/power/singularity/containment_field.dm
+++ b/code/modules/power/singularity/containment_field.dm
@@ -8,7 +8,7 @@
anchored = 1
density = 0
unacidable = 1
- use_power = USE_POWER_OFF
+ use_power = 0
light_range = 4
flags = PROXMOVE
var/obj/machinery/field_generator/FG1 = null
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 2e6cda0049d..f847813923e 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -10,7 +10,7 @@
req_access = list(access_engine_equip)
var/id = null
- use_power = USE_POWER_OFF //uses powernet power, not APC power
+ use_power = 0 //uses powernet power, not APC power
active_power_usage = 30000 //30 kW laser. I guess that means 30 kJ per shot.
var/active = 0
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 6a510f00604..16a4c189c16 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -20,7 +20,7 @@ field_generator power level display
icon_state = "Field_Gen"
anchored = 0
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/const/num_power_levels = 6 // Total number of power level icon has
var/Varedit_start = 0
var/Varpower = 0
diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm
index bb470811ba9..c49c6055985 100644
--- a/code/modules/power/singularity/generator.dm
+++ b/code/modules/power/singularity/generator.dm
@@ -6,7 +6,7 @@
icon_state = "TheSingGen"
anchored = 0
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/energy = 0
var/creation_type = /obj/singularity
diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
index f5481afd4cc..7460830f212 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
@@ -258,7 +258,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
icon_state = "none"
anchored = 0
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 0
active_power_usage = 0
var/construction_state = 0
@@ -383,10 +383,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(src.construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
- update_use_power(USE_POWER_OFF)
+ use_power = 0
src.construction_state = temp_state
if(src.construction_state >= 3)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
update_icon()
return 1
return 0
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index 8cb370924be..bcdd0d5036e 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -8,7 +8,7 @@
reference = "control_box"
anchored = 0
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 500
active_power_usage = 70000 //70 kW per unit of strength
construction_state = 0
@@ -42,7 +42,7 @@
/obj/machinery/particle_accelerator/control_box/update_state()
if(construction_state < 3)
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
assembled = 0
active = 0
for(var/obj/structure/particle_accelerator/part in connected_parts)
@@ -52,7 +52,7 @@
connected_parts = list()
return
if(!part_scan())
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
active = 0
connected_parts = list()
@@ -138,9 +138,9 @@
..()
if(stat & NOPOWER)
active = 0
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
else if(!stat && construction_state == 3)
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
/obj/machinery/particle_accelerator/control_box/process()
@@ -212,13 +212,13 @@
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(usr, usr.client)](?) in ([x],[y],[z] - JMP)",0,1)
log_game("PACCEL([x],[y],[z]) [key_name(usr)] turned [active?"ON":"OFF"].")
if(active)
- update_use_power(USE_POWER_ACTIVE)
+ update_use_power(2)
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = src.strength
part.powered = 1
part.update_icon()
else
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
part.powered = 0
diff --git a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
index 5a4176ee89e..921b0000781 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
@@ -9,7 +9,7 @@
icon_state = "smasher"
anchored = 0
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/successful_craft = FALSE // Are we waiting to be emptied?
var/image/material_layer // Holds the image used for the filled overlay.
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index 783a6691b45..31c7be32ec3 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -11,7 +11,7 @@
icon_state = "smes"
density = 1
anchored = 1
- use_power = USE_POWER_OFF
+ use_power = 0
circuit = /obj/item/weapon/circuitboard/smes
clicksound = "switch"
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 5daeb1e2cbe..c4c7d2ff02b 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -13,7 +13,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "sp_base"
anchored = 1
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 0
active_power_usage = 0
var/id = 0
@@ -285,7 +285,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "solar"
anchored = 1
density = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 250
var/id = 0
var/cdir = 0
diff --git a/code/modules/power/supermatter/setup_supermatter.dm b/code/modules/power/supermatter/setup_supermatter.dm
index c0b63d9ce17..7477623805f 100644
--- a/code/modules/power/supermatter/setup_supermatter.dm
+++ b/code/modules/power/supermatter/setup_supermatter.dm
@@ -126,7 +126,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup)
log_and_message_admins("## WARNING: Unable to locate pump at [x] [y] [z]!")
return SETUP_WARNING
P.target_pressure = P.max_pressure_setting
- P.update_use_power(USE_POWER_IDLE)
+ P.use_power = 1
P.update_icon()
return SETUP_OK
@@ -259,7 +259,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup)
return SETUP_WARNING
F.rebuild_filtering_list()
- F.update_use_power(USE_POWER_IDLE)
+ F.use_power = 1
F.update_icon()
return SETUP_OK
diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm
index 673b2ece866..a6eab0dbe0a 100644
--- a/code/modules/power/tracker.dm
+++ b/code/modules/power/tracker.dm
@@ -10,7 +10,7 @@
icon_state = "tracker"
anchored = 1
density = 1
- use_power = USE_POWER_OFF
+ use_power = 0
var/id = 0
var/sun_angle = 0 // sun angle as set by sun datum
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index e6fc792d093..9cbf00ddc6d 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -16,7 +16,7 @@
icon = 'icons/obj/chemical.dmi'
icon_state = "mixer0"
circuit = /obj/item/weapon/circuitboard/chem_master
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 20
var/beaker = null
var/obj/item/weapon/storage/pill_bottle/loaded_pill_bottle = null
@@ -333,7 +333,7 @@
icon_state = "juicer1"
density = 0
anchored = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 5
active_power_usage = 100
circuit = /obj/item/weapon/circuitboard/grinder
diff --git a/code/modules/reagents/dispenser/dispenser2.dm b/code/modules/reagents/dispenser/dispenser2.dm
index 845f1a102cb..17da8452de4 100644
--- a/code/modules/reagents/dispenser/dispenser2.dm
+++ b/code/modules/reagents/dispenser/dispenser2.dm
@@ -15,7 +15,7 @@
var/accept_drinking = 0
var/amount = 30
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 100
anchored = 1
diff --git a/code/modules/reagents/distilling/distilling.dm b/code/modules/reagents/distilling/distilling.dm
index 50c2b598c04..b86bcc74352 100644
--- a/code/modules/reagents/distilling/distilling.dm
+++ b/code/modules/reagents/distilling/distilling.dm
@@ -6,7 +6,7 @@
/obj/machinery/portable_atmospherics/powered/reagent_distillery
name = "chemical distillery"
desc = "A complex machine utilizing state-of-the-art components to mix chemicals at different temperatures."
- use_power = USE_POWER_IDLE
+ use_power = 1
icon = 'icons/obj/machines/reagent.dmi'
icon_state = "distiller"
diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm
index b8aba139399..8a2e9796cda 100644
--- a/code/modules/recycling/disposal.dm
+++ b/code/modules/recycling/disposal.dm
@@ -359,7 +359,7 @@
// charge the gas reservoir and perform flush if ready
/obj/machinery/disposal/process()
if(!air_contents || (stat & BROKEN)) // nothing can happen if broken
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
return
flush_count++
@@ -377,7 +377,7 @@
flush()
if(mode != 1) //if off or ready, no need to charge
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
else if(air_contents.return_pressure() >= SEND_PRESSURE)
mode = 2 //if full enough, switch to ready mode
update()
@@ -386,7 +386,7 @@
/obj/machinery/disposal/proc/pressurize()
if(stat & NOPOWER) // won't charge if no power
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
return
var/atom/L = loc // recharging from loc turf
diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm
index f9ff3adb51c..75d45652d90 100644
--- a/code/modules/research/circuitprinter.dm
+++ b/code/modules/research/circuitprinter.dm
@@ -20,7 +20,7 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
hidden_materials = list(MAT_PLASTEEL, MAT_DURASTEEL, MAT_GRAPHITE, MAT_VERDANTIUM, MAT_MORPHIUM, MAT_METALHYDROGEN, MAT_SUPERMATTER)
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 30
active_power_usage = 2500
diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm
index a17bf370bf9..f8d7fbc4d6b 100644
--- a/code/modules/research/destructive_analyzer.dm
+++ b/code/modules/research/destructive_analyzer.dm
@@ -12,7 +12,7 @@ Note: Must be placed within 3 tiles of the R&D Console
var/obj/item/weapon/loaded_item = null
var/decon_mod = 0
circuit = /obj/item/weapon/circuitboard/destructive_analyzer
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 30
active_power_usage = 2500
diff --git a/code/modules/research/message_server.dm b/code/modules/research/message_server.dm
index 86004b61306..590840131c9 100644
--- a/code/modules/research/message_server.dm
+++ b/code/modules/research/message_server.dm
@@ -54,7 +54,7 @@ var/global/list/obj/machinery/message_server/message_servers = list()
desc = "Facilitates both PDA messages and request console functions."
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 100
@@ -240,7 +240,7 @@ var/obj/machinery/blackbox_recorder/blackbox
desc = "Records all radio communications, as well as various other information in case of the worst."
density = 1
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 10
active_power_usage = 100
var/list/messages = list() //Stores messages of non-standard frequencies
diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm
index 3837e13aae3..3d65e35d633 100644
--- a/code/modules/research/protolathe.dm
+++ b/code/modules/research/protolathe.dm
@@ -3,7 +3,7 @@
icon_state = "protolathe"
flags = OPENCONTAINER
circuit = /obj/item/weapon/circuitboard/protolathe
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 30
active_power_usage = 5000
diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm
index 5c331228152..b7e9b78c56b 100644
--- a/code/modules/research/rdmachines.dm
+++ b/code/modules/research/rdmachines.dm
@@ -7,7 +7,7 @@
icon = 'icons/obj/machines/research_vr.dmi' //VOREStation Edit - Replaced with Eris sprites
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
var/busy = 0
var/obj/machinery/computer/rdconsole/linked_console
diff --git a/code/modules/security levels/keycard authentication.dm b/code/modules/security levels/keycard authentication.dm
index 707bd3ccd9f..e3202ccbec2 100644
--- a/code/modules/security levels/keycard authentication.dm
+++ b/code/modules/security levels/keycard authentication.dm
@@ -16,7 +16,7 @@
//1 = select event
//2 = authenticate
anchored = 1.0
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON
diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm
index 923d1ec327b..1fd2b78a8cb 100644
--- a/code/modules/shieldgen/emergency_shield.dm
+++ b/code/modules/shieldgen/emergency_shield.dm
@@ -134,7 +134,7 @@
var/is_open = 0 //Whether or not the wires are exposed
var/locked = 0
var/check_delay = 60 //periodically recheck if we need to rebuild a shield
- use_power = USE_POWER_OFF
+ use_power = 0
idle_power_usage = 0
var/global/list/blockedturfs = list(
/turf/space,
@@ -156,7 +156,7 @@
idle_power_usage = 0
for(var/obj/machinery/shield/shield_tile in deployed_shields)
idle_power_usage += shield_tile.shield_idle_power
- update_use_power(USE_POWER_IDLE)
+ update_use_power(1)
/obj/machinery/shieldgen/proc/shields_down()
if(!active) return 0 //If it's already off, how did this get called?
@@ -166,7 +166,7 @@
collapse_shields()
- update_use_power(USE_POWER_OFF)
+ update_use_power(0)
/obj/machinery/shieldgen/proc/create_shields()
for(var/turf/target_tile in range(2, src))
diff --git a/code/modules/shieldgen/sheldwallgen.dm b/code/modules/shieldgen/sheldwallgen.dm
index 2a6a859c43e..331f04549a9 100644
--- a/code/modules/shieldgen/sheldwallgen.dm
+++ b/code/modules/shieldgen/sheldwallgen.dm
@@ -23,7 +23,7 @@
//There have to be at least two posts, so these are effectively doubled
var/power_draw = 30000 //30 kW. How much power is drawn from powernet. Increase this to allow the generator to sustain longer shields, at the cost of more power draw.
var/max_stored_power = 50000 //50 kW
- use_power = USE_POWER_OFF //Draws directly from power net. Does not use APC power.
+ use_power = 0 //Draws directly from power net. Does not use APC power.
/obj/machinery/shieldwallgen/attack_hand(mob/user as mob)
if(state != 1)
diff --git a/code/modules/shieldgen/shield_capacitor.dm b/code/modules/shieldgen/shield_capacitor.dm
index 2ef3f17a85f..476f3c9f48c 100644
--- a/code/modules/shieldgen/shield_capacitor.dm
+++ b/code/modules/shieldgen/shield_capacitor.dm
@@ -15,7 +15,7 @@
var/max_charge = 8e6 //8 MJ
var/max_charge_rate = 400000 //400 kW
var/locked = 0
- use_power = USE_POWER_OFF //doesn't use APC power
+ use_power = 0 //doesn't use APC power
var/charge_rate = 100000 //100 kW
var/obj/machinery/shield_gen/owned_gen
diff --git a/code/modules/shieldgen/shield_diffuser.dm b/code/modules/shieldgen/shield_diffuser.dm
index 9c42e22b573..c30f8a73517 100644
--- a/code/modules/shieldgen/shield_diffuser.dm
+++ b/code/modules/shieldgen/shield_diffuser.dm
@@ -4,7 +4,7 @@
description_info = "This device disrupts shields on directly adjacent tiles (in a + shaped pattern). They are commonly installed around exterior airlocks to prevent shields from blocking EVA access."
icon = 'icons/obj/machines/shielding.dmi'
icon_state = "fdiffuser_on"
- use_power = USE_POWER_ACTIVE
+ use_power = 2
idle_power_usage = 25 // Previously 100.
active_power_usage = 500 // Previously 2000
anchored = 1
@@ -57,7 +57,7 @@
update_icon()
return
enabled = !enabled
- update_use_power(enabled ? USE_POWER_ACTIVE : USE_POWER_IDLE)
+ use_power = enabled + 1
update_icon()
to_chat(usr, "You turn \the [src] [enabled ? "on" : "off"].")
diff --git a/code/modules/shieldgen/shield_gen.dm b/code/modules/shieldgen/shield_gen.dm
index 137c081488e..a589a0764c5 100644
--- a/code/modules/shieldgen/shield_gen.dm
+++ b/code/modules/shieldgen/shield_gen.dm
@@ -22,7 +22,7 @@
var/time_since_fail = 100
var/energy_conversion_rate = 0.0006 //how many renwicks per watt? Higher numbers equals more effiency.
var/z_range = 0 // How far 'up and or down' to extend the shield to, in z-levels. Only works on MultiZ supported z-levels.
- use_power = USE_POWER_OFF //doesn't use APC power
+ use_power = 0 //doesn't use APC power
/obj/machinery/shield_gen/advanced
name = "advanced bubble shield generator"
diff --git a/code/modules/xenoarcheaology/artifacts/autocloner.dm b/code/modules/xenoarcheaology/artifacts/autocloner.dm
index 28cb0a7360e..ee774b31f9e 100644
--- a/code/modules/xenoarcheaology/artifacts/autocloner.dm
+++ b/code/modules/xenoarcheaology/artifacts/autocloner.dm
@@ -10,7 +10,7 @@
density = 1
var/previous_power_state = 0
- use_power = USE_POWER_IDLE
+ use_power = 1
active_power_usage = 2000
idle_power_usage = 1000
@@ -55,7 +55,7 @@
//if we've finished growing...
if(time_spent_spawning >= time_per_spawn)
time_spent_spawning = 0
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
src.visible_message("[bicon(src)] [src] pings!")
icon_state = "cellold1"
desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow."
@@ -64,11 +64,11 @@
//if we're getting close to finished, kick into overdrive power usage
if(time_spent_spawning / time_per_spawn > 0.75)
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
icon_state = "cellold2"
desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow. A dark shape appears to be forming inside..."
else
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
icon_state = "cellold1"
desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow."
diff --git a/code/modules/xenoarcheaology/artifacts/replicator.dm b/code/modules/xenoarcheaology/artifacts/replicator.dm
index da5b123c166..f28d5c2ef0c 100644
--- a/code/modules/xenoarcheaology/artifacts/replicator.dm
+++ b/code/modules/xenoarcheaology/artifacts/replicator.dm
@@ -7,7 +7,7 @@
idle_power_usage = 100
active_power_usage = 1000
- use_power = USE_POWER_IDLE
+ use_power = 1
var/spawn_progress_time = 0
var/max_spawn_time = 50
@@ -105,7 +105,7 @@
max_spawn_time = rand(30,100)
if(!spawning_types.len || !stored_materials.len)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
icon_state = "borgcharger0(old)"
else if(prob(5))
@@ -146,7 +146,7 @@
spawning_types.Add(construction[construction[index]])
spawn_progress_time = 0
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
icon_state = "borgcharger1(old)"
else
src.visible_message(fail_message)
diff --git a/code/modules/xenoarcheaology/tools/artifact_harvester.dm b/code/modules/xenoarcheaology/tools/artifact_harvester.dm
index 6771db1b91e..480061f9bb8 100644
--- a/code/modules/xenoarcheaology/tools/artifact_harvester.dm
+++ b/code/modules/xenoarcheaology/tools/artifact_harvester.dm
@@ -6,7 +6,7 @@
density = 1
idle_power_usage = 50
active_power_usage = 750
- use_power = USE_POWER_IDLE
+ use_power = 1
var/harvesting = 0
var/obj/item/weapon/anobattery/inserted_battery
var/obj/machinery/artifact/cur_artifact
@@ -80,7 +80,7 @@
//check if we've finished
if(inserted_battery.stored_charge >= inserted_battery.capacity)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
harvesting = 0
cur_artifact.anchored = 0
cur_artifact.being_used = 0
@@ -105,7 +105,7 @@
//if there's no charge left, finish
if(inserted_battery.stored_charge <= 0)
- update_use_power(USE_POWER_IDLE)
+ use_power = 1
inserted_battery.stored_charge = 0
harvesting = 0
if(inserted_battery.battery_effect && inserted_battery.battery_effect.activated)
@@ -191,7 +191,7 @@
if(source_effect)
harvesting = 1
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
cur_artifact.anchored = 1
cur_artifact.being_used = 1
icon_state = "incubator_on"
@@ -235,7 +235,7 @@
inserted_battery.battery_effect.ToggleActivate(1)
last_process = world.time
harvesting = -1
- update_use_power(USE_POWER_ACTIVE)
+ use_power = 2
icon_state = "incubator_on"
var/message = "[src] states, \"Warning, battery charge dump commencing.\""
src.visible_message(message)
diff --git a/code/modules/xenoarcheaology/tools/geosample_scanner.dm b/code/modules/xenoarcheaology/tools/geosample_scanner.dm
index 5cb5d32479e..84ffeaf4302 100644
--- a/code/modules/xenoarcheaology/tools/geosample_scanner.dm
+++ b/code/modules/xenoarcheaology/tools/geosample_scanner.dm
@@ -6,7 +6,7 @@
icon = 'icons/obj/virology.dmi'
icon_state = "analyser"
- use_power = USE_POWER_IDLE
+ use_power = 1 //1 = idle, 2 = active
idle_power_usage = 20
active_power_usage = 300
diff --git a/code/modules/xenobio2/machinery/gene_manipulators.dm b/code/modules/xenobio2/machinery/gene_manipulators.dm
index d0b368335dc..16e5fd57fa8 100644
--- a/code/modules/xenobio2/machinery/gene_manipulators.dm
+++ b/code/modules/xenobio2/machinery/gene_manipulators.dm
@@ -42,7 +42,7 @@
/obj/machinery/xenobio
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
var/obj/item/weapon/disk/xenobio/loaded_disk //Currently loaded data disk.
diff --git a/code/modules/xenobio2/machinery/injector.dm b/code/modules/xenobio2/machinery/injector.dm
index 59dfbf69c63..cc10bd758fb 100644
--- a/code/modules/xenobio2/machinery/injector.dm
+++ b/code/modules/xenobio2/machinery/injector.dm
@@ -10,7 +10,7 @@
desc = "Injects biological organisms that are inserted with the contents of an inserted beaker at the command of a remote computer."
density = 1
anchored = 1
- use_power = USE_POWER_IDLE
+ use_power = 1
icon = 'icons/obj/biogenerator.dmi'
icon_state = "biogen-work"
var/mob/living/occupant
diff --git a/code/modules/xenobio2/machinery/injector_computer.dm b/code/modules/xenobio2/machinery/injector_computer.dm
index 196543a2560..7967c24be7d 100644
--- a/code/modules/xenobio2/machinery/injector_computer.dm
+++ b/code/modules/xenobio2/machinery/injector_computer.dm
@@ -11,7 +11,7 @@
icon_keyboard = "med_key"
icon_screen = "dna"
light_color = "#315ab4"
- use_power = USE_POWER_IDLE
+ use_power = 1
idle_power_usage = 250
active_power_usage = 500
circuit = /obj/item/weapon/circuitboard/xenobio2computer
diff --git a/maps/RandomZLevels/challenge.dm b/maps/RandomZLevels/challenge.dm
deleted file mode 100644
index 59125422a45..00000000000
--- a/maps/RandomZLevels/challenge.dm
+++ /dev/null
@@ -1,32 +0,0 @@
-//Challenge Areas
-
-/area/awaymission/challenge/start
- name = "Where Am I?"
- icon_state = "away"
-
-/area/awaymission/challenge/main
- name = "\improper Danger Room"
- icon_state = "away1"
- requires_power = 0
-
-/area/awaymission/challenge/end
- name = "Administration"
- icon_state = "away2"
- requires_power = 0
-
-
-/obj/machinery/power/emitter/energycannon
- name = "Energy Cannon"
- desc = "A heavy duty industrial laser"
- icon = 'icons/obj/singularity.dmi'
- icon_state = "emitter"
- anchored = 1
- density = 1
-
- use_power = USE_POWER_OFF
- idle_power_usage = 0
- active_power_usage = 0
-
- active = 1
- locked = 1
- state = 2
\ No newline at end of file
diff --git a/maps/RandomZLevels/wildwest.dm b/maps/RandomZLevels/wildwest.dm
index 0450cd84a18..9e4a61d9c27 100644
--- a/maps/RandomZLevels/wildwest.dm
+++ b/maps/RandomZLevels/wildwest.dm
@@ -1,173 +1,173 @@
-/* Code for the Wild West map by Brotemis
- * Contains:
- * Wish Granter
- * Meat Grinder
- */
-
-/*
- * Wish Granter
- */
-/obj/machinery/wish_granter_dark
- name = "Wish Granter"
- desc = "You're not so sure about this, anymore..."
- icon = 'icons/obj/device.dmi'
- icon_state = "syndbeacon"
-
- anchored = 1
- density = 1
- use_power = USE_POWER_OFF
-
- var/chargesa = 1
- var/insistinga = 0
-
-/obj/machinery/wish_granter_dark/attack_hand(var/mob/living/carbon/human/user as mob)
- usr.set_machine(src)
-
- if(chargesa <= 0)
- to_chat(user, "The Wish Granter lies silent.")
- return
-
- else if(!istype(user, /mob/living/carbon/human))
- to_chat(user, "You feel a dark stirring inside of the Wish Granter, something you want nothing of. Your instincts are better than any man's.")
- return
-
- else if(is_special_character(user))
- to_chat(user, "Even to a heart as dark as yours, you know nothing good will come of this. Something instinctual makes you pull away.")
-
- else if (!insistinga)
- to_chat(user, "Your first touch makes the Wish Granter stir, listening to you. Are you really sure you want to do this?")
- insistinga++
-
- else
- chargesa--
- insistinga = 0
- var/wish = input("You want...","Wish") as null|anything in list("Power","Wealth","Immortality","To Kill","Peace")
- switch(wish)
- if("Power")
- to_chat(user, "Your wish is granted, but at a terrible cost...")
- to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
- if (!(LASER in user.mutations))
- user.mutations.Add(LASER)
- to_chat(user, "You feel pressure building behind your eyes.")
- if (!(COLD_RESISTANCE in user.mutations))
- user.mutations.Add(COLD_RESISTANCE)
- to_chat(user, "Your body feels warm.")
- if (!(XRAY in user.mutations))
- user.mutations.Add(XRAY)
- user.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
- user.see_in_dark = 8
- user.see_invisible = SEE_INVISIBLE_LEVEL_TWO
- to_chat(user, "The walls suddenly disappear.")
- user.dna.mutantrace = "shadow"
- user.update_mutantrace()
- if("Wealth")
- to_chat(user, "Your wish is granted, but at a terrible cost...")
- to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
- new /obj/structure/closet/syndicate/resources/everything(loc)
- user.dna.mutantrace = "shadow"
- user.update_mutantrace()
- if("Immortality")
- to_chat(user, "Your wish is granted, but at a terrible cost...")
- to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
- user.verbs += /mob/living/carbon/proc/immortality
- user.dna.mutantrace = "shadow"
- user.update_mutantrace()
- if("To Kill")
- to_chat(user, "Your wish is granted, but at a terrible cost...")
- to_chat(user, "The Wish Granter punishes you for your wickedness, claiming your soul and warping your body to match the darkness in your heart.")
- ticker.mode.traitors += user.mind
- user.mind.special_role = "traitor"
- var/datum/objective/hijack/hijack = new
- hijack.owner = user.mind
- user.mind.objectives += hijack
- to_chat(user, "Your inhibitions are swept away, the bonds of loyalty broken, you are free to murder as you please!")
- var/obj_count = 1
- for(var/datum/objective/OBJ in user.mind.objectives)
- to_chat(user, "Objective #[obj_count]: [OBJ.explanation_text]")
- obj_count++
- user.dna.mutantrace = "shadow"
- user.update_mutantrace()
- if("Peace")
- to_chat(user, "Whatever alien sentience that the Wish Granter possesses is satisfied with your wish. There is a distant wailing as the last of the Faithless begin to die, then silence.")
- to_chat(user, "You feel as if you just narrowly avoided a terrible fate...")
- for(var/mob/living/simple_mob/faithless/F in living_mob_list)
- F.health = -10
- F.set_stat(DEAD)
- F.icon_state = "faithless_dead"
-
-
-///////////////Meatgrinder//////////////
-
-
-/obj/effect/meatgrinder
- name = "Meat Grinder"
- desc = "What is that thing?"
- density = 1
- anchored = 1
- icon = 'icons/mob/critter.dmi'
- icon_state = "blob"
- var/triggerproc = "explode" //name of the proc thats called when the mine is triggered
- var/triggered = 0
-
-/obj/effect/meatgrinder/New()
- icon_state = "blob"
-
-/obj/effect/meatgrinder/HasEntered(AM as mob|obj)
- Bumped(AM)
-
-/obj/effect/meatgrinder/Bumped(mob/M as mob|obj)
-
- if(triggered) return
-
- if(istype(M, /mob/living/carbon/human) || istype(M, /mob/living/carbon/monkey))
- for(var/mob/O in viewers(world.view, src.loc))
- to_chat(O, "[M] triggered the \icon[src] [src]")
- triggered = 1
- call(src,triggerproc)(M)
-
-/obj/effect/meatgrinder/proc/triggerrad1(mob)
- var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
- for(var/mob/O in viewers(world.view, src.loc))
- s.set_up(3, 1, src)
- s.start()
- explosion(mob, 1, 0, 0, 0)
- spawn(0)
- qdel(src)
-
-/obj/effect/meatgrinder
- name = "Meat Grinder"
- icon_state = "blob"
- triggerproc = "triggerrad1"
-
-
-/////For the Wishgranter///////////
-
-/mob/living/carbon/proc/immortality()
- set category = "Immortality"
- set name = "Resurrection"
-
- var/mob/living/carbon/C = usr
- if(!C.stat)
- to_chat(C, "You're not dead yet!")
- return
- to_chat(C, "Death is not your end!")
-
- spawn(rand(800,1200))
- if(C.stat == DEAD)
- dead_mob_list -= C
- living_mob_list += C
- C.set_stat(CONSCIOUS)
- C.tod = null
- C.setToxLoss(0)
- C.setOxyLoss(0)
- C.setCloneLoss(0)
- C.SetParalysis(0)
- C.SetStunned(0)
- C.SetWeakened(0)
- C.radiation = 0
- C.heal_overall_damage(C.getBruteLoss(), C.getFireLoss())
- C.reagents.clear_reagents()
- to_chat(C, "You have regenerated.")
- C.visible_message("[usr] appears to wake from the dead, having healed all wounds.")
- C.update_canmove()
- return 1
+/* Code for the Wild West map by Brotemis
+ * Contains:
+ * Wish Granter
+ * Meat Grinder
+ */
+
+/*
+ * Wish Granter
+ */
+/obj/machinery/wish_granter_dark
+ name = "Wish Granter"
+ desc = "You're not so sure about this, anymore..."
+ icon = 'icons/obj/device.dmi'
+ icon_state = "syndbeacon"
+
+ anchored = 1
+ density = 1
+ use_power = 0
+
+ var/chargesa = 1
+ var/insistinga = 0
+
+/obj/machinery/wish_granter_dark/attack_hand(var/mob/living/carbon/human/user as mob)
+ usr.set_machine(src)
+
+ if(chargesa <= 0)
+ to_chat(user, "The Wish Granter lies silent.")
+ return
+
+ else if(!istype(user, /mob/living/carbon/human))
+ to_chat(user, "You feel a dark stirring inside of the Wish Granter, something you want nothing of. Your instincts are better than any man's.")
+ return
+
+ else if(is_special_character(user))
+ to_chat(user, "Even to a heart as dark as yours, you know nothing good will come of this. Something instinctual makes you pull away.")
+
+ else if (!insistinga)
+ to_chat(user, "Your first touch makes the Wish Granter stir, listening to you. Are you really sure you want to do this?")
+ insistinga++
+
+ else
+ chargesa--
+ insistinga = 0
+ var/wish = input("You want...","Wish") as null|anything in list("Power","Wealth","Immortality","To Kill","Peace")
+ switch(wish)
+ if("Power")
+ to_chat(user, "Your wish is granted, but at a terrible cost...")
+ to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
+ if (!(LASER in user.mutations))
+ user.mutations.Add(LASER)
+ to_chat(user, "You feel pressure building behind your eyes.")
+ if (!(COLD_RESISTANCE in user.mutations))
+ user.mutations.Add(COLD_RESISTANCE)
+ to_chat(user, "Your body feels warm.")
+ if (!(XRAY in user.mutations))
+ user.mutations.Add(XRAY)
+ user.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
+ user.see_in_dark = 8
+ user.see_invisible = SEE_INVISIBLE_LEVEL_TWO
+ to_chat(user, "The walls suddenly disappear.")
+ user.dna.mutantrace = "shadow"
+ user.update_mutantrace()
+ if("Wealth")
+ to_chat(user, "Your wish is granted, but at a terrible cost...")
+ to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
+ new /obj/structure/closet/syndicate/resources/everything(loc)
+ user.dna.mutantrace = "shadow"
+ user.update_mutantrace()
+ if("Immortality")
+ to_chat(user, "Your wish is granted, but at a terrible cost...")
+ to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.")
+ user.verbs += /mob/living/carbon/proc/immortality
+ user.dna.mutantrace = "shadow"
+ user.update_mutantrace()
+ if("To Kill")
+ to_chat(user, "Your wish is granted, but at a terrible cost...")
+ to_chat(user, "The Wish Granter punishes you for your wickedness, claiming your soul and warping your body to match the darkness in your heart.")
+ ticker.mode.traitors += user.mind
+ user.mind.special_role = "traitor"
+ var/datum/objective/hijack/hijack = new
+ hijack.owner = user.mind
+ user.mind.objectives += hijack
+ to_chat(user, "Your inhibitions are swept away, the bonds of loyalty broken, you are free to murder as you please!")
+ var/obj_count = 1
+ for(var/datum/objective/OBJ in user.mind.objectives)
+ to_chat(user, "Objective #[obj_count]: [OBJ.explanation_text]")
+ obj_count++
+ user.dna.mutantrace = "shadow"
+ user.update_mutantrace()
+ if("Peace")
+ to_chat(user, "Whatever alien sentience that the Wish Granter possesses is satisfied with your wish. There is a distant wailing as the last of the Faithless begin to die, then silence.")
+ to_chat(user, "You feel as if you just narrowly avoided a terrible fate...")
+ for(var/mob/living/simple_mob/faithless/F in living_mob_list)
+ F.health = -10
+ F.set_stat(DEAD)
+ F.icon_state = "faithless_dead"
+
+
+///////////////Meatgrinder//////////////
+
+
+/obj/effect/meatgrinder
+ name = "Meat Grinder"
+ desc = "What is that thing?"
+ density = 1
+ anchored = 1
+ icon = 'icons/mob/critter.dmi'
+ icon_state = "blob"
+ var/triggerproc = "explode" //name of the proc thats called when the mine is triggered
+ var/triggered = 0
+
+/obj/effect/meatgrinder/New()
+ icon_state = "blob"
+
+/obj/effect/meatgrinder/HasEntered(AM as mob|obj)
+ Bumped(AM)
+
+/obj/effect/meatgrinder/Bumped(mob/M as mob|obj)
+
+ if(triggered) return
+
+ if(istype(M, /mob/living/carbon/human) || istype(M, /mob/living/carbon/monkey))
+ for(var/mob/O in viewers(world.view, src.loc))
+ to_chat(O, "[M] triggered the \icon[src] [src]")
+ triggered = 1
+ call(src,triggerproc)(M)
+
+/obj/effect/meatgrinder/proc/triggerrad1(mob)
+ var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
+ for(var/mob/O in viewers(world.view, src.loc))
+ s.set_up(3, 1, src)
+ s.start()
+ explosion(mob, 1, 0, 0, 0)
+ spawn(0)
+ qdel(src)
+
+/obj/effect/meatgrinder
+ name = "Meat Grinder"
+ icon_state = "blob"
+ triggerproc = "triggerrad1"
+
+
+/////For the Wishgranter///////////
+
+/mob/living/carbon/proc/immortality()
+ set category = "Immortality"
+ set name = "Resurrection"
+
+ var/mob/living/carbon/C = usr
+ if(!C.stat)
+ to_chat(C, "You're not dead yet!")
+ return
+ to_chat(C, "Death is not your end!")
+
+ spawn(rand(800,1200))
+ if(C.stat == DEAD)
+ dead_mob_list -= C
+ living_mob_list += C
+ C.set_stat(CONSCIOUS)
+ C.tod = null
+ C.setToxLoss(0)
+ C.setOxyLoss(0)
+ C.setCloneLoss(0)
+ C.SetParalysis(0)
+ C.SetStunned(0)
+ C.SetWeakened(0)
+ C.radiation = 0
+ C.heal_overall_damage(C.getBruteLoss(), C.getFireLoss())
+ C.reagents.clear_reagents()
+ to_chat(C, "You have regenerated.")
+ C.visible_message("[usr] appears to wake from the dead, having healed all wounds.")
+ C.update_canmove()
+ return 1
diff --git a/vorestation.dme b/vorestation.dme
index 1dd6e9a9e91..3ad9cff74d6 100644
--- a/vorestation.dme
+++ b/vorestation.dme
@@ -738,8 +738,8 @@
#include "code\game\machinery\adv_med.dm"
#include "code\game\machinery\adv_med_vr.dm"
#include "code\game\machinery\ai_slipper.dm"
+#include "code\game\machinery\air_alarm.dm"
#include "code\game\machinery\airconditioner_vr.dm"
-#include "code\game\machinery\alarm.dm"
#include "code\game\machinery\atmo_control.dm"
#include "code\game\machinery\autolathe.dm"
#include "code\game\machinery\Beacon.dm"
@@ -758,6 +758,7 @@
#include "code\game\machinery\doorbell_vr.dm"
#include "code\game\machinery\doppler_array.dm"
#include "code\game\machinery\exonet_node.dm"
+#include "code\game\machinery\fire_alarm.dm"
#include "code\game\machinery\flasher.dm"
#include "code\game\machinery\floodlight.dm"
#include "code\game\machinery\floor_light.dm"