diff --git a/_maps/map_files/OmegaStation/OmegaStation.dmm b/_maps/map_files/OmegaStation/OmegaStation.dmm index 9509e69220..1423cc331d 100644 --- a/_maps/map_files/OmegaStation/OmegaStation.dmm +++ b/_maps/map_files/OmegaStation/OmegaStation.dmm @@ -2243,7 +2243,6 @@ req_access = null; req_access_txt = "57" }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden, /obj/effect/turf_decal/stripes/line{ dir = 2 }, @@ -5297,9 +5296,6 @@ icon_state = "0-2" }, /obj/effect/spawner/structure/window/reinforced, -/obj/machinery/atmospherics/pipe/simple/supply/hidden{ - dir = 4 - }, /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ dir = 4 }, @@ -86304,7 +86300,7 @@ ape aqm abt abN -atu +acw abt aad aad diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 45c48726d3..786aff1038 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -14,7 +14,6 @@ anchored = TRUE density = TRUE - var/global/const/CIRC_LEFT = 1 var/global/const/CIRC_RIGHT = 2 @@ -39,8 +38,6 @@ var/transfer_moles = pressure_delta*air1.volume/(air2.temperature * R_IDEAL_GAS_EQUATION) last_pressure_delta = pressure_delta - - //Actually transfer the gas var/datum/gas_mixture/removed = air2.remove(transfer_moles) update_parents() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index 1ef52cc787..15f0ccddd2 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -1,211 +1,207 @@ -/* -Acts like a normal vent, but has an input AND output. -*/ -#define EXT_BOUND 1 -#define INPUT_MIN 2 -#define OUTPUT_MAX 4 - -/obj/machinery/atmospherics/components/binary/dp_vent_pump - icon = 'icons/obj/atmospherics/components/unary_devices.dmi' //We reuse the normal vent icons! - icon_state = "dpvent_map" - - //node2 is output port - //node1 is input port - - name = "dual-port air vent" - desc = "Has a valve and pump attached to it. There are two ports." - - level = 1 - var/frequency = 0 - var/id = null - var/datum/radio_frequency/radio_connection - +/* +Acts like a normal vent, but has an input AND output. +*/ +#define EXT_BOUND 1 +#define INPUT_MIN 2 +#define OUTPUT_MAX 4 + +/obj/machinery/atmospherics/components/binary/dp_vent_pump + icon = 'icons/obj/atmospherics/components/unary_devices.dmi' //We reuse the normal vent icons! + icon_state = "dpvent_map" + + //node2 is output port + //node1 is input port + + name = "dual-port air vent" + desc = "Has a valve and pump attached to it. There are two ports." + + level = 1 + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection + var/on = FALSE - var/pump_direction = 1 //0 = siphoning, 1 = releasing - - var/external_pressure_bound = ONE_ATMOSPHERE - var/input_pressure_min = 0 - var/output_pressure_max = 0 - - var/pressure_checks = EXT_BOUND - //EXT_BOUND: Do not pass external_pressure_bound - //INPUT_MIN: Do not pass input_pressure_min - //OUTPUT_MAX: Do not pass output_pressure_max - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/on - on = TRUE - icon_state = "dpvent_map_on" - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy() + var/pump_direction = 1 //0 = siphoning, 1 = releasing + + var/external_pressure_bound = ONE_ATMOSPHERE + var/input_pressure_min = 0 + var/output_pressure_max = 0 + + var/pressure_checks = EXT_BOUND + //EXT_BOUND: Do not pass external_pressure_bound + //INPUT_MIN: Do not pass input_pressure_min + //OUTPUT_MAX: Do not pass output_pressure_max + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/on + on = TRUE + icon_state = "dpvent_map_on" + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy() SSradio.remove_object(src, frequency) - return ..() - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume - name = "large dual-port air vent" - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on - on = TRUE - icon_state = "dpvent_map_on" - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New() - ..() - var/datum/gas_mixture/air1 = AIR1 - var/datum/gas_mixture/air2 = AIR2 - air1.volume = 1000 - air2.volume = 1000 - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes() - cut_overlays() - if(showpipe) - add_overlay(getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "dpvent_cap")) - - if(!on || stat & (NOPOWER|BROKEN)) - icon_state = "vent_off" - return - - if(pump_direction) - icon_state = "vent_out" - else - icon_state = "vent_in" - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos() - ..() - - if(!on) - return FALSE - var/datum/gas_mixture/air1 = AIR1 - var/datum/gas_mixture/air2 = AIR2 - - var/datum/gas_mixture/environment = loc.return_air() - var/environment_pressure = environment.return_pressure() - - if(pump_direction) //input -> external - var/pressure_delta = 10000 - - if(pressure_checks&EXT_BOUND) - pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) - if(pressure_checks&INPUT_MIN) - pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min)) - - if(pressure_delta > 0) - if(air1.temperature > 0) - var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - //Removed can be null if there is no atmosphere in air1 - if(!removed) - return FALSE - - loc.assume_air(removed) - air_update_turf() - - var/datum/pipeline/parent1 = PARENT1 - parent1.update = 1 - - else //external -> output - var/pressure_delta = 10000 - - if(pressure_checks&EXT_BOUND) - pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) - if(pressure_checks&INPUT_MIN) - pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure())) - - if(pressure_delta > 0) - if(environment.temperature > 0) - var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) - //removed can be null if there is no air in the location - if(!removed) - return FALSE - - air2.merge(removed) - air_update_turf() - - var/datum/pipeline/parent2 = PARENT2 - parent2.update = 1 - - return TRUE - - //Radio remote control - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency) - SSradio.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = SSradio.add_object(src, frequency, filter = GLOB.RADIO_ATMOSIA) - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status() - if(!radio_connection) - return 0 - - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - - signal.data = list( - "tag" = id, - "device" = "ADVP", - "power" = on, - "direction" = pump_direction?("release"):("siphon"), - "checks" = pressure_checks, - "input" = input_pressure_min, - "output" = output_pressure_max, - "external" = external_pressure_bound, - "sigtype" = "status" - ) - radio_connection.post_signal(src, signal, filter = GLOB.RADIO_ATMOSIA) - - return 1 - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit() - ..() - if(frequency) - set_frequency(frequency) - broadcast_status() - -/obj/machinery/atmospherics/components/binary/dp_vent_pump/receive_signal(datum/signal/signal) - - if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 - if("power" in signal.data) - on = text2num(signal.data["power"]) - - if("power_toggle" in signal.data) - on = !on - - if("set_direction" in signal.data) - pump_direction = text2num(signal.data["set_direction"]) - - if("checks" in signal.data) - pressure_checks = text2num(signal.data["checks"]) - - if("purge" in signal.data) - pressure_checks &= ~1 - pump_direction = 0 - - if("stabalize" in signal.data) - pressure_checks |= 1 - pump_direction = 1 - - if("set_input_pressure" in signal.data) - input_pressure_min = Clamp(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50) - - if("set_output_pressure" in signal.data) - output_pressure_max = Clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50) - - if("set_external_pressure" in signal.data) - external_pressure_bound = Clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50) - - if("status" in signal.data) - spawn(2) - broadcast_status() - return //do not update_icon - //if(signal.data["tag"]) - spawn(2) - broadcast_status() - update_icon() - -#undef EXT_BOUND -#undef INPUT_MIN -#undef OUTPUT_MAX + return ..() + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume + name = "large dual-port air vent" + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on + on = TRUE + icon_state = "dpvent_map_on" + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New() + ..() + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 + air1.volume = 1000 + air2.volume = 1000 + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes() + cut_overlays() + if(showpipe) + add_overlay(getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "dpvent_cap")) + + if(!on || !is_operational()) + icon_state = "vent_off" + return + + if(pump_direction) + icon_state = "vent_out" + else + icon_state = "vent_in" + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos() + ..() + + if(!on) + return + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 + + var/datum/gas_mixture/environment = loc.return_air() + var/environment_pressure = environment.return_pressure() + + if(pump_direction) //input -> external + var/pressure_delta = 10000 + + if(pressure_checks&EXT_BOUND) + pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) + if(pressure_checks&INPUT_MIN) + pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min)) + + if(pressure_delta > 0) + if(air1.temperature > 0) + var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) + + var/datum/gas_mixture/removed = air1.remove(transfer_moles) + //Removed can be null if there is no atmosphere in air1 + if(!removed) + return + + loc.assume_air(removed) + air_update_turf() + + var/datum/pipeline/parent1 = PARENT1 + parent1.update = 1 + + else //external -> output + var/pressure_delta = 10000 + + if(pressure_checks&EXT_BOUND) + pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) + if(pressure_checks&INPUT_MIN) + pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure())) + + if(pressure_delta > 0) + if(environment.temperature > 0) + var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) + + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + //removed can be null if there is no air in the location + if(!removed) + return + + air2.merge(removed) + air_update_turf() + + var/datum/pipeline/parent2 = PARENT2 + parent2.update = 1 + + //Radio remote control + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency) + SSradio.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = SSradio.add_object(src, frequency, filter = GLOB.RADIO_ATMOSIA) + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status() + if(!radio_connection) + return + + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.source = src + + signal.data = list( + "tag" = id, + "device" = "ADVP", + "power" = on, + "direction" = pump_direction?("release"):("siphon"), + "checks" = pressure_checks, + "input" = input_pressure_min, + "output" = output_pressure_max, + "external" = external_pressure_bound, + "sigtype" = "status" + ) + radio_connection.post_signal(src, signal, filter = GLOB.RADIO_ATMOSIA) + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit() + ..() + if(frequency) + set_frequency(frequency) + broadcast_status() + +/obj/machinery/atmospherics/components/binary/dp_vent_pump/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return + + if("power" in signal.data) + on = text2num(signal.data["power"]) + + if("power_toggle" in signal.data) + on = !on + + if("set_direction" in signal.data) + pump_direction = text2num(signal.data["set_direction"]) + + if("checks" in signal.data) + pressure_checks = text2num(signal.data["checks"]) + + if("purge" in signal.data) + pressure_checks &= ~1 + pump_direction = 0 + + if("stabalize" in signal.data) + pressure_checks |= 1 + pump_direction = 1 + + if("set_input_pressure" in signal.data) + input_pressure_min = Clamp(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50) + + if("set_output_pressure" in signal.data) + output_pressure_max = Clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50) + + if("set_external_pressure" in signal.data) + external_pressure_bound = Clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50) + + if("status" in signal.data) + spawn(2) + broadcast_status() + return //do not update_icon + //if(signal.data["tag"]) + spawn(2) + broadcast_status() + update_icon() + +#undef EXT_BOUND +#undef INPUT_MIN +#undef OUTPUT_MAX diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index d2e6a3ae72..158c272543 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -12,7 +12,7 @@ Passive gate is similar to the regular pump except: name = "passive gate" desc = "A one-way air valve that does not require power." - can_unwrench = 1 + can_unwrench = TRUE var/on = FALSE var/target_pressure = ONE_ATMOSPHERE @@ -36,7 +36,7 @@ Passive gate is similar to the regular pump except: /obj/machinery/atmospherics/components/binary/passive_gate/process_atmos() ..() if(!on) - return 0 + return var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air2 = AIR2 @@ -47,7 +47,7 @@ Passive gate is similar to the regular pump except: if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10)) //No need to pump gas if target is already reached or input pressure is too low //Need at least 10 KPa difference to overcome friction in the mechanism - return 1 + return //Calculate necessary moles to transfer using PV = nRT if((air1.total_moles() > 0) && (air1.temperature>0)) @@ -73,7 +73,7 @@ Passive gate is similar to the regular pump except: /obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status() if(!radio_connection) - return 0 + return var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -89,8 +89,6 @@ Passive gate is similar to the regular pump except: radio_connection.post_signal(src, signal, filter = GLOB.RADIO_ATMOSIA) - return 1 - /obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) @@ -137,7 +135,7 @@ Passive gate is similar to the regular pump except: /obj/machinery/atmospherics/components/binary/passive_gate/receive_signal(datum/signal/signal) if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 + return var/old_on = on //for logging @@ -159,16 +157,14 @@ Passive gate is similar to the regular pump except: broadcast_status() update_icon() - return /obj/machinery/atmospherics/components/binary/passive_gate/power_change() ..() update_icon() /obj/machinery/atmospherics/components/binary/passive_gate/can_unwrench(mob/user) - if(..()) - if(on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - return 1 + . = ..() + if(. && on) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 0ec1b57a2e..c5242fb5cc 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -17,7 +17,7 @@ Thus, the two variables affect pump operation are set in New(): name = "gas pump" desc = "A pump that moves gas by pressure." - can_unwrench = 1 + can_unwrench = TRUE var/on = FALSE var/target_pressure = ONE_ATMOSPHERE @@ -36,7 +36,7 @@ Thus, the two variables affect pump operation are set in New(): return ..() /obj/machinery/atmospherics/components/binary/pump/update_icon_nopipes() - if(stat & NOPOWER) + if(!is_operational()) icon_state = "pump_off" return @@ -44,10 +44,8 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/components/binary/pump/process_atmos() // ..() - if(stat & (NOPOWER|BROKEN)) - return 0 - if(!on) - return 0 + if(!on || !is_operational()) + return var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air2 = AIR2 @@ -56,7 +54,7 @@ Thus, the two variables affect pump operation are set in New(): if((target_pressure - output_starting_pressure) < 0.01) //No need to pump gas if target is already reached! - return 1 + return //Calculate necessary moles to transfer using PV=nRT if((air1.total_moles() > 0) && (air1.temperature>0)) @@ -69,8 +67,6 @@ Thus, the two variables affect pump operation are set in New(): update_parents() - return 1 - //Radio remote control /obj/machinery/atmospherics/components/binary/pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) @@ -80,7 +76,7 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status() if(!radio_connection) - return 0 + return var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -96,8 +92,6 @@ Thus, the two variables affect pump operation are set in New(): radio_connection.post_signal(src, signal, filter = GLOB.RADIO_ATMOSIA) - return 1 - /obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) @@ -121,8 +115,7 @@ Thus, the two variables affect pump operation are set in New(): if("power") on = !on investigate_log("Pump, [src.name], was turned [on ? "on" : "off"] by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) - message_admins("Pump, [src.name], turned [on ? "on" : "off"] by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] manipulated a pump at [x], [y], [z]") + message_admins("Pump, [src.name], turned [on ? "on" : "off"] by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)], [A]") . = TRUE if("pressure") var/pressure = params["pressure"] @@ -139,8 +132,7 @@ Thus, the two variables affect pump operation are set in New(): if(.) target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("Pump, [src.name], was set to [target_pressure] kPa by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) - message_admins("Pump, [src.name], was set to [target_pressure] kPa by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] manipulated a pump at [x], [y], [z]") + message_admins("Pump, [src.name], was set to [target_pressure] kPa by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)], [A]") update_icon() /obj/machinery/atmospherics/components/binary/pump/atmosinit() @@ -150,7 +142,7 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/components/binary/pump/receive_signal(datum/signal/signal) if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 + return var/old_on = on //for logging @@ -172,21 +164,18 @@ Thus, the two variables affect pump operation are set in New(): broadcast_status() update_icon() - return /obj/machinery/atmospherics/components/binary/pump/power_change() ..() update_icon() /obj/machinery/atmospherics/components/binary/pump/can_unwrench(mob/user) - if(..()) - var/turf/T = get_turf(src) - var/area/A = get_area(src) - if(!(stat & NOPOWER) && on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - investigate_log("Pump, [src.name], was unwrenched by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) - message_admins("Pump, [src.name], was unwrenched by [ADMIN_LOOKUPFLW(user)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] unwrenched a pump at [x], [y], [z]") - return 1 - + . = ..() + var/area/A = get_area(src) + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE + else + investigate_log("Pump, [src.name], was unwrenched by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) + message_admins("Pump, [src.name], was unwrenched by [ADMIN_LOOKUPFLW(user)] at [A]") + return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index bbee3bcb59..7ef6cf2142 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -7,7 +7,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off. name = "manual valve" desc = "A pipe valve" - can_unwrench = 1 + can_unwrench = TRUE var/frequency = 0 var/id = null @@ -57,8 +57,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off. var/turf/T = get_turf(src) var/area/A = get_area(src) investigate_log("Valve, [src.name], was manipiulated by [key_name(usr)] at [x], [y], [z], [A]", "atmos") - message_admins("Valve, [src.name], was manipulated by [ADMIN_LOOKUPFLW(user)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] manipulated a manual valve at [x], [y], [z]") + message_admins("Valve, [src.name], was manipulated by [ADMIN_LOOKUPFLW(user)] at [ADMIN_COORDJMP(T)], [A]") /obj/machinery/atmospherics/components/binary/valve/digital // can be controlled by AI @@ -71,7 +70,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off. return src.attack_hand(user) /obj/machinery/atmospherics/components/binary/valve/digital/update_icon_nopipes(animation) - if(stat & NOPOWER) + if(!is_operational()) normalize_dir() icon_state = "dvalve_nopower" return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 4d3cf733fb..227c34d9ca 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -17,7 +17,7 @@ Thus, the two variables affect pump operation are set in New(): name = "volumetric gas pump" desc = "A pump that moves gas by volume." - can_unwrench = 1 + can_unwrench = TRUE var/on = FALSE var/transfer_rate = MAX_TRANSFER_RATE @@ -34,7 +34,7 @@ Thus, the two variables affect pump operation are set in New(): on = TRUE /obj/machinery/atmospherics/components/binary/volume_pump/update_icon_nopipes() - if(stat & NOPOWER) + if(!is_operational()) icon_state = "volpump_off" return @@ -42,10 +42,8 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/components/binary/volume_pump/process_atmos() // ..() - if(stat & (NOPOWER|BROKEN)) + if(!on || !is_operational()) return - if(!on) - return 0 var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air2 = AIR2 @@ -56,7 +54,7 @@ Thus, the two variables affect pump operation are set in New(): var/output_starting_pressure = air2.return_pressure() if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000)) - return 1 + return var/transfer_ratio = min(1, transfer_rate/air1.volume) @@ -66,8 +64,6 @@ Thus, the two variables affect pump operation are set in New(): update_parents() - return 1 - /obj/machinery/atmospherics/components/binary/volume_pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency @@ -76,7 +72,7 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status() if(!radio_connection) - return 0 + return var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -91,8 +87,6 @@ Thus, the two variables affect pump operation are set in New(): ) radio_connection.post_signal(src, signal) - return 1 - /obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) @@ -116,14 +110,12 @@ Thus, the two variables affect pump operation are set in New(): if(..()) return var/turf/T = get_turf(src) - //var/area/A = get_area(src) + var/area/A = get_area(src) switch(action) if("power") on = !on - investigate_log("Volume Pump, [src.name], was turned [on ? "on" : "off"] by [key_name(usr)] at [x], [y], [z], [loc.loc]", INVESTIGATE_ATMOS) - message_admins("Volume Pump, [src.name], turned [on ? "on" : "off"] by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] manipulated a volume pump at [x], [y], [z]") - + investigate_log("Volume Pump, [src.name], was turned [on ? "on" : "off"] by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) + message_admins("Volume Pump, [src.name], turned [on ? "on" : "off"] by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)], [A]") . = TRUE if("rate") var/rate = params["rate"] @@ -139,14 +131,13 @@ Thus, the two variables affect pump operation are set in New(): . = TRUE if(.) transfer_rate = Clamp(rate, 0, MAX_TRANSFER_RATE) - investigate_log("Volume Pump, [src.name], was set to [transfer_rate] L/s by [key_name(usr)] at [x], [y], [z], [loc.loc]", INVESTIGATE_ATMOS) - message_admins("Volume Pump, [src.name], was set to [transfer_rate] L/s by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] manipulated a volume pump at [x], [y], [z]") + investigate_log("Volume Pump, [src.name], was set to [transfer_rate] L/s by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) + message_admins("Volume Pump, [src.name], was set to [transfer_rate] L/s by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)], [A]") update_icon() /obj/machinery/atmospherics/components/binary/volume_pump/receive_signal(datum/signal/signal) if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 + return var/old_on = on //for logging @@ -169,22 +160,18 @@ Thus, the two variables affect pump operation are set in New(): broadcast_status() update_icon() - return /obj/machinery/atmospherics/components/binary/volume_pump/power_change() ..() update_icon() /obj/machinery/atmospherics/components/binary/volume_pump/can_unwrench(mob/user) - if(..()) - var/turf/T = get_turf(src) - //var/area/A = get_area(src) - if(!(stat & NOPOWER) && on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - investigate_log("Volume Pump, [src.name], was unwrenched by [key_name(usr)] at [x], [y], [z], [loc.loc]", INVESTIGATE_ATMOS) - message_admins("Volume Pump, [src.name], was unwrenched by [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)]") - log_admin("[key_name(usr)] unwrenched a volume pump at [x], [y], [z]") - - return 1 - + . = ..() + var/area/A = get_area(src) + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE + else + investigate_log("Volume Pump, [src.name], was unwrenched by [key_name(usr)] at [x], [y], [z], [A]", INVESTIGATE_ATMOS) + message_admins("Volume Pump, [src.name], was unwrenched by [ADMIN_LOOKUPFLW(usr)] at [A]") + return diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 87edfe8d11..c777e5fe17 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -2,7 +2,7 @@ name = "gas filter" icon_state = "filter_off" density = FALSE - can_unwrench = 1 + can_unwrench = TRUE var/on = FALSE var/target_pressure = ONE_ATMOSPHERE var/filter_type = "" @@ -11,7 +11,7 @@ /obj/machinery/atmospherics/components/trinary/filter/flipped icon_state = "filter_off_f" - flipped = 1 + flipped = TRUE // These two filter types have critical_machine flagged to on and thus causes the area they are in to be exempt from the Grid Check event. @@ -43,27 +43,21 @@ ..() /obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes() - - if(!(stat & NOPOWER) && on && NODE1 && NODE2 && NODE3) + if(on && NODE1 && NODE2 && NODE3 && is_operational()) icon_state = "filter_on[flipped?"_f":""]" return - icon_state = "filter_off[flipped?"_f":""]" /obj/machinery/atmospherics/components/trinary/filter/power_change() var/old_stat = stat ..() - if(stat & NOPOWER) - on = FALSE - if(old_stat != stat) + if(stat != old_stat) update_icon() /obj/machinery/atmospherics/components/trinary/filter/process_atmos() ..() - if(!on) - return 0 - if(!(NODE1 && NODE2 && NODE3)) - return 0 + if(!on || !(NODE1 && NODE2 && NODE3) || !is_operational()) + return var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air2 = AIR2 @@ -73,7 +67,7 @@ if(output_starting_pressure >= target_pressure) //No need to mix if target is already full! - return 1 + return //Calculate necessary moles to transfer using PV=nRT @@ -113,8 +107,6 @@ update_parents() - return 1 - /obj/machinery/atmospherics/components/trinary/filter/atmosinit() set_frequency(frequency) return ..() @@ -167,3 +159,10 @@ investigate_log("was set to filter [filter_name] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE update_icon() + +/obj/machinery/atmospherics/components/trinary/filter/can_unwrench(mob/user) + . = ..() + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE + diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 8c2622bb42..cb515ec75f 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -3,7 +3,7 @@ density = FALSE name = "gas mixer" - can_unwrench = 1 + can_unwrench = TRUE var/on = FALSE @@ -15,7 +15,7 @@ /obj/machinery/atmospherics/components/trinary/mixer/flipped icon_state = "mixer_off_f" - flipped = 1 + flipped = TRUE /obj/machinery/atmospherics/components/trinary/mixer/update_icon() cut_overlays() @@ -29,18 +29,15 @@ return ..() /obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes() - if(!(stat & NOPOWER) && on && NODE1 && NODE2 && NODE3) + if(on && NODE1 && NODE2 && NODE3 && is_operational()) icon_state = "mixer_on[flipped?"_f":""]" return - icon_state = "mixer_off[flipped?"_f":""]" /obj/machinery/atmospherics/components/trinary/mixer/power_change() var/old_stat = stat ..() - if(stat & NOPOWER) - on = FALSE - if(old_stat != stat) + if(stat != old_stat) update_icon() /obj/machinery/atmospherics/components/trinary/mixer/New() @@ -51,10 +48,8 @@ /obj/machinery/atmospherics/components/trinary/mixer/process_atmos() ..() - if(!on) - return 0 - if(!(NODE1 && NODE2 && NODE3)) - return 0 + if(!on || !(NODE1 && NODE2 && NODE3) && !is_operational()) + return var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air2 = AIR2 @@ -64,7 +59,7 @@ if(output_starting_pressure >= target_pressure) //No need to mix if target is already full! - return 1 + return //Calculate necessary moles to transfer using PV=nRT @@ -114,7 +109,7 @@ var/datum/pipeline/parent3 = PARENT3 parent3.update = TRUE - return TRUE + return /obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) @@ -167,4 +162,12 @@ node1_concentration = max(0, min(1, node1_concentration - value)) investigate_log("was set to [node2_concentration] % on node 2 by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE - update_icon() \ No newline at end of file + update_icon() + + +/obj/machinery/atmospherics/components/trinary/filter/can_unwrench(mob/user) + . = ..() + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE + diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm index 199d1907d8..14495cd237 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm @@ -6,7 +6,7 @@ device_type = TRINARY layer = GAS_FILTER_LAYER - var/flipped = 0 + var/flipped = FALSE /obj/machinery/atmospherics/components/trinary/SetInitDirections() switch(dir) @@ -44,4 +44,4 @@ Housekeeping and pipe network stuff node1_connect = turn(node1_connect, 180) node3_connect = turn(node3_connect, 180) - return list(node1_connect, node2_connect, node3_connect) \ No newline at end of file + return list(node1_connect, node2_connect, node3_connect) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 96bd0e8f65..a5052e4632 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -115,7 +115,7 @@ occupant_overlay.dir = SOUTH occupant_overlay.pixel_y = 22 - if(on && is_operational() && !running_bob_anim) + if(on && !running_bob_anim && is_operational()) icon_state = "pod-on" running_bob_anim = TRUE run_bob_anim(TRUE, occupant_overlay) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/generator_input.dm b/code/modules/atmospherics/machinery/components/unary_devices/generator_input.dm index 5ed771d41c..a1a67e2542 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/generator_input.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/generator_input.dm @@ -10,12 +10,7 @@ var/update_cycle /obj/machinery/atmospherics/components/unary/generator_input/update_icon() - if(NODE1) - icon_state = "intact" - else - icon_state = "exposed" - - return + icon_state = NODE1 ? "intact" : "exposed" /obj/machinery/atmospherics/components/unary/generator_input/proc/return_exchange_air() return AIR1 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index 30ff1ebc30..ee6e31175b 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -5,7 +5,7 @@ name = "heat exchanger" desc = "Exchanges heat between two input gases. Setup for fast heat transfer" - can_unwrench = 1 + can_unwrench = TRUE layer = LOW_OBJ_LAYER @@ -20,8 +20,6 @@ else icon_state = "he_exposed" - return - /obj/machinery/atmospherics/components/unary/heat_exchanger/atmosinit() if(!partner) var/partner_connect = turn(dir,180) @@ -36,11 +34,8 @@ /obj/machinery/atmospherics/components/unary/heat_exchanger/process_atmos() ..() - if(!partner) - return 0 - - if(SSair.times_fired <= update_cycle) - return 0 + if(!partner || SSair.times_fired <= update_cycle) + return update_cycle = SSair.times_fired partner.update_cycle = SSair.times_fired @@ -67,5 +62,3 @@ if(abs(other_old_temperature-partner_air_contents.temperature) > 1) partner.update_parents() - - return 1 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 0bf467f234..d46d5b47a0 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -30,7 +30,7 @@ if(showpipe) add_overlay(getpipeimage(icon, "inje_cap", initialize_directions)) - if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || !is_operational()) icon_state = "inje_off" return @@ -47,8 +47,8 @@ ..() injecting = 0 - if(!on || stat & (NOPOWER|BROKEN)) - return 0 + if(!on || !is_operational()) + return var/datum/gas_mixture/air_contents = AIR1 @@ -62,11 +62,9 @@ update_parents() - return 1 - /obj/machinery/atmospherics/components/unary/outlet_injector/proc/inject() - if(on || injecting || stat & (NOPOWER|BROKEN)) - return 0 + if(on || injecting || !is_operational()) + return var/datum/gas_mixture/air_contents = AIR1 @@ -91,7 +89,7 @@ /obj/machinery/atmospherics/components/unary/outlet_injector/proc/broadcast_status() if(!radio_connection) - return 0 + return var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -108,8 +106,6 @@ radio_connection.post_signal(src, signal) - return 1 - /obj/machinery/atmospherics/components/unary/outlet_injector/atmosinit() set_frequency(frequency) broadcast_status() @@ -117,7 +113,7 @@ /obj/machinery/atmospherics/components/unary/outlet_injector/receive_signal(datum/signal/signal) if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 + return if("power" in signal.data) on = text2num(signal.data["power"]) @@ -139,8 +135,6 @@ broadcast_status() return //do not update_icon - //log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") - //return spawn(2) broadcast_status() update_icon() @@ -188,9 +182,8 @@ broadcast_status() /obj/machinery/atmospherics/components/unary/outlet_injector/can_unwrench(mob/user) - if(..()) - if (!(stat & NOPOWER|BROKEN) && on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - return 1 + . = ..() + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE diff --git a/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm b/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm index 65f2c37ac7..e31d1efa96 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm @@ -19,7 +19,7 @@ if(showpipe) add_overlay(getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "scrub_cap", initialize_directions)) //it works for now - if(!NODE1 || !on || stat & BROKEN) + if(!NODE1 || !on || !is_operational()) icon_state = "o2gen_off" return diff --git a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm index 7dd6d62314..e17a2f796c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm @@ -3,7 +3,7 @@ desc = "For connecting portables devices related to atmospherics control." icon = 'icons/obj/atmospherics/components/unary_devices.dmi' icon_state = "connector_map" //Only for mapping purposes, so mappers can see direction - can_unwrench = 1 + can_unwrench = TRUE var/obj/machinery/portable_atmospherics/connected_device use_power = NO_POWER_USE level = 0 @@ -29,11 +29,10 @@ return ..() /obj/machinery/atmospherics/components/unary/portables_connector/can_unwrench(mob/user) - if(..()) - if(connected_device) - to_chat(user, "You cannot unwrench [src], detach [connected_device] first!") - else - return 1 + . = ..() + if(. && connected_device) + to_chat(user, "You cannot unwrench [src], detach [connected_device] first!") + return FALSE /obj/machinery/atmospherics/components/unary/portables_connector/portableConnectorReturnAir() return connected_device.portableConnectorReturnAir() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 6ea8b717bf..17fa3b2cdf 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -39,7 +39,6 @@ icon_state = icon_state_on else icon_state = initial(icon_state) - return /obj/machinery/atmospherics/components/unary/thermomachine/update_icon_nopipes() cut_overlays() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index f52d2d9b2b..df44b4ca9e 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -10,7 +10,7 @@ desc = "Has a valve and pump attached to it." icon_state = "vent_map" use_power = IDLE_POWER_USE - can_unwrench = 1 + can_unwrench = TRUE welded = FALSE level = 1 layer = GAS_SCRUBBER_LAYER @@ -92,7 +92,7 @@ icon_state = "vent_welded" return - if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || !is_operational()) icon_state = "vent_off" return @@ -103,12 +103,12 @@ /obj/machinery/atmospherics/components/unary/vent_pump/process_atmos() ..() - if(stat & (NOPOWER|BROKEN)) + if(!is_operational()) return - if (!NODE1) + if(!NODE1) on = FALSE if(!on || welded) - return 0 + return var/datum/gas_mixture/air_contents = AIR1 var/datum/gas_mixture/environment = loc.return_air() @@ -150,8 +150,6 @@ air_update_turf() update_parents() - return 1 - //Radio remote control /obj/machinery/atmospherics/components/unary/vent_pump/proc/set_frequency(new_frequency) @@ -162,7 +160,7 @@ /obj/machinery/atmospherics/components/unary/vent_pump/proc/broadcast_status() if(!radio_connection) - return 0 + return var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -189,8 +187,6 @@ radio_connection.post_signal(src, signal, radio_filter_out) - return 1 - /obj/machinery/atmospherics/components/unary/vent_pump/atmosinit() //some vents work his own spesial way @@ -202,11 +198,11 @@ ..() /obj/machinery/atmospherics/components/unary/vent_pump/receive_signal(datum/signal/signal) - if(stat & (NOPOWER|BROKEN)) + if(!is_operational()) return //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/components/unary/vent_pump/receive_signal([signal.debug_print()])") if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) - return 0 + return if("purge" in signal.data) pressure_checks &= ~EXT_BOUND @@ -257,7 +253,6 @@ //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") broadcast_status() update_icon() - return /obj/machinery/atmospherics/components/unary/vent_pump/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/weldingtool)) @@ -266,7 +261,8 @@ playsound(loc, WT.usesound, 40, 1) to_chat(user, "You begin welding the vent...") if(do_after(user, 20*W.toolspeed, target = src)) - if(!src || !WT.isOn()) return + if(!src || !WT.isOn()) + return playsound(src.loc, 'sound/items/welder2.ogg', 50, 1) if(!welded) user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.") @@ -282,11 +278,10 @@ return ..() /obj/machinery/atmospherics/components/unary/vent_pump/can_unwrench(mob/user) - if(..()) - if(!(stat & NOPOWER) && on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - return 1 + . = ..() + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE /obj/machinery/atmospherics/components/unary/vent_pump/examine(mob/user) ..() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 095473c32c..d1a010df48 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -8,7 +8,7 @@ use_power = IDLE_POWER_USE idle_power_usage = 10 active_power_usage = 60 - can_unwrench = 1 + can_unwrench = TRUE welded = FALSE level = 1 layer = GAS_SCRUBBER_LAYER @@ -17,12 +17,12 @@ var/on = FALSE var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing - var/scrub_CO2 = 1 - var/scrub_Toxins = 0 - var/scrub_N2O = 0 - var/scrub_BZ = 0 - var/scrub_Freon = 0 - var/scrub_WaterVapor = 0 + var/scrub_CO2 = TRUE + var/scrub_Toxins = FALSE + var/scrub_N2O = FALSE + var/scrub_BZ = FALSE + var/scrub_Freon = FALSE + var/scrub_WaterVapor = FALSE var/volume_rate = 200 @@ -58,12 +58,8 @@ return ..() /obj/machinery/atmospherics/components/unary/vent_scrubber/auto_use_power() - if(!powered(power_channel)) - return 0 - if(!on || welded) - return 0 - if(stat & (NOPOWER|BROKEN)) - return 0 + if(!on || welded || !is_operational() || !powered(power_channel)) + return FALSE var/amount = idle_power_usage @@ -86,7 +82,7 @@ if(widenet) amount += amount * (adjacent_turfs.len * (adjacent_turfs.len / 2)) use_power(amount, power_channel) - return 1 + return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/update_icon_nopipes() cut_overlays() @@ -97,7 +93,7 @@ icon_state = "scrub_welded" return - if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || !is_operational()) icon_state = "scrub_off" return @@ -113,7 +109,7 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/broadcast_status() if(!radio_connection) - return 0 + return FALSE var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -143,7 +139,7 @@ radio_connection.post_signal(src, signal, radio_filter_out) - return 1 + return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/atmosinit() radio_filter_in = frequency==initial(frequency)?(GLOB.RADIO_FROM_AIRALARM):null @@ -156,20 +152,21 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos() ..() - if(stat & (NOPOWER|BROKEN)) - return - if (!NODE1) + if(!is_operational()) + return FALSE + if(!NODE1) on = FALSE if(!on || welded) - return 0 + return FALSE scrub(loc) if(widenet) - for (var/turf/tile in adjacent_turfs) + for(var/turf/tile in adjacent_turfs) scrub(tile) + return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/tile) - if (!istype(tile)) - return 0 + if(!istype(tile)) + return FALSE var/datum/gas_mixture/environment = tile.return_air() var/datum/gas_mixture/air_contents = AIR1 @@ -189,8 +186,8 @@ //Take a gas sample var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) //Nothing left to remove from the tile - if (isnull(removed)) - return + if(isnull(removed)) + return FALSE var/list/removed_gases = removed.gases //Filter it @@ -242,8 +239,8 @@ tile.air_update_turf() else //Just siphoning all air - if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) - return + if(air_contents.return_pressure()>=50*ONE_ATMOSPHERE) + return FALSE var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) @@ -254,7 +251,7 @@ update_parents() - return 1 + return TRUE //There is no easy way for an object to be notified of changes to atmos can pass flags_1 @@ -273,7 +270,7 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal) - if(stat & (NOPOWER|BROKEN)) + if(!is_operational()) return if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 @@ -363,11 +360,10 @@ return ..() /obj/machinery/atmospherics/components/unary/vent_scrubber/can_unwrench(mob/user) - if(..()) - if (!(stat & NOPOWER) && on) - to_chat(user, "You cannot unwrench [src], turn it off first!") - else - return 1 + . = ..() + if(. && on && is_operational()) + to_chat(user, "You cannot unwrench [src], turn it off first!") + return FALSE /obj/machinery/atmospherics/components/unary/vent_scrubber/can_crawl_through() return !welded