diff --git a/baystation12.dme b/baystation12.dme index df06cf606bc..9423cef1e0d 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -48,6 +48,7 @@ #include "code\_onclick\hud\other_mobs.dm" #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" +#include "code\ATMOSPHERICS\_atmos_setup.dm" #include "code\ATMOSPHERICS\atmospherics.dm" #include "code\ATMOSPHERICS\datum_pipe_network.dm" #include "code\ATMOSPHERICS\datum_pipeline.dm" @@ -746,6 +747,7 @@ #include "code\modules\client\client defines.dm" #include "code\modules\client\client procs.dm" #include "code\modules\client\preferences.dm" +#include "code\modules\client\preferences_gear.dm" #include "code\modules\client\preferences_savefile.dm" #include "code\modules\client\preferences_spawnpoints.dm" #include "code\modules\client\preferences_toggles.dm" diff --git a/code/ATMOSPHERICS/_atmos_setup.dm b/code/ATMOSPHERICS/_atmos_setup.dm new file mode 100644 index 00000000000..a34d372c59c --- /dev/null +++ b/code/ATMOSPHERICS/_atmos_setup.dm @@ -0,0 +1,200 @@ +//-------------------------------------------- +// Pipe colors +// +// Add them here and to the pipe_colors list +// to automatically add them to all relevant +// atmospherics devices. +//-------------------------------------------- + +#define PIPE_COLOR_GREY "#ffffff" //yes white is grey +#define PIPE_COLOR_RED "#ff0000" +#define PIPE_COLOR_BLUE "#0000ff" +#define PIPE_COLOR_CYAN "#00ffff" +#define PIPE_COLOR_GREEN "#00ff00" +#define PIPE_COLOR_YELLOW "#ffcc00" +#define PIPE_COLOR_PURPLE "#5c1ec0" + +var/global/list/pipe_colors = list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE) + +/proc/pipe_color_lookup(var/color) + for(var/C in pipe_colors) + if(color == pipe_colors[C]) + return "[C]" + +/proc/pipe_color_check(var/color) + for(var/C in pipe_colors) + if(color == pipe_colors[C]) + return 1 + return 0 + +//-------------------------------------------- +// Icon cache generation +//-------------------------------------------- + +/datum/pipe_icon_manager + var/list/pipe_icons[] + var/list/manifold_icons[] + var/list/device_icons[] + var/list/underlays_down[] + var/list/underlays_exposed[] + var/list/underlays_intact[] + var/list/pipe_underlays_exposed[] + var/list/pipe_underlays_intact[] + var/list/omni_icons[] + +/datum/pipe_icon_manager/New() + check_icons() + +/datum/pipe_icon_manager/proc/get_atmos_icon(var/device, var/dir, var/color, var/state) + check_icons() + + device = "[device]" + state = "[state]" + color = "[color]" + dir = "[dir]" + + switch(device) + if("pipe") + return pipe_icons[state + color] + if("manifold") + return manifold_icons[state + color] + if("device") + return device_icons[state] + if("omni") + return omni_icons[state] + if("underlay_intact") + return underlays_intact[dir + color] + if("underlay_exposed") + return underlays_exposed[dir + color] + if("underlay_down") + return underlays_down[dir + color] + if("pipe_underlay_exposed") + return pipe_underlays_exposed[dir + color] + if("pipe_underlay_intact") + return pipe_underlays_intact[dir + color] + +/datum/pipe_icon_manager/proc/check_icons() + if(!pipe_icons) + gen_pipe_icons() + if(!manifold_icons) + gen_manifold_icons() + if(!device_icons) + gen_device_icons() + if(!omni_icons) + gen_omni_icons() + if(!underlays_intact || !underlays_down || !underlays_exposed || !pipe_underlays_exposed || !pipe_underlays_intact) + gen_underlay_icons() + +/datum/pipe_icon_manager/proc/gen_pipe_icons() + if(!pipe_icons) + pipe_icons = new() + + var/icon/pipe = new('icons/atmos/pipes.dmi') + + for(var/state in pipe.IconStates()) + if(!state || findtext(state, "map")) + continue + + var/cache_name = state + var/image/I = image('icons/atmos/pipes.dmi', icon_state = state) + pipe_icons[cache_name] = I + + for(var/pipe_color in pipe_colors) + I = image('icons/atmos/pipes.dmi', icon_state = state) + I.color = pipe_colors[pipe_color] + pipe_icons[state + "[pipe_colors[pipe_color]]"] = I + +/datum/pipe_icon_manager/proc/gen_manifold_icons() + if(!manifold_icons) + manifold_icons = new() + + var/icon/pipe = new('icons/atmos/manifold.dmi') + + for(var/state in pipe.IconStates()) + if(findtext(state, "clamps")) + var/image/I = image('icons/atmos/manifold.dmi', icon_state = state) + manifold_icons[state] = I + continue + + if(state == "core" || state == "4way") + var/image/I = image('icons/atmos/manifold.dmi', icon_state = state) + manifold_icons[state] = I + for(var/pipe_color in pipe_colors) + I = image('icons/atmos/manifold.dmi', icon_state = state) + I.color = pipe_colors[pipe_color] + manifold_icons[state + pipe_colors[pipe_color]] = I + +/datum/pipe_icon_manager/proc/gen_device_icons() + if(!device_icons) + device_icons = new() + + var/icon/device + + device = new('icons/atmos/vent_pump.dmi') + for(var/state in device.IconStates()) + if(!state || findtext(state, "map")) + continue + device_icons["vent" + state] = image('icons/atmos/vent_pump.dmi', icon_state = state) + + device = new('icons/atmos/vent_scrubber.dmi') + for(var/state in device.IconStates()) + if(!state || findtext(state, "map")) + continue + device_icons["scrubber" + state] = image('icons/atmos/vent_scrubber.dmi', icon_state = state) + +/datum/pipe_icon_manager/proc/gen_omni_icons() + if(!omni_icons) + omni_icons = new() + + var/icon/omni = new('icons/atmos/omni_devices.dmi') + + for(var/state in omni.IconStates()) + if(!state || findtext(state, "map")) + continue + omni_icons[state] = image('icons/atmos/omni_devices.dmi', icon_state = state) + +/datum/pipe_icon_manager/proc/gen_underlay_icons() + if(!underlays_intact) + underlays_intact = new() + if(!underlays_exposed) + underlays_exposed = new() + if(!underlays_down) + underlays_down = new() + if(!pipe_underlays_exposed) + pipe_underlays_exposed = new() + if(!pipe_underlays_intact) + pipe_underlays_intact = new() + + var/icon/pipe = new('icons/atmos/pipe_underlays.dmi') + + for(var/state in pipe.IconStates()) + if(state == "") + continue + + for(var/D in cardinal) + var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D) + switch(state) + if("intact") + underlays_intact["[D]"] = I + if("exposed") + underlays_exposed["[D]"] = I + if("down") + underlays_down["[D]"] = I + if("pipe_exposed") + pipe_underlays_exposed["[D]"] = I + if("pipe_intact") + pipe_underlays_intact["[D]"] = I + for(var/pipe_color in pipe_colors) + I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D) + I.color = pipe_colors[pipe_color] + switch(state) + if("intact") + underlays_intact["[D]" + pipe_colors[pipe_color]] = I + if("exposed") + underlays_exposed["[D]" + pipe_colors[pipe_color]] = I + if("down") + underlays_down["[D]" + pipe_colors[pipe_color]] = I + if("pipe_exposed") + pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I + if("pipe_intact") + pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I \ No newline at end of file diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 1b89db43be1..d652aed9d95 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -10,48 +10,96 @@ Pipelines + Other Objects -> Pipe network */ -obj/machinery/atmospherics +/obj/machinery/atmospherics anchored = 1 idle_power_usage = 0 active_power_usage = 0 power_channel = ENVIRON var/nodealert = 0 + var/initialize_directions = 0 + var/pipe_color + + var/global/datum/pipe_icon_manager/icon_manager +/obj/machinery/atmospherics/New() + if(!icon_manager) + icon_manager = new() + + if(!pipe_color) + pipe_color = color + color = null + + if(!pipe_color_check(pipe_color)) + pipe_color = null + ..() -obj/machinery/atmospherics/var/initialize_directions = 0 -obj/machinery/atmospherics/var/pipe_color +/obj/machinery/atmospherics/attackby(atom/A, mob/user as mob) + if(istype(A, /obj/item/device/pipe_painter)) + return + ..() -obj/machinery/atmospherics/process() +/obj/machinery/atmospherics/proc/add_underlay(var/turf/T, var/obj/machinery/atmospherics/node, var/direction) + if(node) + if(T.intact && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe)) + underlays += icon_manager.get_atmos_icon("underlay_down", direction, color_cache_name(node)) + else + underlays += icon_manager.get_atmos_icon("underlay_intact", direction, color_cache_name(node)) + else + underlays += icon_manager.get_atmos_icon("underlay_exposed", direction, pipe_color) + +/obj/machinery/atmospherics/proc/update_underlays() + if(check_icon_cache()) + return 1 + else + return 0 + +/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0) + if(!istype(icon_manager)) + if(!safety) //to prevent infinite loops + icon_manager = new() + check_icon_cache(1) + return 0 + + return 1 + +/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node) + //Don't use this for standard pipes + if(!istype(node)) + return null + + return node.pipe_color + +/obj/machinery/atmospherics/process() build_network() -obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) +/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) // Check to see if should be added to network. Add self if so and adjust variables appropriately. // Note don't forget to have neighbors look as well! return null -obj/machinery/atmospherics/proc/build_network() +/obj/machinery/atmospherics/proc/build_network() // Called to build a network from this node return null -obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference) // Returns pipe_network associated with connection to reference // Notes: should create network if necessary // Should never return null return null -obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) +/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) // Used when two pipe_networks are combining -obj/machinery/atmospherics/proc/return_network_air(datum/network/reference) +/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference) // Return a list of gas_mixture(s) in the object // associated with reference pipe_network for use in rebuilding the networks gases list // Is permitted to return null -obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) -obj/machinery/atmospherics/update_icon() +/obj/machinery/atmospherics/update_icon() return null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index 9d2a8e32e8a..52f57b29582 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -76,6 +76,7 @@ obj/machinery/atmospherics/binary break update_icon() + update_underlays() build_network() if(!network1 && node1) @@ -127,4 +128,7 @@ obj/machinery/atmospherics/binary del(network2) node2 = null + update_icon() + update_underlays() + return null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index ac451871dc2..6a21d08245b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -1,6 +1,6 @@ /obj/machinery/atmospherics/binary/dp_vent_pump - icon = 'icons/obj/atmospherics/dp_vent_pump.dmi' - icon_state = "off" + icon = 'icons/atmos/vent_pump.dmi' + icon_state = "map_dp_vent" //node2 is output port //node1 is input port @@ -10,15 +10,6 @@ level = 1 - high_volume - name = "Large Dual Port Air Vent" - - New() - ..() - - air1.volume = 1000 - air2.volume = 1000 - var/on = 0 var/pump_direction = 1 //0 = siphoning, 1 = releasing @@ -26,174 +17,199 @@ var/input_pressure_min = 0 var/output_pressure_max = 0 + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection + var/pressure_checks = 1 //1: Do not pass external_pressure_bound //2: Do not pass input_pressure_min //4: Do not pass output_pressure_max +/obj/machinery/atmospherics/binary/dp_vent_pump/New() + ..() + icon = null + +/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume + name = "Large Dual Port Air Vent" + +/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New() + ..() + air1.volume = 1000 + air2.volume = 1000 + +/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0) + if(!check_icon_cache()) + return + + overlays.Cut() + + var/vent_icon = "vent" + + var/turf/T = get_turf(src) + if(!istype(T)) + return + + if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe)) + vent_icon += "h" + + if(!powered()) + vent_icon += "off" + else + vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]" + + overlays += icon_manager.get_atmos_icon("device", , , vent_icon) + +/obj/machinery/atmospherics/binary/dp_vent_pump/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe)) + return + else + add_underlay(T, node1, turn(dir, -180)) + add_underlay(T, node2, dir) + +/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i) update_icon() - if(on) - if(pump_direction) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - on = 0 + update_underlays() - return +/obj/machinery/atmospherics/binary/dp_vent_pump/process() + ..() - hide(var/i) //to make the little pipe section invisible, the icon changes. - if(on) - if(pump_direction) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - on = 0 - return + if(!on) + return 0 - process() - ..() + var/datum/gas_mixture/environment = loc.return_air() + var/environment_pressure = environment.return_pressure() - if(!on) - return 0 + if(pump_direction) //input -> external + var/pressure_delta = 10000 - var/datum/gas_mixture/environment = loc.return_air() - var/environment_pressure = environment.return_pressure() + if(pressure_checks&1) + pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) + if(pressure_checks&2) + pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min)) - if(pump_direction) //input -> external - var/pressure_delta = 10000 + if(pressure_delta > 0) + if(air1.temperature > 0) + var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) - if(pressure_checks&1) - pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) - if(pressure_checks&2) - pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min)) + var/datum/gas_mixture/removed = air1.remove(transfer_moles) - if(pressure_delta > 0) - if(air1.temperature > 0) - var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) + loc.assume_air(removed) - var/datum/gas_mixture/removed = air1.remove(transfer_moles) + if(network1) + network1.update = 1 - loc.assume_air(removed) + else //external -> output + var/pressure_delta = 10000 - if(network1) - network1.update = 1 + if(pressure_checks&1) + pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) + if(pressure_checks&4) + pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure())) - else //external -> output - var/pressure_delta = 10000 + if(pressure_delta > 0) + if(environment.temperature > 0) + var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) - if(pressure_checks&1) - pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) - if(pressure_checks&4) - pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure())) + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) - if(pressure_delta > 0) - if(environment.temperature > 0) - var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) + air2.merge(removed) - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if(network2) + network2.update = 1 - air2.merge(removed) - - if(network2) - network2.update = 1 - - return 1 + return 1 //Radio remote control - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) +/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) - broadcast_status() - if(!radio_connection) - return 0 +/obj/machinery/atmospherics/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 + 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 = RADIO_ATMOSIA) + 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 = RADIO_ATMOSIA) - return 1 + return 1 - var/frequency = 0 - var/id = null - var/datum/radio_frequency/radio_connection +/obj/machinery/atmospherics/binary/dp_vent_pump/initialize() + ..() + if(frequency) + set_frequency(frequency) - initialize() - ..() - if(frequency) - set_frequency(frequency) +/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return 0 + if(signal.data["power"]) + on = text2num(signal.data["power"]) - receive_signal(datum/signal/signal) + if(signal.data["power_toggle"]) + on = !on - 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(signal.data["direction"]) + pump_direction = text2num(signal.data["direction"]) - if("power_toggle" in signal.data) - on = !on + if(signal.data["checks"]) + pressure_checks = text2num(signal.data["checks"]) - if("direction" in signal.data) - pump_direction = text2num(signal.data["direction"]) + if(signal.data["purge"]) + pressure_checks &= ~1 + pump_direction = 0 - if("checks" in signal.data) - pressure_checks = text2num(signal.data["checks"]) + if(signal.data["stabalize"]) + pressure_checks |= 1 + pump_direction = 1 - if("purge" in signal.data) - pressure_checks &= ~1 - pump_direction = 0 + if(signal.data["set_input_pressure"]) + input_pressure_min = between( + 0, + text2num(signal.data["set_input_pressure"]), + ONE_ATMOSPHERE*50 + ) - if("stabalize" in signal.data) - pressure_checks |= 1 - pump_direction = 1 + if(signal.data["set_output_pressure"]) + output_pressure_max = between( + 0, + text2num(signal.data["set_output_pressure"]), + ONE_ATMOSPHERE*50 + ) - if("set_input_pressure" in signal.data) - input_pressure_min = between( - 0, - text2num(signal.data["set_input_pressure"]), - ONE_ATMOSPHERE*50 - ) + if(signal.data["set_external_pressure"]) + external_pressure_bound = between( + 0, + text2num(signal.data["set_external_pressure"]), + ONE_ATMOSPHERE*50 + ) - if("set_output_pressure" in signal.data) - output_pressure_max = between( - 0, - text2num(signal.data["set_output_pressure"]), - ONE_ATMOSPHERE*50 - ) - - if("set_external_pressure" in signal.data) - external_pressure_bound = between( - 0, - text2num(signal.data["set_external_pressure"]), - ONE_ATMOSPHERE*50 - ) - - if("status" in signal.data) - spawn(2) - broadcast_status() - return //do not update_icon - //if(signal.data["tag"]) + if(signal.data["status"]) spawn(2) broadcast_status() - update_icon() \ No newline at end of file + return //do not update_icon + + spawn(2) + broadcast_status() + update_icon() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index a126928e2da..4766883a645 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -1,8 +1,9 @@ -obj/machinery/atmospherics/binary/passive_gate +/obj/machinery/atmospherics/binary/passive_gate //Tries to achieve target pressure at output (like a normal pump) except // Uses no power but can not transfer gases from a low pressure area to a high pressure area - icon = 'icons/obj/atmospherics/passive_gate.dmi' - icon_state = "intact_off" + icon = 'icons/atmos/passive_gate.dmi' + icon_state = "map" + level = 1 name = "Passive gate" desc = "A one-way air valve that does not require power" @@ -14,175 +15,161 @@ obj/machinery/atmospherics/binary/passive_gate var/id = null var/datum/radio_frequency/radio_connection - update_icon() - if(stat & NOPOWER) - icon_state = "intact_off" - else if(node1 && node2) - icon_state = "intact_[on?("on"):("off")]" - else - if(node1) - icon_state = "exposed_1_off" - else if(node2) - icon_state = "exposed_2_off" - else - icon_state = "exposed_3_off" - return +/obj/machinery/atmospherics/binary/passive_gate/update_icon() + icon_state = "[on ? "on" : "off"]" - process() - ..() - if(!on) - return 0 +/obj/machinery/atmospherics/binary/passive_gate/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + add_underlay(T, node1, turn(dir, 180)) + add_underlay(T, node2, dir) - var/output_starting_pressure = air2.return_pressure() - var/input_starting_pressure = air1.return_pressure() +/obj/machinery/atmospherics/binary/passive_gate/hide(var/i) + update_underlays() - 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 +/obj/machinery/atmospherics/binary/passive_gate/process() + ..() + if(!on) + return 0 - //Calculate necessary moles to transfer using PV = nRT - if((air1.total_moles() > 0) && (air1.temperature>0)) - var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2) - //Can not have a pressure delta that would cause output_pressure > input_pressure + var/output_starting_pressure = air2.return_pressure() + var/input_starting_pressure = air1.return_pressure() - var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) + 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 - //Actually transfer the gas - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - air2.merge(removed) + //Calculate necessary moles to transfer using PV = nRT + if((air1.total_moles() > 0) && (air1.temperature>0)) + var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2) + //Can not have a pressure delta that would cause output_pressure > input_pressure - if(network1) - network1.update = 1 + var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) - if(network2) - network2.update = 1 + //Actually transfer the gas + var/datum/gas_mixture/removed = air1.remove(transfer_moles) + air2.merge(removed) + if(network1) + network1.update = 1 - //Radio remote control + if(network2) + network2.update = 1 - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) +//Radio remote control - broadcast_status() - if(!radio_connection) - return 0 +/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src +/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status() + if(!radio_connection) + return 0 - signal.data = list( - "tag" = id, - "device" = "AGP", - "power" = on, - "target_output" = target_pressure, - "sigtype" = "status" - ) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.source = src - radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) + signal.data = list( + "tag" = id, + "device" = "AGP", + "power" = on, + "target_output" = target_pressure, + "sigtype" = "status" + ) - return 1 + radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) - interact(mob/user as mob) - var/dat = {"Power: [on?"On":"Off"]
- Desirable output pressure: - [round(target_pressure,0.1)]kPa | Change - "} + return 1 - user << browse("[src.name] control[dat]", "window=atmo_pump") - onclose(user, "atmo_pump") +/obj/machinery/atmospherics/binary/passive_gate/interact(mob/user as mob) + var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure: + [round(target_pressure,0.1)]kPa | Change + "} - initialize() - ..() - if(frequency) - set_frequency(frequency) + user << browse("[src.name] control[dat]", "window=atmo_pump") + onclose(user, "atmo_pump") - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 +/obj/machinery/atmospherics/binary/passive_gate/initialize() + ..() + if(frequency) + set_frequency(frequency) - if("power" in signal.data) - on = text2num(signal.data["power"]) +/obj/machinery/atmospherics/binary/passive_gate/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return 0 - if("power_toggle" in signal.data) - on = !on + if("power" in signal.data) + on = text2num(signal.data["power"]) - if("set_output_pressure" in signal.data) - target_pressure = between( - 0, - text2num(signal.data["set_output_pressure"]), - ONE_ATMOSPHERE*50 - ) + if("power_toggle" in signal.data) + on = !on - if("status" in signal.data) - spawn(2) - broadcast_status() - return //do not update_icon + if("set_output_pressure" in signal.data) + target_pressure = between( + 0, + text2num(signal.data["set_output_pressure"]), + ONE_ATMOSPHERE*50 + ) + if("status" in signal.data) spawn(2) broadcast_status() - update_icon() + return //do not update_icon + + spawn(2) + broadcast_status() + update_icon() + return + +/obj/machinery/atmospherics/binary/passive_gate/attack_hand(user as mob) + if(..()) return - - - - attack_hand(user as mob) - if(..()) - return - src.add_fingerprint(usr) - if(!src.allowed(user)) - user << "\red Access denied." - return - usr.set_machine(src) - interact(user) + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." return + usr.set_machine(src) + interact(user) + return - Topic(href,href_list) - if(..()) return - if(href_list["power"]) - on = !on - if(href_list["set_press"]) - var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num - src.target_pressure = max(0, min(4500, new_pressure)) - usr.set_machine(src) - src.update_icon() - src.updateUsrDialog() - return - - power_change() - ..() - update_icon() - - - - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (on) - user << "\red You cannot unwrench this [src], turn it off first." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) +/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list) + if(..()) return + if(href_list["power"]) + on = !on + if(href_list["set_press"]) + var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num + src.target_pressure = max(0, min(4500, new_pressure)) + usr.set_machine(src) + src.update_icon() + src.updateUsrDialog() + return +/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index f056b2b690b..4584b25d8b5 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -12,9 +12,10 @@ Thus, the two variables affect pump operation are set in New(): but overall network volume is also increased as this increases... */ -obj/machinery/atmospherics/binary/pump - icon = 'icons/obj/atmospherics/pump.dmi' - icon_state = "intact_off" +/obj/machinery/atmospherics/binary/pump + icon = 'icons/atmos/pump.dmi' + icon_state = "map" + level = 1 name = "Gas pump" desc = "A pump" @@ -25,7 +26,7 @@ obj/machinery/atmospherics/binary/pump //var/max_volume_transfer = 10000 use_power = 1 - idle_power_usage = 10 //10 W for internal circuitry and stuff + idle_power_usage = 150 //internal circuitry, friction losses and stuff active_power_usage = 7500 //This also doubles as a measure of how powerful the pump is, in Watts. 7500 W ~ 10 HP var/last_power_draw = 0 //for UI var/max_pressure_setting = 9000 //kPa @@ -34,274 +35,264 @@ obj/machinery/atmospherics/binary/pump var/id = null var/datum/radio_frequency/radio_connection - highcap - name = "High capacity gas pump" - desc = "A high capacity pump" +/obj/machinery/atmospherics/binary/pump/highcap + name = "High capacity gas pump" + desc = "A high capacity pump" + + target_pressure = 15000000 //15 GPa? Really? + active_power_usage = 112500 //150 Horsepower - target_pressure = 15000000 //15 GPa? Really? - active_power_usage = 112500 //150 Horsepower +/obj/machinery/atmospherics/binary/pump/on + on = 1 - on - on = 1 - icon_state = "intact_on" +/obj/machinery/atmospherics/binary/pump/update_icon() + if(!powered()) + icon_state = "off" + else + icon_state = "[on ? "on" : "off"]" - update_icon() - if(stat & NOPOWER) - icon_state = "intact_off" - else if(node1 && node2) - icon_state = "intact_[on?("on"):("off")]" - else - if(node1) - icon_state = "exposed_1_off" - else if(node2) - icon_state = "exposed_2_off" - else - icon_state = "exposed_3_off" - return - - process() -// ..() - if(stat & (NOPOWER|BROKEN)) +/obj/machinery/atmospherics/binary/pump/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) return - if(!on) - return 0 + add_underlay(T, node1, turn(dir, -180)) + add_underlay(T, node2, dir) - var/output_starting_pressure = air2.return_pressure() - if( (target_pressure - output_starting_pressure) < 0.01) //No need to pump gas if target is already reached! - update_power_usage(0) - return 1 - - var/output_volume = air2.volume - if (network2 && network2.air_transient) - output_volume = network2.air_transient.volume //note that the amount of gas in the adjacent pipe will still limit what we can transfer +/obj/machinery/atmospherics/binary/pump/hide(var/i) + update_underlays() - //This is pointless since gas_mixure/remove() won't let as remove more than is in the adjacent pipe anyways and removing gas directly from the network is not going to work. - //output_volume = min(output_volume, max_volume_transfer) - - //Calculate necessary moles to transfer using PV=nRT - if((air1.total_moles() > 0) && (air1.temperature > 0 || air2.temperature > 0)) - var/air_temperature = (air2.temperature > 0)? air2.temperature : air1.temperature - var/pressure_delta = target_pressure - output_starting_pressure - var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION) //The number of moles that would have to be transfered to bring air2 to the target pressure - - //estimate the amount of energy required - var/specific_entropy = air2.specific_entropy() - air1.specific_entropy() //air2 is gaining moles, air1 is loosing - var/specific_power = 0 // W/mol - - //src.visible_message("DEBUG: [src] >>> terminal pressures: sink = [air2.return_pressure()] kPa, source = [air1.return_pressure()] kPa") - //src.visible_message("DEBUG: [src] >>> specific entropy = [air2.specific_entropy()] - [air1.specific_entropy()] = [specific_entropy] J/K") - - //if specific_entropy >= 0 then gas just flows naturally and we are not limited by how powerful the pump is. - if (specific_entropy < 0) - specific_power = -specific_entropy*air_temperature //how much power we need per mole - - //src.visible_message("DEBUG: [src] >>> limiting transfer_moles to [active_power_usage / specific_power] mol") - transfer_moles = min(transfer_moles, active_power_usage / specific_power) - - //Actually transfer the gas - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - air2.merge(removed) - - //src.visible_message("DEBUG: [src] >>> entropy_change = [specific_entropy*transfer_moles] J/K") - - //if specific_entropy >= 0 then gas is flowing naturally and we don't need to use extra power - if (specific_entropy < 0) - //pump draws power and heats gas according to 2nd law of thermodynamics - var/power_draw = round(transfer_moles*specific_power) - air2.add_thermal_energy(power_draw) - update_power_usage(power_draw) - //src.visible_message("DEBUG: [src] >>> drawing [power_draw] W of power.") - else - update_power_usage(0) - - if(network1) - network1.update = 1 - - if(network2) - network2.update = 1 +/obj/machinery/atmospherics/binary/pump/process() +// ..() + if(stat & (NOPOWER|BROKEN)) + return + if(!on) + return 0 + var/output_starting_pressure = air2.return_pressure() + if( (target_pressure - output_starting_pressure) < 0.01) //No need to pump gas if target is already reached! + update_power_usage(0) return 1 + + var/output_volume = air2.volume + if (network2 && network2.air_transient) + output_volume = network2.air_transient.volume //note that the amount of gas in the adjacent pipe will still limit what we can transfer - //Radio remote control - - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) - - 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" = "AGP", - "power" = on, - "target_output" = target_pressure, - "sigtype" = "status" - ) - - radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) - - return 1 + //This is pointless since gas_mixure/remove() won't let as remove more than is in the adjacent pipe anyways and removing gas directly from the network is not going to work. + //output_volume = min(output_volume, max_volume_transfer) + + //Calculate necessary moles to transfer using PV=nRT + if((air1.total_moles() > 0) && (air1.temperature > 0 || air2.temperature > 0)) + var/air_temperature = (air2.temperature > 0)? air2.temperature : air1.temperature + var/pressure_delta = target_pressure - output_starting_pressure + var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION) //The number of moles that would have to be transfered to bring air2 to the target pressure - //this proc handles power usages so that we only have to call use_power() when the pump is loaded but not at full load. - update_power_usage(var/usage_amount) - if (usage_amount > active_power_usage - 5) - if (use_power < 2) - update_use_power(2) - else - if (use_power >= 2) - update_use_power(1) - - if (usage_amount > idle_power_usage) - use_power(usage_amount) - - last_power_draw = usage_amount - if (use_power > 0) - last_power_draw = max(last_power_draw, idle_power_usage) + //estimate the amount of energy required + var/specific_entropy = air2.specific_entropy() - air1.specific_entropy() //air2 is gaining moles, air1 is loosing + var/specific_power = 0 // W/mol - turn_on() - on = 1 + //if specific_entropy >= 0 then gas just flows naturally and we are not limited by how powerful the pump is. + if (specific_entropy < 0) + specific_power = -specific_entropy*air_temperature //how much power we need per mole + transfer_moles = min(transfer_moles, active_power_usage / specific_power) + + //Actually transfer the gas + var/datum/gas_mixture/removed = air1.remove(transfer_moles) + air2.merge(removed) + + //if specific_entropy >= 0 then gas is flowing naturally and we don't need to use extra power + if (specific_entropy < 0) + //pump draws power and heats gas according to 2nd law of thermodynamics + var/power_draw = round(transfer_moles*specific_power) + air2.add_thermal_energy(power_draw) + update_power_usage(power_draw) + else + update_power_usage(0) + + if(network1) + network1.update = 1 + + if(network2) + network2.update = 1 + + return 1 + +//Radio remote control + +/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) + +/obj/machinery/atmospherics/binary/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" = "AGP", + "power" = on, + "target_output" = target_pressure, + "sigtype" = "status" + ) + + radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) + + return 1 + + +//this proc handles power usages so that we only have to call use_power() when the pump is loaded but not at full load. +/obj/machinery/atmospherics/binary/proc/update_power_usage(var/usage_amount) + if (usage_amount > active_power_usage - 5) + if (use_power < 2) + update_use_power(2) + else + if (use_power >= 2) update_use_power(1) - turn_off() - on = 0 - last_power_draw = 0 - update_use_power(0) - - ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) + if (usage_amount > idle_power_usage) + use_power(usage_amount) //in practice it's pretty rare that we will get here, so calling use_power() is alright. - if(stat & (BROKEN|NOPOWER)) - return - - // this is the data which will be sent to the ui - var/data[0] + last_power_draw = usage_amount + if (use_power > 0) + last_power_draw = max(last_power_draw, idle_power_usage) - data = list( - "on" = on, - "pressure_set" = round(target_pressure, 0.01), - "max_pressure" = max_pressure_setting, - "last_power_draw" = round(last_power_draw), - "max_power_draw" = active_power_usage, +/obj/machinery/atmospherics/binary/proc/turn_on() + on = 1 + update_use_power(1) + +/obj/machinery/atmospherics/binary/proc/turn_off() + on = 0 + last_power_draw = 0 + update_use_power(0) + +/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) + if(stat & (BROKEN|NOPOWER)) + return + + // this is the data which will be sent to the ui + var/data[0] + + data = list( + "on" = on, + "pressure_set" = round(target_pressure, 0.01), + "max_pressure" = max_pressure_setting, + "last_power_draw" = round(last_power_draw), + "max_power_draw" = active_power_usage, + ) + + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) + if (!ui) + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm + ui = new(user, src, ui_key, "gas_pump.tmpl", name, 470, 290) + ui.set_initial_data(data) // when the ui is first opened this is the data it will use + ui.open() // open the new ui window + ui.set_auto_update(1) // auto update every Master Controller tick + +/obj/machinery/atmospherics/binary/pump/initialize() + ..() + if(frequency) + set_frequency(frequency) + +/obj/machinery/atmospherics/binary/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) + if(text2num(signal.data["power"])) + turn_on() + else + turn_off() + + if("power_toggle" in signal.data) + if (on) + turn_off() + else + turn_on() + + if(signal.data["set_output_pressure"]) + target_pressure = between( + 0, + text2num(signal.data["set_output_pressure"]), + ONE_ATMOSPHERE*50 ) - // update the ui if it exists, returns null if no ui is passed/found - ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) - if (!ui) - // the ui does not exist, so we'll create a new() one - // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm - ui = new(user, src, ui_key, "gas_pump.tmpl", name, 470, 290) - ui.set_initial_data(data) // when the ui is first opened this is the data it will use - ui.open() // open the new ui window - ui.set_auto_update(1) // auto update every Master Controller tick - - initialize() - ..() - if(frequency) - set_frequency(frequency) - - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 - - if("power" in signal.data) - if(text2num(signal.data["power"])) - turn_on() - else - turn_off() - - if("power_toggle" in signal.data) - if (on) - turn_off() - else - turn_on() - - if("set_output_pressure" in signal.data) - target_pressure = between( - 0, - text2num(signal.data["set_output_pressure"]), - ONE_ATMOSPHERE*50 - ) - - if("status" in signal.data) - spawn(2) - broadcast_status() - return //do not update_icon - + if(signal.data["status"]) spawn(2) broadcast_status() - update_icon() + return //do not update_icon + + spawn(2) + broadcast_status() + update_icon() + return + +/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob) + if(..()) return - - - attack_hand(user as mob) - if(..()) - return - src.add_fingerprint(usr) - if(!src.allowed(user)) - user << "\red Access denied." - return - usr.set_machine(src) - ui_interact(user) + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." return + usr.set_machine(src) + ui_interact(user) + return - Topic(href,href_list) - if(..()) return - - if(href_list["power"]) - if (on) - turn_off() - else - turn_on() - - switch(href_list["set_press"]) - if ("min") - target_pressure = 0 - if ("max") - target_pressure = max_pressure_setting - if ("set") - var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num - src.target_pressure = max(0, min(max_pressure_setting, new_pressure)) - - usr.set_machine(src) - src.add_fingerprint(usr) - - src.update_icon() - return +/obj/machinery/atmospherics/binary/pump/Topic(href,href_list) + if(..()) return + + if(href_list["power"]) + if (on) + turn_off() + else + turn_on() + + switch(href_list["set_press"]) + if ("min") + target_pressure = 0 + if ("max") + target_pressure = max_pressure_setting + if ("set") + var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num + src.target_pressure = max(0, min(max_pressure_setting, new_pressure)) + + usr.set_machine(src) + src.add_fingerprint(usr) + + src.update_icon() - power_change() - ..() +/obj/machinery/atmospherics/binary/pump/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (!(stat & NOPOWER) && on) - user << "\red You cannot unwrench this [src], turn it off first." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) +/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (!(stat & NOPOWER) && on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index e2dddfa97c1..2f9d775bd55 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -12,9 +12,10 @@ Thus, the two variables affect pump operation are set in New(): but overall network volume is also increased as this increases... */ -obj/machinery/atmospherics/binary/volume_pump - icon = 'icons/obj/atmospherics/volume_pump.dmi' - icon_state = "intact_off" +/obj/machinery/atmospherics/binary/volume_pump + icon = 'icons/atmos/volume_pump.dmi' + icon_state = "map" + level = 1 name = "Volumetric gas pump" desc = "A volumetric pump" @@ -26,174 +27,167 @@ obj/machinery/atmospherics/binary/volume_pump var/id = null var/datum/radio_frequency/radio_connection - on - on = 1 - icon_state = "intact_on" +/obj/machinery/atmospherics/binary/volume_pump/on + on = 1 - update_icon() - if(stat & NOPOWER) - icon_state = "intact_off" - else if(node1 && node2) - icon_state = "intact_[on?("on"):("off")]" - else - if(node1) - icon_state = "exposed_1_off" - else if(node2) - icon_state = "exposed_2_off" - else - icon_state = "exposed_3_off" - return +/obj/machinery/atmospherics/binary/volume_pump/update_icon() + if(!powered()) + icon_state = "off" + else + icon_state = "[on ? "on" : "off"]" - process() -// ..() - if(stat & (NOPOWER|BROKEN)) +/obj/machinery/atmospherics/binary/volume_pump/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) return - if(!on) - return 0 + add_underlay(T, node1, turn(dir, -180)) + add_underlay(T, node2, dir) + +/obj/machinery/atmospherics/binary/volume_pump/hide(var/i) + update_underlays() + +/obj/machinery/atmospherics/binary/volume_pump/process() +// ..() + if(stat & (NOPOWER|BROKEN)) + return + if(!on) + return 0 // Pump mechanism just won't do anything if the pressure is too high/too low - var/input_starting_pressure = air1.return_pressure() - var/output_starting_pressure = air2.return_pressure() - - if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000)) - return 1 - - var/transfer_ratio = max(1, transfer_rate/air1.volume) - - var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio) - - air2.merge(removed) - - if(network1) - network1.update = 1 - - if(network2) - network2.update = 1 + var/input_starting_pressure = air1.return_pressure() + var/output_starting_pressure = air2.return_pressure() + if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000)) return 1 - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency) + var/transfer_ratio = max(1, transfer_rate/air1.volume) - broadcast_status() - if(!radio_connection) - return 0 + var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src + air2.merge(removed) - signal.data = list( - "tag" = id, - "device" = "APV", - "power" = on, - "transfer_rate" = transfer_rate, - "sigtype" = "status" - ) - radio_connection.post_signal(src, signal) + if(network1) + network1.update = 1 - return 1 + if(network2) + network2.update = 1 - interact(mob/user as mob) - var/dat = {"Power: [on?"On":"Off"]
- Desirable output flow: - [round(transfer_rate,1)]l/s | Change - "} + return 1 - user << browse("[src.name] control[dat]", "window=atmo_pump") - onclose(user, "atmo_pump") +/obj/machinery/atmospherics/binary/volume_pump/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency) +/obj/machinery/atmospherics/binary/volume_pump/proc/broadcast_status() + if(!radio_connection) + return 0 + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.source = src - initialize() - ..() + signal.data = list( + "tag" = id, + "device" = "APV", + "power" = on, + "transfer_rate" = transfer_rate, + "sigtype" = "status" + ) + radio_connection.post_signal(src, signal) - set_frequency(frequency) + return 1 - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) - return 0 +/obj/machinery/atmospherics/binary/volume_pump/interact(mob/user as mob) + var/dat = {"Power: [on?"On":"Off"]
+ Desirable output flow: + [round(transfer_rate,1)]l/s | Change + "} - if("power" in signal.data) - on = text2num(signal.data["power"]) + user << browse("[src.name] control[dat]", "window=atmo_pump") + onclose(user, "atmo_pump") - if("power_toggle" in signal.data) - on = !on +/obj/machinery/atmospherics/binary/volume_pump/initialize() + ..() + set_frequency(frequency) - if("set_transfer_rate" in signal.data) - transfer_rate = between( - 0, - text2num(signal.data["set_transfer_rate"]), - air1.volume - ) +/obj/machinery/atmospherics/binary/volume_pump/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return 0 - if("status" in signal.data) - spawn(2) - broadcast_status() - return //do not update_icon + if(signal.data["power"]) + on = text2num(signal.data["power"]) + if(signal.data["power_toggle"]) + on = !on + + if(signal.data["set_transfer_rate"]) + transfer_rate = between( + 0, + text2num(signal.data["set_transfer_rate"]), + air1.volume + ) + + if(signal.data["status"]) spawn(2) broadcast_status() + return //do not update_icon + + spawn(2) + broadcast_status() + update_icon() + +/obj/machinery/atmospherics/binary/volume_pump/attack_hand(user as mob) + if(..()) + return + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." + return + usr.set_machine(src) + interact(user) + return + +/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list) + if(..()) return + if(href_list["power"]) + on = !on + if(href_list["set_transfer_rate"]) + var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num + src.transfer_rate = max(0, min(200, new_transfer_rate)) + usr.set_machine(src) + src.update_icon() + src.updateUsrDialog() + return + +/obj/machinery/atmospherics/binary/volume_pump/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - - attack_hand(user as mob) - if(..()) - return - src.add_fingerprint(usr) - if(!src.allowed(user)) - user << "\red Access denied." - return - usr.set_machine(src) - interact(user) - return - - Topic(href,href_list) - if(..()) return - if(href_list["power"]) - on = !on - if(href_list["set_transfer_rate"]) - var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num - src.transfer_rate = max(0, min(200, new_transfer_rate)) - usr.set_machine(src) - src.update_icon() - src.updateUsrDialog() - return - - power_change() - ..() - update_icon() - - - - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (!(stat & NOPOWER) && on) - user << "\red You cannot unwrench this [src], turn it off first." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) - +/obj/machinery/atmospherics/binary/volume_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (!(stat & NOPOWER) && on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/omni_devices/_omni_extras.dm b/code/ATMOSPHERICS/components/omni_devices/_omni_extras.dm index ae827881ad5..b48c2f40333 100644 --- a/code/ATMOSPHERICS/components/omni_devices/_omni_extras.dm +++ b/code/ATMOSPHERICS/components/omni_devices/_omni_extras.dm @@ -11,33 +11,6 @@ #define ATM_P 6 //Phoron #define ATM_N2O 7 -//-------------------------------------------- -// Omni device cached icon list -//-------------------------------------------- -var/global/list/omni_icons[] - -/proc/gen_omni_icons() - omni_icons = new() - var/icon/omni = new('icons/obj/atmospherics/omni_devices.dmi') - - for(var/state in omni.IconStates()) - if(!state || findtext(state, "map")) - continue - - var/image/I = image('icons/obj/atmospherics/omni_devices.dmi', icon_state = state) - - if(findtext(state, "pipe")) - for(var/pipe_color in pipe_colors) - I = image('icons/obj/atmospherics/omni_devices.dmi', icon_state = state) - I.color = pipe_colors[pipe_color] - var/cache_name = state - if(I.color) - cache_name += "_[pipe_colors[pipe_color]]" - omni_icons[cache_name] = I - else - omni_icons[state] = I - - //-------------------------------------------- // Omni port datum // @@ -83,16 +56,6 @@ var/global/list/omni_icons[] // Need to find somewhere else for these //-------------------------------------------- -#define PIPE_COLOR_RED "#ff0000" -#define PIPE_COLOR_BLUE "#0000ff" -#define PIPE_COLOR_CYAN "#00ffff" -#define PIPE_COLOR_GREEN "#00ff00" -#define PIPE_COLOR_YELLOW "#ffcc00" -#define PIPE_COLOR_PURPLE "#5c1ec0" - -var/global/list/pipe_colors = list("grey" = null, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE) - - //returns a text string based on the direction flag input // if capitalize is true, it will return the string capitalized // otherwise it will return the direction string in lower case diff --git a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm index 0e46546a20a..24c771f94da 100644 --- a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm +++ b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm @@ -3,10 +3,11 @@ //-------------------------------------------- /obj/machinery/atmospherics/omni name = "omni device" - icon = 'icons/obj/atmospherics/omni_devices.dmi' + icon = 'icons/atmos/omni_devices.dmi' icon_state = "base" use_power = 1 initialize_directions = 0 + level = 1 var/on = 0 var/configuring = 0 @@ -70,12 +71,6 @@ update_icon() /obj/machinery/atmospherics/omni/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if(istype(W, /obj/item/device/pipe_painter)) //for updating the color of connected pipe ends - for(var/datum/omni_port/P in ports) - P.update = 1 - update_ports() - return - if(!istype(W, /obj/item/weapon/wrench)) return ..() @@ -106,8 +101,8 @@ return /obj/machinery/atmospherics/omni/proc/build_icons() - if(!omni_icons) - gen_omni_icons() + if(!check_icon_cache()) + return var/core_icon = null if(istype(src, /obj/machinery/atmospherics/omni/mixer)) @@ -119,13 +114,16 @@ //directional icons are layers 1-4, with the core icon on layer 5 if(core_icon) - overlays_off[5] = omni_icons[core_icon] - overlays_on[5] = omni_icons[core_icon + "_glow"] + overlays_off[5] = icon_manager.get_atmos_icon("omni", , , core_icon) + overlays_on[5] = icon_manager.get_atmos_icon("omni", , , core_icon + "_glow") - overlays_error[1] = omni_icons[core_icon] - overlays_error[2] = omni_icons["error"] + overlays_error[1] = icon_manager.get_atmos_icon("omni", , , core_icon) + overlays_error[2] = icon_manager.get_atmos_icon("omni", , , "error") /obj/machinery/atmospherics/omni/proc/update_port_icons() + if(!check_icon_cache()) + return + for(var/datum/omni_port/P in ports) if(P.update) var/ref_layer = 0 @@ -145,11 +143,11 @@ var/list/port_icons = select_port_icons(P) if(port_icons) if(P.node) - underlays_current[ref_layer] = omni_icons[port_icons["pipe_icon"]] + underlays_current[ref_layer] = port_icons["pipe_icon"] else underlays_current[ref_layer] = null - overlays_off[ref_layer] = omni_icons[port_icons["off_icon"]] - overlays_on[ref_layer] = omni_icons[port_icons["on_icon"]] + overlays_off[ref_layer] = port_icons["off_icon"] + overlays_on[ref_layer] = port_icons["on_icon"] else underlays_current[ref_layer] = null overlays_off[ref_layer] = null @@ -175,14 +173,29 @@ if(ATM_O2 to ATM_N2O) ic_on += "_filter" ic_off += "_out" - - var/pipe_state = ic_dir + "_pipe" - if(P.node) - if(P.node.color) - pipe_state += "_[P.node.color]" + ic_on = icon_manager.get_atmos_icon("omni", , , ic_on) + ic_off = icon_manager.get_atmos_icon("omni", , , ic_off) + + var/pipe_state + var/turf/T = get_turf(src) + if(!istype(T)) + return + if(T.intact && istype(P.node, /obj/machinery/atmospherics/pipe) && P.node.level == 1 ) + pipe_state = icon_manager.get_atmos_icon("underlay_down", P.dir, color_cache_name(P.node)) + else + pipe_state = icon_manager.get_atmos_icon("underlay_intact", P.dir, color_cache_name(P.node)) + return list("on_icon" = ic_on, "off_icon" = ic_off, "pipe_icon" = pipe_state) +/obj/machinery/atmospherics/omni/update_underlays() + for(var/datum/omni_port/P in ports) + P.update = 1 + update_ports() + +/obj/machinery/atmospherics/omni/hide(var/i) + update_underlays() + /obj/machinery/atmospherics/omni/proc/update_ports() sort_ports() update_port_icons() diff --git a/code/ATMOSPHERICS/components/portables_connector.dm b/code/ATMOSPHERICS/components/portables_connector.dm index 9ecc82b3244..75d32718fa9 100644 --- a/code/ATMOSPHERICS/components/portables_connector.dm +++ b/code/ATMOSPHERICS/components/portables_connector.dm @@ -1,6 +1,6 @@ /obj/machinery/atmospherics/portables_connector - icon = 'icons/obj/atmospherics/portables_connector.dmi' - icon_state = "intact" + icon = 'icons/atmos/connector.dmi' + icon_state = "map_connector" name = "Connector Port" desc = "For connecting portables devices related to atmospherics control." @@ -16,142 +16,139 @@ var/on = 0 use_power = 0 - level = 0 + level = 1 - New() - initialize_directions = dir - ..() +/obj/machinery/atmospherics/portables_connector/New() + initialize_directions = dir + ..() - update_icon() - if(node) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact" - dir = get_dir(src, node) - else - icon_state = "exposed" +/obj/machinery/atmospherics/portables_connector/update_icon() + icon_state = "connector" +/obj/machinery/atmospherics/portables_connector/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + add_underlay(T, node, dir) + +/obj/machinery/atmospherics/portables_connector/hide(var/i) + update_underlays() + +/obj/machinery/atmospherics/portables_connector/process() + ..() + if(!on) return - - hide(var/i) //to make the little pipe section invisible, the icon changes. - if(node) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact" - dir = get_dir(src, node) - else - icon_state = "exposed" - - process() - ..() - if(!on) - return - if(!connected_device) - on = 0 - return - if(network) - network.update = 1 - return 1 + if(!connected_device) + on = 0 + return + if(network) + network.update = 1 + return 1 // Housekeeping and pipe network stuff below - network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) - if(reference == node) - network = new_network +/obj/machinery/atmospherics/portables_connector/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) + if(reference == node) + network = new_network - if(new_network.normal_members.Find(src)) - return 0 + if(new_network.normal_members.Find(src)) + return 0 - new_network.normal_members += src + new_network.normal_members += src - return null + return null - Del() - loc = null +/obj/machinery/atmospherics/portables_connector/Del() + loc = null - if(connected_device) - connected_device.disconnect() + if(connected_device) + connected_device.disconnect() - if(node) - node.disconnect(src) - del(network) + if(node) + node.disconnect(src) + del(network) - node = null + node = null - ..() + ..() - initialize() - if(node) return +/obj/machinery/atmospherics/portables_connector/initialize() + if(node) return - var/node_connect = dir + var/node_connect = dir - for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) - if(target.initialize_directions & get_dir(target,src)) - node = target - break + for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) + if(target.initialize_directions & get_dir(target,src)) + node = target + break - update_icon() + update_icon() + update_underlays() +/obj/machinery/atmospherics/portables_connector/build_network() + if(!network && node) + network = new /datum/pipe_network() + network.normal_members += src + network.build_network(node, src) + + +/obj/machinery/atmospherics/portables_connector/return_network(obj/machinery/atmospherics/reference) build_network() - if(!network && node) - network = new /datum/pipe_network() - network.normal_members += src - network.build_network(node, src) + + if(reference==node) + return network + + if(reference==connected_device) + return network + + return null + +/obj/machinery/atmospherics/portables_connector/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) + if(network == old_network) + network = new_network + + return 1 + +/obj/machinery/atmospherics/portables_connector/return_network_air(datum/pipe_network/reference) + var/list/results = list() + + if(connected_device) + results += connected_device.air_contents + + return results + +/obj/machinery/atmospherics/portables_connector/disconnect(obj/machinery/atmospherics/reference) + if(reference==node) + del(network) + node = null + + update_underlays() + + return null - return_network(obj/machinery/atmospherics/reference) - build_network() - - if(reference==node) - return network - - if(reference==connected_device) - return network - - return null - - reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) - if(network == old_network) - network = new_network - +/obj/machinery/atmospherics/portables_connector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (connected_device) + user << "\red You cannot unwrench this [src], dettach [connected_device] first." return 1 - - return_network_air(datum/pipe_network/reference) - var/list/results = list() - - if(connected_device) - results += connected_device.air_contents - - return results - - disconnect(obj/machinery/atmospherics/reference) - if(reference==node) - del(network) - node = null - - return null - - - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (connected_device) - user << "\red You cannot unwrench this [src], dettach [connected_device] first." - return 1 - if (locate(/obj/machinery/portable_atmospherics, src.loc)) - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) + if (locate(/obj/machinery/portable_atmospherics, src.loc)) + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 16a863a2e1f..594190bdb8a 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -1,11 +1,11 @@ -obj/machinery/atmospherics/trinary/filter - icon = 'icons/obj/atmospherics/filter.dmi' - icon_state = "intact_off" +/obj/machinery/atmospherics/trinary/filter + icon = 'icons/atmos/filter.dmi' + icon_state = "map" density = 0 + level = 1 name = "Gas filter" - var/on = 0 var/temp = null // -- TLE var/target_pressure = ONE_ATMOSPHERE @@ -24,141 +24,159 @@ Filter types: var/frequency = 0 var/datum/radio_frequency/radio_connection - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) +/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) - New() - if(radio_controller) - initialize() - ..() +/* I don't know why this is here, but it's ugly, so I'm disabling it +/obj/machinery/atmospherics/trinary/filter/New() + ..() + if(radio_controller) + initialize() +*/ +/obj/machinery/atmospherics/trinary/filter/update_icon() + if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter)) + icon_state = "m" + else + icon_state = "" + + if(!powered()) + icon_state += "off" + else if(node2 && node3 && node1) + icon_state += on ? "on" : "off" + else + icon_state += "off" + on = 0 - update_icon() - if(stat & NOPOWER) - icon_state = "intact_off" - else if(node2 && node3 && node1) - icon_state = "intact_[on?("on"):("off")]" +/obj/machinery/atmospherics/trinary/filter/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + + add_underlay(T, node1, turn(dir, -180)) + + if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter)) + add_underlay(T, node2, turn(dir, 90)) else - icon_state = "intact_off" - on = 0 + add_underlay(T, node2, turn(dir, -90)) - return + add_underlay(T, node3, dir) - power_change() - var/old_stat = stat - ..() - if(old_stat != stat) - update_icon() +/obj/machinery/atmospherics/trinary/filter/hide(var/i) + update_underlays() - process() - ..() - if(!on) - return 0 +/obj/machinery/atmospherics/trinary/filter/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) + update_icon() - var/output_starting_pressure = air3.return_pressure() +/obj/machinery/atmospherics/trinary/filter/process() + ..() + if(!on) + return 0 - if(output_starting_pressure >= target_pressure || air2.return_pressure() >= target_pressure ) - //No need to mix if target is already full! - return 1 - - //Calculate necessary moles to transfer using PV=nRT - - var/pressure_delta = target_pressure - output_starting_pressure - var/transfer_moles - - if(air1.temperature > 0) - transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) - - //Actually transfer the gas - - if(transfer_moles > 0) - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - - if(!removed) - return - var/datum/gas_mixture/filtered_out = new - filtered_out.temperature = removed.temperature - - switch(filter_type) - if(0) //removing hydrocarbons - filtered_out.phoron = removed.phoron - removed.phoron = 0 - - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - - if(1) //removing O2 - filtered_out.oxygen = removed.oxygen - removed.oxygen = 0 - - if(2) //removing N2 - filtered_out.nitrogen = removed.nitrogen - removed.nitrogen = 0 - - if(3) //removing CO2 - filtered_out.carbon_dioxide = removed.carbon_dioxide - removed.carbon_dioxide = 0 - - if(4)//removing N2O - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/sleeping_agent)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - - else - filtered_out = null - - - air2.merge(filtered_out) - air3.merge(removed) - - if(network2) - network2.update = 1 - - if(network3) - network3.update = 1 - - if(network1) - network1.update = 1 + var/output_starting_pressure = air3.return_pressure() + if(output_starting_pressure >= target_pressure || air2.return_pressure() >= target_pressure ) + //No need to mix if target is already full! return 1 - initialize() - set_frequency(frequency) - ..() + //Calculate necessary moles to transfer using PV=nRT - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) + var/pressure_delta = target_pressure - output_starting_pressure + var/transfer_moles + + if(air1.temperature > 0) + transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) + + //Actually transfer the gas + + if(transfer_moles > 0) + var/datum/gas_mixture/removed = air1.remove(transfer_moles) + + if(!removed) + return + var/datum/gas_mixture/filtered_out = new + filtered_out.temperature = removed.temperature + + switch(filter_type) + if(0) //removing hydrocarbons + filtered_out.phoron = removed.phoron + removed.phoron = 0 + + if(removed.trace_gases.len>0) + for(var/datum/gas/trace_gas in removed.trace_gases) + if(istype(trace_gas, /datum/gas/oxygen_agent_b)) + removed.trace_gases -= trace_gas + filtered_out.trace_gases += trace_gas + + if(1) //removing O2 + filtered_out.oxygen = removed.oxygen + removed.oxygen = 0 + + if(2) //removing N2 + filtered_out.nitrogen = removed.nitrogen + removed.nitrogen = 0 + + if(3) //removing CO2 + filtered_out.carbon_dioxide = removed.carbon_dioxide + removed.carbon_dioxide = 0 + + if(4)//removing N2O + if(removed.trace_gases.len>0) + for(var/datum/gas/trace_gas in removed.trace_gases) + if(istype(trace_gas, /datum/gas/sleeping_agent)) + removed.trace_gases -= trace_gas + filtered_out.trace_gases += trace_gas + + else + filtered_out = null -obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE + air2.merge(filtered_out) + air3.merge(removed) + + if(network2) + network2.update = 1 + + if(network3) + network3.update = 1 + + if(network1) + network1.update = 1 + + return 1 + +/obj/machinery/atmospherics/trinary/filter/initialize() + set_frequency(frequency) + ..() + +/obj/machinery/atmospherics/trinary/filter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) + + +/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE if(..()) return @@ -211,7 +229,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE onclose(user, "atmo_filter") return -obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE +/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE if(..()) return usr.set_machine(src) @@ -234,9 +252,8 @@ obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE */ return -obj/machinery/atmospherics/trinary/filter/m_filter - icon = 'icons/obj/atmospherics/m_filter.dmi' - icon_state = "intact_off" +/obj/machinery/atmospherics/trinary/filter/m_filter + icon_state = "mmap" dir = SOUTH initialize_directions = SOUTH|NORTH|EAST @@ -253,7 +270,9 @@ obj/machinery/atmospherics/trinary/filter/m_filter/New() if(WEST) initialize_directions = WEST|SOUTH|EAST -obj/machinery/atmospherics/trinary/filter/m_filter/initialize() +/obj/machinery/atmospherics/trinary/filter/m_filter/initialize() + set_frequency(frequency) + if(node1 && node2 && node3) return var/node1_connect = turn(dir, -180) @@ -276,3 +295,4 @@ obj/machinery/atmospherics/trinary/filter/m_filter/initialize() break update_icon() + update_underlays() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 4d94acbfba3..228be72020d 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -1,169 +1,190 @@ -obj/machinery/atmospherics/trinary/mixer - icon = 'icons/obj/atmospherics/mixer.dmi' - icon_state = "intact_off" +/obj/machinery/atmospherics/trinary/mixer + icon = 'icons/atmos/mixer.dmi' + icon_state = "map" density = 0 + level = 1 name = "Gas mixer" - var/on = 0 - var/target_pressure = ONE_ATMOSPHERE var/node1_concentration = 0.5 var/node2_concentration = 0.5 //node 3 is the outlet, nodes 1 & 2 are intakes - update_icon() - if(stat & NOPOWER) - icon_state = "intact_off" - else if(node2 && node3 && node1) - icon_state = "intact_[on?("on"):("off")]" +/obj/machinery/atmospherics/trinary/mixer/update_icon(var/safety = 0) + if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer)) + icon_state = "m" + else if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer)) + icon_state = "t" + else + icon_state = "" + + if(!powered()) + icon_state += "off" + else if(node2 && node3 && node1) + icon_state += on ? "on" : "off" + else + icon_state += "off" + on = 0 + +/obj/machinery/atmospherics/trinary/mixer/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + + if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer)) + add_underlay(T, node1, turn(dir, -90)) else - icon_state = "intact_off" - on = 0 + add_underlay(T, node1, turn(dir, -180)) - return + if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer) || istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer)) + add_underlay(T, node2, turn(dir, 90)) + else + add_underlay(T, node2, turn(dir, -90)) - power_change() - var/old_stat = stat - ..() - if(old_stat != stat) - update_icon() + add_underlay(T, node3, dir) - New() - ..() - air3.volume = 300 +/obj/machinery/atmospherics/trinary/mixer/hide(var/i) + update_underlays() - process() - ..() - if(!on) - return 0 +/obj/machinery/atmospherics/trinary/mixer/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) + update_icon() - var/output_starting_pressure = air3.return_pressure() +/obj/machinery/atmospherics/trinary/mixer/New() + ..() + air3.volume = 300 - if(output_starting_pressure >= target_pressure) - //No need to mix if target is already full! - return 1 +/obj/machinery/atmospherics/trinary/mixer/process() + ..() + if(!on) + return 0 - //Calculate necessary moles to transfer using PV=nRT - - var/pressure_delta = target_pressure - output_starting_pressure - var/transfer_moles1 = 0 - var/transfer_moles2 = 0 - - if(air1.temperature > 0) - transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) - - if(air2.temperature > 0) - transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION) - - var/air1_moles = air1.total_moles() - var/air2_moles = air2.total_moles() - - if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2)) - if(!transfer_moles1 || !transfer_moles2) return - var/ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2) - - transfer_moles1 *= ratio - transfer_moles2 *= ratio - - //Actually transfer the gas - - if(transfer_moles1 > 0) - var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1) - air3.merge(removed1) - - if(transfer_moles2 > 0) - var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2) - air3.merge(removed2) - - if(network1 && transfer_moles1) - network1.update = 1 - - if(network2 && transfer_moles2) - network2.update = 1 - - if(network3) - network3.update = 1 + var/output_starting_pressure = air3.return_pressure() + if(output_starting_pressure >= target_pressure) + //No need to mix if target is already full! return 1 - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) + //Calculate necessary moles to transfer using PV=nRT - attack_hand(user as mob) - if(..()) - return - src.add_fingerprint(usr) - if(!src.allowed(user)) - user << "\red Access denied." - return - usr.set_machine(src) - var/dat = {"Power: [on?"On":"Off"]
- Desirable output pressure: - [target_pressure]kPa | Change -
- Node 1 Concentration: - - - - - [node1_concentration]([node1_concentration*100]%) - + - + -
- Node 2 Concentration: - - - - - [node2_concentration]([node2_concentration*100]%) - + - + - "} + var/pressure_delta = target_pressure - output_starting_pressure + var/transfer_moles1 = 0 + var/transfer_moles2 = 0 - user << browse("[src.name] control[dat]", "window=atmo_mixer") - onclose(user, "atmo_mixer") + if(air1.temperature > 0) + transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) + + if(air2.temperature > 0) + transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION) + + var/air1_moles = air1.total_moles() + var/air2_moles = air2.total_moles() + + if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2)) + if(!transfer_moles1 || !transfer_moles2) return + var/ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2) + + transfer_moles1 *= ratio + transfer_moles2 *= ratio + + //Actually transfer the gas + + if(transfer_moles1 > 0) + var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1) + air3.merge(removed1) + + if(transfer_moles2 > 0) + var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2) + air3.merge(removed2) + + if(network1 && transfer_moles1) + network1.update = 1 + + if(network2 && transfer_moles2) + network2.update = 1 + + if(network3) + network3.update = 1 + + return 1 + +/obj/machinery/atmospherics/trinary/mixer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) + +/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob) + if(..()) return - - Topic(href,href_list) - if(..()) return - if(href_list["power"]) - on = !on - if(href_list["set_press"]) - var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num - src.target_pressure = max(0, min(4500, new_pressure)) - if(href_list["node1_c"]) - var/value = text2num(href_list["node1_c"]) - src.node1_concentration = max(0, min(1, src.node1_concentration + value)) - src.node2_concentration = max(0, min(1, src.node2_concentration - value)) - if(href_list["node2_c"]) - var/value = text2num(href_list["node2_c"]) - src.node2_concentration = max(0, min(1, src.node2_concentration + value)) - src.node1_concentration = max(0, min(1, src.node1_concentration - value)) - src.update_icon() - src.updateUsrDialog() + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." return + usr.set_machine(src) + var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure: + [target_pressure]kPa | Change +
+ Node 1 Concentration: + - + - + [node1_concentration]([node1_concentration*100]%) + + + + +
+ Node 2 Concentration: + - + - + [node2_concentration]([node2_concentration*100]%) + + + + + "} + + user << browse("[src.name] control[dat]", "window=atmo_mixer") + onclose(user, "atmo_mixer") + return + +/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list) + if(..()) return + if(href_list["power"]) + on = !on + if(href_list["set_press"]) + var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num + src.target_pressure = max(0, min(4500, new_pressure)) + if(href_list["node1_c"]) + var/value = text2num(href_list["node1_c"]) + src.node1_concentration = max(0, min(1, src.node1_concentration + value)) + src.node2_concentration = max(0, min(1, src.node2_concentration - value)) + if(href_list["node2_c"]) + var/value = text2num(href_list["node2_c"]) + src.node2_concentration = max(0, min(1, src.node2_concentration + value)) + src.node1_concentration = max(0, min(1, src.node1_concentration - value)) + src.update_icon() + src.updateUsrDialog() + return obj/machinery/atmospherics/trinary/mixer/t_mixer - icon = 'icons/obj/atmospherics/t_mixer.dmi' - icon_state = "intact_off" + icon_state = "tmap" dir = SOUTH initialize_directions = SOUTH|EAST|WEST @@ -205,10 +226,10 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize() break update_icon() + update_underlays() obj/machinery/atmospherics/trinary/mixer/m_mixer - icon = 'icons/obj/atmospherics/m_mixer.dmi' - icon_state = "intact_off" + icon_state = "mmap" dir = SOUTH initialize_directions = SOUTH|NORTH|EAST @@ -249,4 +270,5 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer/initialize() node3 = target break - update_icon() \ No newline at end of file + update_icon() + update_underlays() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index d3f1116a430..655e58ea384 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -2,6 +2,8 @@ obj/machinery/atmospherics/trinary dir = SOUTH initialize_directions = SOUTH|NORTH|WEST use_power = 1 + + var/on = 0 var/datum/gas_mixture/air1 var/datum/gas_mixture/air2 @@ -94,6 +96,7 @@ obj/machinery/atmospherics/trinary break update_icon() + update_underlays() build_network() if(!network1 && node1) @@ -160,5 +163,7 @@ obj/machinery/atmospherics/trinary else if(reference==node3) del(network3) node3 = null + + update_underlays() return null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/tvalve.dm b/code/ATMOSPHERICS/components/tvalve.dm index 83f592c315f..603feb02949 100644 --- a/code/ATMOSPHERICS/components/tvalve.dm +++ b/code/ATMOSPHERICS/components/tvalve.dm @@ -1,10 +1,11 @@ -obj/machinery/atmospherics/tvalve - icon = 'icons/obj/atmospherics/valve.dmi' - icon_state = "tvalve0" +/obj/machinery/atmospherics/tvalve + icon = 'icons/atmos/tvalve.dmi' + icon_state = "map_tvalve0" name = "manual switching valve" desc = "A pipe valve" + level = 1 dir = SOUTH initialize_directions = SOUTH|NORTH|WEST @@ -19,415 +20,466 @@ obj/machinery/atmospherics/tvalve var/datum/pipe_network/network_node2 var/datum/pipe_network/network_node3 - update_icon(animation) - if(animation) - flick("tvalve[src.state][!src.state]",src) +/obj/machinery/atmospherics/tvalve/bypass + icon_state = "map_tvalve1" + state = 1 + +/obj/machinery/atmospherics/tvalve/update_icon(animation) + if(animation) + flick("tvalve[src.state][!src.state]",src) + else + icon_state = "tvalve[state]" + +/obj/machinery/atmospherics/tvalve/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + add_underlay(T, node1, turn(dir, -180)) + + if(istype(src, /obj/machinery/atmospherics/tvalve/mirrored)) + add_underlay(T, node2, turn(dir, 90)) else - icon_state = "tvalve[state]" + add_underlay(T, node2, turn(dir, -90)) + + add_underlay(T, node3, dir) - New() - initialize_directions() - ..() - - proc/initialize_directions() - switch(dir) - if(NORTH) - initialize_directions = SOUTH|NORTH|EAST - if(SOUTH) - initialize_directions = NORTH|SOUTH|WEST - if(EAST) - initialize_directions = WEST|EAST|SOUTH - if(WEST) - initialize_directions = EAST|WEST|NORTH - - network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) - if(reference == node1) - network_node1 = new_network - if(state) - network_node2 = new_network - else - network_node3 = new_network - else if(reference == node2) - network_node2 = new_network - if(state) - network_node1 = new_network - else if(reference == node3) - network_node3 = new_network - if(!state) - network_node1 = new_network - - if(new_network.normal_members.Find(src)) - return 0 - - new_network.normal_members += src - - if(state) - if(reference == node1) - if(node2) - return node2.network_expand(new_network, src) - else if(reference == node2) - if(node1) - return node1.network_expand(new_network, src) - else - if(reference == node1) - if(node3) - return node3.network_expand(new_network, src) - else if(reference == node3) - if(node1) - return node1.network_expand(new_network, src) - - return null - - Del() - loc = null - - if(node1) - node1.disconnect(src) - del(network_node1) - if(node2) - node2.disconnect(src) - del(network_node2) - if(node3) - node3.disconnect(src) - del(network_node3) - - node1 = null - node2 = null - node3 = null - - ..() - - proc/go_to_side() - - if(state) return 0 - - state = 1 - update_icon() - - if(network_node1) - del(network_node1) - if(network_node3) - del(network_node3) - build_network() - - if(network_node1&&network_node2) - network_node1.merge(network_node2) - network_node2 = network_node1 - - if(network_node1) - network_node1.update = 1 - else if(network_node2) - network_node2.update = 1 - - return 1 - - proc/go_straight() - - if(!state) - return 0 - - state = 0 - update_icon() - - if(network_node1) - del(network_node1) - if(network_node2) - del(network_node2) - build_network() - - if(network_node1&&network_node3) - network_node1.merge(network_node3) - network_node3 = network_node1 - - if(network_node1) - network_node1.update = 1 - else if(network_node3) - network_node3.update = 1 - - return 1 - - attack_ai(mob/user as mob) - return - - attack_paw(mob/user as mob) - return attack_hand(user) - - attack_hand(mob/user as mob) - src.add_fingerprint(usr) - update_icon(1) - sleep(10) - if (src.state) - src.go_straight() - else - src.go_to_side() - - process() - ..() - machines.Remove(src) - -/* if(open && (!node1 || !node2)) - close() - if(!node1) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (!node2) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ - - return - - initialize() - var/node1_dir - var/node2_dir - var/node3_dir - - node1_dir = turn(dir, 180) - node2_dir = turn(dir, -90) - node3_dir = dir - - for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) - if(target.initialize_directions & get_dir(target,src)) - node1 = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) - if(target.initialize_directions & get_dir(target,src)) - node2 = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir)) - if(target.initialize_directions & get_dir(target,src)) - node3 = target - break - - build_network() - if(!network_node1 && node1) - network_node1 = new /datum/pipe_network() - network_node1.normal_members += src - network_node1.build_network(node1, src) - - if(!network_node2 && node2) - network_node2 = new /datum/pipe_network() - network_node2.normal_members += src - network_node2.build_network(node2, src) - - if(!network_node3 && node3) - network_node3 = new /datum/pipe_network() - network_node3.normal_members += src - network_node3.build_network(node3, src) - - - return_network(obj/machinery/atmospherics/reference) - build_network() - - if(reference==node1) - return network_node1 - - if(reference==node2) - return network_node2 - - if(reference==node3) - return network_node3 - - return null - - reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) - if(network_node1 == old_network) - network_node1 = new_network - if(network_node2 == old_network) - network_node2 = new_network - if(network_node3 == old_network) - network_node3 = new_network - - return 1 - - return_network_air(datum/network/reference) - return null - - disconnect(obj/machinery/atmospherics/reference) - if(reference==node1) - del(network_node1) - node1 = null - - else if(reference==node2) - del(network_node2) - node2 = null - - else if(reference==node3) - del(network_node3) - node2 = null - - return null - - digital // can be controlled by AI - name = "digital switching valve" - desc = "A digitally controlled valve." - icon = 'icons/obj/atmospherics/digital_valve.dmi' - - attack_ai(mob/user as mob) - return src.attack_hand(user) - - attack_hand(mob/user as mob) - if(!src.allowed(user)) - user << "\red Access denied." - return - ..() - - //Radio remote control - - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) - - var/frequency = 0 - var/id = null - var/datum/radio_frequency/radio_connection - - initialize() - ..() - if(frequency) - set_frequency(frequency) - - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id)) - return 0 - - switch(signal.data["command"]) - if("valve_open") - if(!state) - go_to_side() - - if("valve_close") - if(state) - go_straight() - - if("valve_toggle") - if(state) - go_straight() - else - go_to_side() - - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (istype(src, /obj/machinery/atmospherics/tvalve/digital)) - user << "\red You cannot unwrench this [src], it's too complicated." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) - -obj/machinery/atmospherics/tvalve/mirrored - icon_state = "tvalvem0" +/obj/machinery/atmospherics/tvalve/hide(var/i) + update_underlays() +/obj/machinery/atmospherics/tvalve/New() initialize_directions() - switch(dir) - if(NORTH) - initialize_directions = SOUTH|NORTH|WEST - if(SOUTH) - initialize_directions = NORTH|SOUTH|EAST - if(EAST) - initialize_directions = WEST|EAST|NORTH - if(WEST) - initialize_directions = EAST|WEST|SOUTH + ..() - initialize() - var/node1_dir - var/node2_dir - var/node3_dir +/obj/machinery/atmospherics/tvalve/proc/initialize_directions() + switch(dir) + if(NORTH) + initialize_directions = SOUTH|NORTH|EAST + if(SOUTH) + initialize_directions = NORTH|SOUTH|WEST + if(EAST) + initialize_directions = WEST|EAST|SOUTH + if(WEST) + initialize_directions = EAST|WEST|NORTH - node1_dir = turn(dir, 180) - node2_dir = turn(dir, 90) - node3_dir = dir - - for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) - if(target.initialize_directions & get_dir(target,src)) - node1 = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) - if(target.initialize_directions & get_dir(target,src)) - node2 = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir)) - if(target.initialize_directions & get_dir(target,src)) - node3 = target - break - - update_icon(animation) - if(animation) - flick("tvalvem[src.state][!src.state]",src) +/obj/machinery/atmospherics/tvalve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) + if(reference == node1) + network_node1 = new_network + if(state) + network_node2 = new_network else - icon_state = "tvalvem[state]" + network_node3 = new_network + else if(reference == node2) + network_node2 = new_network + if(state) + network_node1 = new_network + else if(reference == node3) + network_node3 = new_network + if(!state) + network_node1 = new_network - digital // can be controlled by AI - name = "digital switching valve" - desc = "A digitally controlled valve." - icon = 'icons/obj/atmospherics/digital_valve.dmi' + if(new_network.normal_members.Find(src)) + return 0 - attack_ai(mob/user as mob) - return src.attack_hand(user) + new_network.normal_members += src - attack_hand(mob/user as mob) - if(!src.allowed(user)) - user << "\red Access denied." - return - ..() + if(state) + if(reference == node1) + if(node2) + return node2.network_expand(new_network, src) + else if(reference == node2) + if(node1) + return node1.network_expand(new_network, src) + else + if(reference == node1) + if(node3) + return node3.network_expand(new_network, src) + else if(reference == node3) + if(node1) + return node1.network_expand(new_network, src) - //Radio remote control -eh? + return null - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) +/obj/machinery/atmospherics/tvalve/Del() + loc = null - var/frequency = 0 - var/id = null - var/datum/radio_frequency/radio_connection + if(node1) + node1.disconnect(src) + del(network_node1) + if(node2) + node2.disconnect(src) + del(network_node2) + if(node3) + node3.disconnect(src) + del(network_node3) - initialize() - ..() - if(frequency) - set_frequency(frequency) + node1 = null + node2 = null + node3 = null - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id)) - return 0 + ..() - switch(signal.data["command"]) - if("valve_open") - if(!state) - go_to_side() +/obj/machinery/atmospherics/tvalve/proc/go_to_side() - if("valve_close") - if(state) - go_straight() + if(state) return 0 - if("valve_toggle") - if(state) - go_straight() - else - go_to_side() \ No newline at end of file + state = 1 + update_icon() + + if(network_node1) + del(network_node1) + if(network_node3) + del(network_node3) + build_network() + + if(network_node1&&network_node2) + network_node1.merge(network_node2) + network_node2 = network_node1 + + if(network_node1) + network_node1.update = 1 + else if(network_node2) + network_node2.update = 1 + + return 1 + +/obj/machinery/atmospherics/tvalve/proc/go_straight() + + if(!state) + return 0 + + state = 0 + update_icon() + + if(network_node1) + del(network_node1) + if(network_node2) + del(network_node2) + build_network() + + if(network_node1&&network_node3) + network_node1.merge(network_node3) + network_node3 = network_node1 + + if(network_node1) + network_node1.update = 1 + else if(network_node3) + network_node3.update = 1 + + return 1 + +/obj/machinery/atmospherics/tvalve/attack_ai(mob/user as mob) + return + +/obj/machinery/atmospherics/tvalve/attack_paw(mob/user as mob) + return attack_hand(user) + +/obj/machinery/atmospherics/tvalve/attack_hand(mob/user as mob) + src.add_fingerprint(usr) + update_icon(1) + sleep(10) + if (src.state) + src.go_straight() + else + src.go_to_side() + +/obj/machinery/atmospherics/tvalve/process() + ..() + . = PROCESS_KILL + //machines.Remove(src) + + return + +/obj/machinery/atmospherics/tvalve/initialize() + var/node1_dir + var/node2_dir + var/node3_dir + + node1_dir = turn(dir, 180) + node2_dir = turn(dir, -90) + node3_dir = dir + + for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) + if(target.initialize_directions & get_dir(target,src)) + node1 = target + break + for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) + if(target.initialize_directions & get_dir(target,src)) + node2 = target + break + for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir)) + if(target.initialize_directions & get_dir(target,src)) + node3 = target + break + + update_icon() + update_underlays() + +/obj/machinery/atmospherics/tvalve/build_network() + if(!network_node1 && node1) + network_node1 = new /datum/pipe_network() + network_node1.normal_members += src + network_node1.build_network(node1, src) + + if(!network_node2 && node2) + network_node2 = new /datum/pipe_network() + network_node2.normal_members += src + network_node2.build_network(node2, src) + + if(!network_node3 && node3) + network_node3 = new /datum/pipe_network() + network_node3.normal_members += src + network_node3.build_network(node3, src) + + +/obj/machinery/atmospherics/tvalve/return_network(obj/machinery/atmospherics/reference) + build_network() + + if(reference==node1) + return network_node1 + + if(reference==node2) + return network_node2 + + if(reference==node3) + return network_node3 + + return null + +/obj/machinery/atmospherics/tvalve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) + if(network_node1 == old_network) + network_node1 = new_network + if(network_node2 == old_network) + network_node2 = new_network + if(network_node3 == old_network) + network_node3 = new_network + + return 1 + +/obj/machinery/atmospherics/tvalve/return_network_air(datum/network/reference) + return null + +/obj/machinery/atmospherics/tvalve/disconnect(obj/machinery/atmospherics/reference) + if(reference==node1) + del(network_node1) + node1 = null + + else if(reference==node2) + del(network_node2) + node2 = null + + else if(reference==node3) + del(network_node3) + node2 = null + + update_underlays() + + return null + +/obj/machinery/atmospherics/tvalve/digital // can be controlled by AI + name = "digital switching valve" + desc = "A digitally controlled valve." + icon = 'icons/atmos/digital_tvalve.dmi' + + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection + +/obj/machinery/atmospherics/tvalve/digital/bypass + icon_state = "map_tvalve1" + state = 1 + +/obj/machinery/atmospherics/tvalve/digital/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) + update_icon() + +/obj/machinery/atmospherics/tvalve/digital/update_icon() + ..() + if(!powered()) + icon_state = "tvalvenopower" + +/obj/machinery/atmospherics/tvalve/digital/attack_ai(mob/user as mob) + return src.attack_hand(user) + +/obj/machinery/atmospherics/tvalve/digital/attack_hand(mob/user as mob) + if(!powered()) + return + if(!src.allowed(user)) + user << "\red Access denied." + return + ..() + +//Radio remote control + +/obj/machinery/atmospherics/tvalve/digital/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) + + + +/obj/machinery/atmospherics/tvalve/digital/initialize() + ..() + if(frequency) + set_frequency(frequency) + +/obj/machinery/atmospherics/tvalve/digital/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id)) + return 0 + + switch(signal.data["command"]) + if("valve_open") + if(!state) + go_to_side() + + if("valve_close") + if(state) + go_straight() + + if("valve_toggle") + if(state) + go_straight() + else + go_to_side() + +/obj/machinery/atmospherics/tvalve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (istype(src, /obj/machinery/atmospherics/tvalve/digital)) + user << "\red You cannot unwrench this [src], it's too complicated." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) + +/obj/machinery/atmospherics/tvalve/mirrored + icon_state = "map_tvalvem0" + +/obj/machinery/atmospherics/tvalve/mirrored/bypass + icon_state = "map_tvalvem1" + state = 1 + +/obj/machinery/atmospherics/tvalve/mirrored/initialize_directions() + switch(dir) + if(NORTH) + initialize_directions = SOUTH|NORTH|WEST + if(SOUTH) + initialize_directions = NORTH|SOUTH|EAST + if(EAST) + initialize_directions = WEST|EAST|NORTH + if(WEST) + initialize_directions = EAST|WEST|SOUTH + +/obj/machinery/atmospherics/tvalve/mirrored/initialize() + var/node1_dir + var/node2_dir + var/node3_dir + + node1_dir = turn(dir, 180) + node2_dir = turn(dir, 90) + node3_dir = dir + + for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) + if(target.initialize_directions & get_dir(target,src)) + node1 = target + break + for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) + if(target.initialize_directions & get_dir(target,src)) + node2 = target + break + for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir)) + if(target.initialize_directions & get_dir(target,src)) + node3 = target + break + + update_icon() + update_underlays() + +/obj/machinery/atmospherics/tvalve/mirrored/update_icon(animation) + if(animation) + flick("tvalvem[src.state][!src.state]",src) + else + icon_state = "tvalvem[state]" + +/obj/machinery/atmospherics/tvalve/mirrored/digital // can be controlled by AI + name = "digital switching valve" + desc = "A digitally controlled valve." + icon = 'icons/atmos/digital_tvalve.dmi' + + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection + +/obj/machinery/atmospherics/tvalve/mirrored/digital/bypass + icon_state = "map_tvalvem1" + state = 1 + +/obj/machinery/atmospherics/tvalve/mirrored/digital/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) + update_icon() + +/obj/machinery/atmospherics/tvalve/mirrored/digital/update_icon() + ..() + if(!powered()) + icon_state = "tvalvemnopower" + +/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_ai(mob/user as mob) + return src.attack_hand(user) + +/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_hand(mob/user as mob) + if(!powered()) + return + if(!src.allowed(user)) + user << "\red Access denied." + return + ..() + +//Radio remote control -eh? + +/obj/machinery/atmospherics/tvalve/mirrored/digital/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) + +/obj/machinery/atmospherics/tvalve/mirrored/digital/initialize() + ..() + if(frequency) + set_frequency(frequency) + +/obj/machinery/atmospherics/tvalve/mirrored/digital/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id)) + return 0 + + switch(signal.data["command"]) + if("valve_open") + if(!state) + go_to_side() + + if("valve_close") + if(state) + go_straight() + + if("valve_toggle") + if(state) + go_straight() + else + go_to_side() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index f070882ba82..c821b629e04 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -1,7 +1,8 @@ /obj/machinery/atmospherics/unary/outlet_injector - icon = 'icons/obj/atmospherics/outlet_injector.dmi' - icon_state = "off" + icon = 'icons/atmos/injector.dmi' + icon_state = "map_injector" use_power = 1 + layer = 3 name = "Air Injector" desc = "Has a valve and pump attached to it" @@ -17,131 +18,122 @@ level = 1 - update_icon() - if(node) - if(on && !(stat & NOPOWER)) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - else - icon_state = "exposed" - on = 0 +/obj/machinery/atmospherics/unary/outlet_injector/update_icon() + if(!powered()) + icon_state = "off" + else + icon_state = "[on ? "on" : "off"]" - return - - power_change() - var/old_stat = stat - ..() - if(old_stat != stat) - update_icon() - - - process() - ..() - injecting = 0 - - if(!on || stat & NOPOWER) - return 0 - - if(air_contents.temperature > 0) - var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) - - if(network) - network.update = 1 - - return 1 - - proc/inject() - if(on || injecting) - return 0 - - injecting = 1 - - if(air_contents.temperature > 0) - var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) - - if(network) - network.update = 1 - - flick("inject", src) - - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency) - - 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" = "AO", - "power" = on, - "volume_rate" = volume_rate, - //"timestamp" = world.time, - "sigtype" = "status" - ) - - radio_connection.post_signal(src, signal) - - return 1 - - initialize() - ..() - - set_frequency(frequency) - - 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("inject" in signal.data) - spawn inject() +/obj/machinery/atmospherics/unary/outlet_injector/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) return + add_underlay(T, node, dir) - if("set_volume_rate" in signal.data) - var/number = text2num(signal.data["set_volume_rate"]) - volume_rate = between(0, number, air_contents.volume) - - if("status" in signal.data) - spawn(2) - 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() +/obj/machinery/atmospherics/unary/outlet_injector/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - hide(var/i) //to make the little pipe section invisible, the icon changes. - if(node) - if(on) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed" - on = 0 - return \ No newline at end of file +/obj/machinery/atmospherics/unary/outlet_injector/process() + ..() + injecting = 0 + + if(!on || stat & NOPOWER) + return 0 + + if(air_contents.temperature > 0) + var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) + + var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + + loc.assume_air(removed) + + if(network) + network.update = 1 + + return 1 + +/obj/machinery/atmospherics/unary/outlet_injector/proc/inject() + if(on || injecting) + return 0 + + injecting = 1 + + if(air_contents.temperature > 0) + var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) + + var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + + loc.assume_air(removed) + + if(network) + network.update = 1 + + flick("inject", src) + +/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency) + +/obj/machinery/atmospherics/unary/outlet_injector/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" = "AO", + "power" = on, + "volume_rate" = volume_rate, + "sigtype" = "status" + ) + + radio_connection.post_signal(src, signal) + + return 1 + +/obj/machinery/atmospherics/unary/outlet_injector/initialize() + ..() + + set_frequency(frequency) + +/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return 0 + + if(signal.data["power"]) + on = text2num(signal.data["power"]) + + if(signal.data["power_toggle"]) + on = !on + + if(signal.data["inject"]) + spawn inject() + return + + if(signal.data["set_volume_rate"]) + var/number = text2num(signal.data["set_volume_rate"]) + volume_rate = between(0, number, air_contents.volume) + + if(signal.data["status"]) + spawn(2) + 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() + +/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i) + update_underlays() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index b755071487e..2c5f63f6079 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -50,6 +50,7 @@ break update_icon() + update_underlays() build_network() if(!network && node) @@ -85,4 +86,7 @@ del(network) node = null + update_icon() + update_underlays() + return null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index f4e9cb97509..e2cd25cfbad 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -4,8 +4,8 @@ #undefine /obj/machinery/atmospherics/unary/vent_pump - icon = 'icons/obj/atmospherics/vent_pump.dmi' - icon_state = "off" + icon = 'icons/atmos/vent_pump.dmi' + icon_state = "map_vent" name = "Air Vent" desc = "Has a valve and pump attached to it" @@ -40,316 +40,329 @@ var/radio_filter_out var/radio_filter_in - on - on = 1 - icon_state = "out" +/obj/machinery/atmospherics/unary/vent_pump/on + on = 1 + icon_state = "map_vent_out" - siphon - pump_direction = 0 - icon_state = "off" +/obj/machinery/atmospherics/unary/vent_pump/siphon + pump_direction = 0 - on - on = 1 - icon_state = "in" +/obj/machinery/atmospherics/unary/vent_pump/siphon/on + on = 1 + icon_state = "map_vent_in" - New() - initial_loc = get_area(loc) - if (initial_loc.master) - initial_loc = initial_loc.master - area_uid = initial_loc.uid - if (!id_tag) - assign_uid() - id_tag = num2text(uid) - if(ticker && ticker.current_state == 3)//if the game is running - src.initialize() - src.broadcast_status() - ..() +/obj/machinery/atmospherics/unary/vent_pump/New() + icon = null + initial_loc = get_area(loc) + if (initial_loc.master) + initial_loc = initial_loc.master + area_uid = initial_loc.uid + if (!id_tag) + assign_uid() + id_tag = num2text(uid) + if(ticker && ticker.current_state == 3)//if the game is running + src.initialize() + src.broadcast_status() + ..() - high_volume - name = "Large Air Vent" - power_channel = EQUIP - New() - ..() - air_contents.volume = 1000 +/obj/machinery/atmospherics/unary/vent_pump/high_volume + name = "Large Air Vent" + power_channel = EQUIP - update_icon() - if(welded) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld" - return - if(on && !(stat & (NOPOWER|BROKEN))) - if(pump_direction) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" +/obj/machinery/atmospherics/unary/vent_pump/high_volume/New() + ..() + air_contents.volume = 1000 +/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0) + if(!check_icon_cache()) return - process() - ..() - if(stat & (NOPOWER|BROKEN)) + overlays.Cut() + + var/vent_icon = "vent" + + var/turf/T = get_turf(src) + if(!istype(T)) + return + + if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe)) + vent_icon += "h" + + if(welded) + vent_icon += "weld" + else if(!powered()) + vent_icon += "off" + else + vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]" + + overlays += icon_manager.get_atmos_icon("device", , , vent_icon) + +/obj/machinery/atmospherics/unary/vent_pump/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) return - if (!node) - on = 0 - //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0 - if(!on) - return 0 - - if(welded) - return 0 - - var/datum/gas_mixture/environment = loc.return_air() - var/environment_pressure = environment.return_pressure() - - if(pump_direction) //internal -> external - var/pressure_delta = 10000 - - if(pressure_checks&1) - pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) - if(pressure_checks&2) - pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound)) - - if(pressure_delta > 0.5) - if(air_contents.temperature > 0) - var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) - - if(network) - network.update = 1 - - else //external -> internal - var/pressure_delta = 10000 - if(pressure_checks&1) - pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) - if(pressure_checks&2) - pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure())) - - if(pressure_delta > 0.5) - if(environment.temperature > 0) - var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) - if (isnull(removed)) //in space - return - - air_contents.merge(removed) - - if(network) - network.update = 1 - - return 1 - - //Radio remote control - - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency,radio_filter_in) - - broadcast_status() - if(!radio_connection) - return 0 - - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - - signal.data = list( - "area" = src.area_uid, - "tag" = src.id_tag, - "device" = "AVP", - "power" = on, - "direction" = pump_direction?("release"):("siphon"), - "checks" = pressure_checks, - "internal" = internal_pressure_bound, - "external" = external_pressure_bound, - "timestamp" = world.time, - "sigtype" = "status" - ) - - if(!initial_loc.air_vent_names[id_tag]) - var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]" - initial_loc.air_vent_names[id_tag] = new_name - src.name = new_name - initial_loc.air_vent_info[id_tag] = signal.data - - radio_connection.post_signal(src, signal, radio_filter_out) - - return 1 - - - initialize() - ..() - - //some vents work his own spesial way - radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null - radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null - if(frequency) - set_frequency(frequency) - - receive_signal(datum/signal/signal) - if(stat & (NOPOWER|BROKEN)) + if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe)) return - //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])") - if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) - return 0 + else + add_underlay(T, node, dir) - if(signal.data["purge"] != null) - pressure_checks &= ~1 - pump_direction = 0 +/obj/machinery/atmospherics/unary/vent_pump/hide() + update_icon() + update_underlays() - if(signal.data["stabalize"] != null) - pressure_checks |= 1 - pump_direction = 1 +/obj/machinery/atmospherics/unary/vent_pump/process() + ..() + if(stat & (NOPOWER|BROKEN)) + return + if (!node) + on = 0 + //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0 + if(!on) + return 0 - if(signal.data["power"] != null) - on = text2num(signal.data["power"]) + if(welded) + return 0 - if(signal.data["power_toggle"] != null) - on = !on + var/datum/gas_mixture/environment = loc.return_air() + var/environment_pressure = environment.return_pressure() - if(signal.data["checks"] != null) - if (signal.data["checks"] == "default") - pressure_checks = pressure_checks_default - else - pressure_checks = text2num(signal.data["checks"]) + if(pump_direction) //internal -> external + var/pressure_delta = 10000 - if(signal.data["checks_toggle"] != null) - pressure_checks = (pressure_checks?0:3) + if(pressure_checks&1) + pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) + if(pressure_checks&2) + pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound)) - if(signal.data["direction"] != null) - pump_direction = text2num(signal.data["direction"]) + if(pressure_delta > 0.5) + if(air_contents.temperature > 0) + var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION) - if(signal.data["set_internal_pressure"] != null) - if (signal.data["set_internal_pressure"] == "default") - internal_pressure_bound = internal_pressure_bound_default - else - internal_pressure_bound = between( - 0, - text2num(signal.data["set_internal_pressure"]), - ONE_ATMOSPHERE*50 - ) + var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - if(signal.data["set_external_pressure"] != null) - if (signal.data["set_external_pressure"] == "default") - external_pressure_bound = external_pressure_bound_default - else - external_pressure_bound = between( - 0, - text2num(signal.data["set_external_pressure"]), - ONE_ATMOSPHERE*50 - ) + loc.assume_air(removed) - if(signal.data["adjust_internal_pressure"] != null) + if(network) + network.update = 1 + + else //external -> internal + var/pressure_delta = 10000 + if(pressure_checks&1) + pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) + if(pressure_checks&2) + pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure())) + + if(pressure_delta > 0.5) + if(environment.temperature > 0) + var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) + + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if (isnull(removed)) //in space + return + + air_contents.merge(removed) + + if(network) + network.update = 1 + + return 1 + +//Radio remote control + +/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency,radio_filter_in) + +/obj/machinery/atmospherics/unary/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( + "area" = src.area_uid, + "tag" = src.id_tag, + "device" = "AVP", + "power" = on, + "direction" = pump_direction?("release"):("siphon"), + "checks" = pressure_checks, + "internal" = internal_pressure_bound, + "external" = external_pressure_bound, + "timestamp" = world.time, + "sigtype" = "status" + ) + + if(!initial_loc.air_vent_names[id_tag]) + var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]" + initial_loc.air_vent_names[id_tag] = new_name + src.name = new_name + initial_loc.air_vent_info[id_tag] = signal.data + + radio_connection.post_signal(src, signal, radio_filter_out) + + return 1 + + +/obj/machinery/atmospherics/unary/vent_pump/initialize() + ..() + + //some vents work his own spesial way + radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null + radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null + if(frequency) + set_frequency(frequency) + +/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal) + if(stat & (NOPOWER|BROKEN)) + return + //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])") + if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) + return 0 + + if(signal.data["purge"] != null) + pressure_checks &= ~1 + pump_direction = 0 + + if(signal.data["stabalize"] != null) + pressure_checks |= 1 + pump_direction = 1 + + if(signal.data["power"] != null) + on = text2num(signal.data["power"]) + + if(signal.data["power_toggle"] != null) + on = !on + + if(signal.data["checks"] != null) + if (signal.data["checks"] == "default") + pressure_checks = pressure_checks_default + else + pressure_checks = text2num(signal.data["checks"]) + + if(signal.data["checks_toggle"] != null) + pressure_checks = (pressure_checks?0:3) + + if(signal.data["direction"] != null) + pump_direction = text2num(signal.data["direction"]) + + if(signal.data["set_internal_pressure"] != null) + if (signal.data["set_internal_pressure"] == "default") + internal_pressure_bound = internal_pressure_bound_default + else internal_pressure_bound = between( 0, - internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]), + text2num(signal.data["set_internal_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["adjust_external_pressure"] != null) - - + if(signal.data["set_external_pressure"] != null) + if (signal.data["set_external_pressure"] == "default") + external_pressure_bound = external_pressure_bound_default + else external_pressure_bound = between( 0, - external_pressure_bound + text2num(signal.data["adjust_external_pressure"]), + text2num(signal.data["set_external_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["init"] != null) - name = signal.data["init"] - return + if(signal.data["adjust_internal_pressure"] != null) + internal_pressure_bound = between( + 0, + internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]), + ONE_ATMOSPHERE*50 + ) - if(signal.data["status"] != null) - spawn(2) - broadcast_status() - return //do not update_icon + if(signal.data["adjust_external_pressure"] != null) - //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") + + external_pressure_bound = between( + 0, + external_pressure_bound + text2num(signal.data["adjust_external_pressure"]), + ONE_ATMOSPHERE*50 + ) + + if(signal.data["init"] != null) + name = signal.data["init"] + return + + if(signal.data["status"] != null) spawn(2) broadcast_status() - update_icon() - return + return //do not update_icon - hide(var/i) //to make the little pipe section invisible, the icon changes. - if(welded) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld" - return - if(on&&node) - if(pump_direction) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - on = 0 - return + //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") + spawn(2) + broadcast_status() + update_icon() + return - attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = W - if (WT.remove_fuel(0,user)) - user << "\blue Now welding the vent." - if(do_after(user, 20)) - 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.") - welded = 1 - update_icon() - else - user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.") - welded = 0 - update_icon() +/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user) + if(istype(W, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/WT = W + if (WT.remove_fuel(0,user)) + user << "\blue Now welding the vent." + if(do_after(user, 20)) + 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.") + welded = 1 + update_icon() else - user << "\blue The welding tool needs to be on to start this task." + user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.") + welded = 0 + update_icon() else - user << "\blue You need more welding fuel to complete this task." - return 1 - examine() - set src in oview(1) - ..() - if(welded) - usr << "It seems welded shut." - - power_change() - if(powered(power_channel)) - stat &= ~NOPOWER + user << "\blue The welding tool needs to be on to start this task." else - stat |= NOPOWER + user << "\blue You need more welding fuel to complete this task." + return 1 + else + ..() + +/obj/machinery/atmospherics/unary/vent_pump/examine() + set src in oview(1) + ..() + if(welded) + usr << "It seems welded shut." + +/obj/machinery/atmospherics/unary/vent_pump/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (!(stat & NOPOWER) && on) - user << "\red You cannot unwrench this [src], turn it off first." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) +/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (!(stat & NOPOWER) && on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/turf/T = src.loc + if (node && node.level==1 && isturf(T) && T.intact) + user << "\red You must remove the plating first." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) /obj/machinery/atmospherics/unary/vent_pump/Del() if(initial_loc) diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 3845b9ad61b..05acdd16030 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -1,6 +1,6 @@ /obj/machinery/atmospherics/unary/vent_scrubber - icon = 'icons/obj/atmospherics/vent_scrubber.dmi' - icon_state = "off" + icon = 'icons/atmos/vent_scrubber.dmi' + icon_state = "map_scrubber" name = "Air Scrubber" desc = "Has a valve and pump attached to it" @@ -25,245 +25,259 @@ var/area_uid var/radio_filter_out var/radio_filter_in - New() - initial_loc = get_area(loc) - if (initial_loc.master) - initial_loc = initial_loc.master - area_uid = initial_loc.uid - if (!id_tag) - assign_uid() - id_tag = num2text(uid) - if(ticker && ticker.current_state == 3)//if the game is running - src.initialize() - src.broadcast_status() - ..() - update_icon() - if(node && on && !(stat & (NOPOWER|BROKEN))) - if(scrubbing) - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" +/obj/machinery/atmospherics/unary/vent_scrubber/New() + icon = null + initial_loc = get_area(loc) + if (initial_loc.master) + initial_loc = initial_loc.master + area_uid = initial_loc.uid + if (!id_tag) + assign_uid() + id_tag = num2text(uid) + if(ticker && ticker.current_state == 3)//if the game is running + src.initialize() + src.broadcast_status() + ..() + +/obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0) + if(!check_icon_cache()) return - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, radio_filter_in) + overlays.Cut() + + var/scrubber_icon = "scrubber" - broadcast_status() - if(!radio_connection) - return 0 + var/turf/T = get_turf(src) + if(!istype(T)) + return - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - signal.data = list( - "area" = area_uid, - "tag" = id_tag, - "device" = "AScr", - "timestamp" = world.time, - "power" = on, - "scrubbing" = scrubbing, - "panic" = panic, - "filter_co2" = scrub_CO2, - "filter_phoron" = scrub_Toxins, - "filter_n2o" = scrub_N2O, - "sigtype" = "status" - ) - if(!initial_loc.air_scrub_names[id_tag]) - var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]" - initial_loc.air_scrub_names[id_tag] = new_name - src.name = new_name - initial_loc.air_scrub_info[id_tag] = signal.data - radio_connection.post_signal(src, signal, radio_filter_out) + if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe)) + scrubber_icon += "h" + + if(!powered()) + scrubber_icon += "off" + else + scrubber_icon += "[on ? "[scrubbing ? "on" : "in"]" : "off"]" - return 1 + overlays += icon_manager.get_atmos_icon("device", , , scrubber_icon) - initialize() - ..() - radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null - radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null - if (frequency) - set_frequency(frequency) - - process() - ..() - if(stat & (NOPOWER|BROKEN)) +/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) return - if (!node) - on = 0 - //broadcast_status() - if(!on) - return 0 + if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe)) + return + else + add_underlay(T, node, dir) + +/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, radio_filter_in) + +/obj/machinery/atmospherics/unary/vent_scrubber/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( + "area" = area_uid, + "tag" = id_tag, + "device" = "AScr", + "timestamp" = world.time, + "power" = on, + "scrubbing" = scrubbing, + "panic" = panic, + "filter_co2" = scrub_CO2, + "filter_phoron" = scrub_Toxins, + "filter_n2o" = scrub_N2O, + "sigtype" = "status" + ) + if(!initial_loc.air_scrub_names[id_tag]) + var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]" + initial_loc.air_scrub_names[id_tag] = new_name + src.name = new_name + initial_loc.air_scrub_info[id_tag] = signal.data + radio_connection.post_signal(src, signal, radio_filter_out) + + return 1 + +/obj/machinery/atmospherics/unary/vent_scrubber/initialize() + ..() + radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null + radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null + if (frequency) + set_frequency(frequency) + +/obj/machinery/atmospherics/unary/vent_scrubber/process() + ..() + if(stat & (NOPOWER|BROKEN)) + return + if (!node) + on = 0 + //broadcast_status() + if(!on) + return 0 - var/datum/gas_mixture/environment = loc.return_air() + var/datum/gas_mixture/environment = loc.return_air() - if(scrubbing) - if((environment.phoron>0.001) || (environment.carbon_dioxide>0.001) || (environment.trace_gases.len>0)) - var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() + if(scrubbing) + if((environment.phoron>0.001) || (environment.carbon_dioxide>0.001) || (environment.trace_gases.len>0)) + var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() - //Take a gas sample - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) - if (isnull(removed)) //in space - return - - //Filter it - var/datum/gas_mixture/filtered_out = new - filtered_out.temperature = removed.temperature - if(scrub_Toxins) - filtered_out.phoron = removed.phoron - removed.phoron = 0 - if(scrub_CO2) - filtered_out.carbon_dioxide = removed.carbon_dioxide - removed.carbon_dioxide = 0 - - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - - - //Remix the resulting gases - air_contents.merge(filtered_out) - - loc.assume_air(removed) - - if(network) - network.update = 1 - - else //Just siphoning all air - if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) + //Take a gas sample + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if (isnull(removed)) //in space return - var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) + //Filter it + var/datum/gas_mixture/filtered_out = new + filtered_out.temperature = removed.temperature + if(scrub_Toxins) + filtered_out.phoron = removed.phoron + removed.phoron = 0 + if(scrub_CO2) + filtered_out.carbon_dioxide = removed.carbon_dioxide + removed.carbon_dioxide = 0 - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if(removed.trace_gases.len>0) + for(var/datum/gas/trace_gas in removed.trace_gases) + if(istype(trace_gas, /datum/gas/oxygen_agent_b)) + removed.trace_gases -= trace_gas + filtered_out.trace_gases += trace_gas + else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O) + removed.trace_gases -= trace_gas + filtered_out.trace_gases += trace_gas - air_contents.merge(removed) + + //Remix the resulting gases + air_contents.merge(filtered_out) + + loc.assume_air(removed) if(network) network.update = 1 - return 1 -/* //unused piece of code - hide(var/i) //to make the little pipe section invisible, the icon changes. - if(on&&node) - if(scrubbing) - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in" - else - icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off" - on = 0 + else //Just siphoning all air + if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) + return + + var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) + + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + + air_contents.merge(removed) + + if(network) + network.update = 1 + + return 1 + +/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes. + update_icon() + +/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal) + if(stat & (NOPOWER|BROKEN)) return -*/ + if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) + return 0 - receive_signal(datum/signal/signal) - if(stat & (NOPOWER|BROKEN)) - return - if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) - return 0 + if(signal.data["power"] != null) + on = text2num(signal.data["power"]) + if(signal.data["power_toggle"] != null) + on = !on - if(signal.data["power"] != null) - on = text2num(signal.data["power"]) - if(signal.data["power_toggle"] != null) - on = !on + if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing + panic = text2num(signal.data["panic_siphon"] != null) + if(panic) + on = 1 + scrubbing = 0 + volume_rate = 2000 + else + scrubbing = 1 + volume_rate = initial(volume_rate) + if(signal.data["toggle_panic_siphon"] != null) + panic = !panic + if(panic) + on = 1 + scrubbing = 0 + volume_rate = 2000 + else + scrubbing = 1 + volume_rate = initial(volume_rate) - if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing - panic = text2num(signal.data["panic_siphon"] != null) - if(panic) - on = 1 - scrubbing = 0 - volume_rate = 2000 - else - scrubbing = 1 - volume_rate = initial(volume_rate) - if(signal.data["toggle_panic_siphon"] != null) - panic = !panic - if(panic) - on = 1 - scrubbing = 0 - volume_rate = 2000 - else - scrubbing = 1 - volume_rate = initial(volume_rate) + if(signal.data["scrubbing"] != null) + scrubbing = text2num(signal.data["scrubbing"]) + if(signal.data["toggle_scrubbing"]) + scrubbing = !scrubbing - if(signal.data["scrubbing"] != null) - scrubbing = text2num(signal.data["scrubbing"]) - if(signal.data["toggle_scrubbing"]) - scrubbing = !scrubbing + if(signal.data["co2_scrub"] != null) + scrub_CO2 = text2num(signal.data["co2_scrub"]) + if(signal.data["toggle_co2_scrub"]) + scrub_CO2 = !scrub_CO2 - if(signal.data["co2_scrub"] != null) - scrub_CO2 = text2num(signal.data["co2_scrub"]) - if(signal.data["toggle_co2_scrub"]) - scrub_CO2 = !scrub_CO2 + if(signal.data["tox_scrub"] != null) + scrub_Toxins = text2num(signal.data["tox_scrub"]) + if(signal.data["toggle_tox_scrub"]) + scrub_Toxins = !scrub_Toxins - if(signal.data["tox_scrub"] != null) - scrub_Toxins = text2num(signal.data["tox_scrub"]) - if(signal.data["toggle_tox_scrub"]) - scrub_Toxins = !scrub_Toxins + if(signal.data["n2o_scrub"] != null) + scrub_N2O = text2num(signal.data["n2o_scrub"]) + if(signal.data["toggle_n2o_scrub"]) + scrub_N2O = !scrub_N2O - if(signal.data["n2o_scrub"] != null) - scrub_N2O = text2num(signal.data["n2o_scrub"]) - if(signal.data["toggle_n2o_scrub"]) - scrub_N2O = !scrub_N2O + if(signal.data["init"] != null) + name = signal.data["init"] + return - if(signal.data["init"] != null) - name = signal.data["init"] - return - - if(signal.data["status"] != null) - spawn(2) - broadcast_status() - return //do not update_icon - -// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") + if(signal.data["status"] != null) spawn(2) broadcast_status() - update_icon() - return + return //do not update_icon - power_change() - if(powered(power_channel)) - stat &= ~NOPOWER - else - stat |= NOPOWER +// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") + spawn(2) + broadcast_status() + update_icon() + return + +/obj/machinery/atmospherics/unary/vent_scrubber/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (!(stat & NOPOWER) && on) - user << "\red You cannot unwrench this [src], turn it off first." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) +/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (!(stat & NOPOWER) && on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/turf/T = src.loc + if (node && node.level==1 && isturf(T) && T.intact) + user << "\red You must remove the plating first." + return 1 + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) /obj/machinery/atmospherics/unary/vent_scrubber/Del() if(initial_loc) diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index 09d0b64f866..75282275ebd 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -1,10 +1,11 @@ -obj/machinery/atmospherics/valve - icon = 'icons/obj/atmospherics/valve.dmi' - icon_state = "valve0" +/obj/machinery/atmospherics/valve + icon = 'icons/atmos/valve.dmi' + icon_state = "map_valve0" name = "manual valve" desc = "A pipe valve" + level = 1 dir = SOUTH initialize_directions = SOUTH|NORTH @@ -17,322 +18,297 @@ obj/machinery/atmospherics/valve var/datum/pipe_network/network_node1 var/datum/pipe_network/network_node2 - open - open = 1 - icon_state = "valve1" +/obj/machinery/atmospherics/valve/open + open = 1 + icon_state = "map_valve1" - update_icon(animation) - if(animation) - flick("valve[src.open][!src.open]",src) - else - icon_state = "valve[open]" +/obj/machinery/atmospherics/valve/update_icon(animation) + if(animation) + flick("valve[src.open][!src.open]",src) + else + icon_state = "valve[open]" - New() - switch(dir) - if(NORTH || SOUTH) - initialize_directions = NORTH|SOUTH - if(EAST || WEST) - initialize_directions = EAST|WEST - ..() +/obj/machinery/atmospherics/valve/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + add_underlay(T, node1, get_dir(src, node1)) + add_underlay(T, node2, get_dir(src, node2)) - network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) +/obj/machinery/atmospherics/valve/hide(var/i) + update_underlays() +/obj/machinery/atmospherics/valve/New() + switch(dir) + if(NORTH || SOUTH) + initialize_directions = NORTH|SOUTH + if(EAST || WEST) + initialize_directions = EAST|WEST + ..() - if(reference == node1) - network_node1 = new_network - if(open) - network_node2 = new_network - else if(reference == node2) - network_node2 = new_network - if(open) - network_node1 = new_network - - if(new_network.normal_members.Find(src)) - return 0 - - new_network.normal_members += src - +/obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) + if(reference == node1) + network_node1 = new_network if(open) - if(reference == node1) - if(node2) - return node2.network_expand(new_network, src) - else if(reference == node2) - if(node1) - return node1.network_expand(new_network, src) + network_node2 = new_network + else if(reference == node2) + network_node2 = new_network + if(open) + network_node1 = new_network - return null + if(new_network.normal_members.Find(src)) + return 0 - Del() - loc = null + new_network.normal_members += src - if(node1) - node1.disconnect(src) - del(network_node1) - if(node2) - node2.disconnect(src) - del(network_node2) + if(open) + if(reference == node1) + if(node2) + return node2.network_expand(new_network, src) + else if(reference == node2) + if(node1) + return node1.network_expand(new_network, src) + return null + +/obj/machinery/atmospherics/valve/Del() + loc = null + + if(node1) + node1.disconnect(src) + del(network_node1) + if(node2) + node2.disconnect(src) + del(network_node2) + + node1 = null + node2 = null + + ..() + +/obj/machinery/atmospherics/valve/proc/open() + if(open) return 0 + + open = 1 + update_icon() + + if(network_node1&&network_node2) + network_node1.merge(network_node2) + network_node2 = network_node1 + + if(network_node1) + network_node1.update = 1 + else if(network_node2) + network_node2.update = 1 + + return 1 + +/obj/machinery/atmospherics/valve/proc/close() + if(!open) + return 0 + + open = 0 + update_icon() + + if(network_node1) + del(network_node1) + if(network_node2) + del(network_node2) + + build_network() + + return 1 + +/obj/machinery/atmospherics/valve/proc/normalize_dir() + if(dir==3) + dir = 1 + else if(dir==12) + dir = 4 + +/obj/machinery/atmospherics/valve/attack_ai(mob/user as mob) + return + +/obj/machinery/atmospherics/valve/attack_paw(mob/user as mob) + return attack_hand(user) + +/obj/machinery/atmospherics/valve/attack_hand(mob/user as mob) + src.add_fingerprint(usr) + update_icon(1) + sleep(10) + if (src.open) + src.close() + else + src.open() + +/obj/machinery/atmospherics/valve/process() + ..() + . = PROCESS_KILL + + return + +/obj/machinery/atmospherics/valve/initialize() + normalize_dir() + + var/node1_dir + var/node2_dir + + for(var/direction in cardinal) + if(direction&initialize_directions) + if (!node1_dir) + node1_dir = direction + else if (!node2_dir) + node2_dir = direction + + for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) + if(target.initialize_directions & get_dir(target,src)) + node1 = target + break + for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) + if(target.initialize_directions & get_dir(target,src)) + node2 = target + break + + build_network() + + update_icon() + update_underlays() + + if(openDuringInit) + close() + open() + openDuringInit = 0 + +/obj/machinery/atmospherics/valve/build_network() + if(!network_node1 && node1) + network_node1 = new /datum/pipe_network() + network_node1.normal_members += src + network_node1.build_network(node1, src) + + if(!network_node2 && node2) + network_node2 = new /datum/pipe_network() + network_node2.normal_members += src + network_node2.build_network(node2, src) + +/obj/machinery/atmospherics/valve/return_network(obj/machinery/atmospherics/reference) + build_network() + + if(reference==node1) + return network_node1 + + if(reference==node2) + return network_node2 + + return null + +/obj/machinery/atmospherics/valve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) + if(network_node1 == old_network) + network_node1 = new_network + if(network_node2 == old_network) + network_node2 = new_network + + return 1 + +/obj/machinery/atmospherics/valve/return_network_air(datum/network/reference) + return null + +/obj/machinery/atmospherics/valve/disconnect(obj/machinery/atmospherics/reference) + if(reference==node1) + del(network_node1) node1 = null + + else if(reference==node2) + del(network_node2) node2 = null - ..() + update_underlays() - proc/open() + return null - if(open) return 0 +/obj/machinery/atmospherics/valve/digital // can be controlled by AI + name = "digital valve" + desc = "A digitally controlled valve." + icon = 'icons/atmos/digital_valve.dmi' + + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection - open = 1 +/obj/machinery/atmospherics/valve/digital/attack_ai(mob/user as mob) + return src.attack_hand(user) + +/obj/machinery/atmospherics/valve/digital/attack_hand(mob/user as mob) + if(!powered()) + return + if(!src.allowed(user)) + user << "\red Access denied." + return + ..() + +/obj/machinery/atmospherics/valve/digital/open + open = 1 + icon_state = "map_valve1" + +/obj/machinery/atmospherics/valve/digital/power_change() + var/old_stat = stat + ..() + if(old_stat != stat) update_icon() - if(network_node1&&network_node2) - network_node1.merge(network_node2) - network_node2 = network_node1 +/obj/machinery/atmospherics/valve/digital/update_icon() + ..() + if(!powered()) + icon_state = "valve[open]nopower" - if(network_node1) - network_node1.update = 1 - else if(network_node2) - network_node2.update = 1 +/obj/machinery/atmospherics/valve/digital/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) - return 1 +/obj/machinery/atmospherics/valve/digital/initialize() + ..() + if(frequency) + set_frequency(frequency) - proc/close() +/obj/machinery/atmospherics/valve/digital/receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id)) + return 0 - if(!open) - return 0 + switch(signal.data["command"]) + if("valve_open") + if(!open) + open() - open = 0 - update_icon() + if("valve_close") + if(open) + close() - if(network_node1) - del(network_node1) - if(network_node2) - del(network_node2) - - build_network() - - return 1 - - proc/normalize_dir() - if(dir==3) - dir = 1 - else if(dir==12) - dir = 4 - - attack_ai(mob/user as mob) - return - - attack_paw(mob/user as mob) - return attack_hand(user) - - attack_hand(mob/user as mob) - src.add_fingerprint(usr) - update_icon(1) - sleep(10) - if (src.open) - src.close() - else - src.open() - - process() - ..() - . = PROCESS_KILL - -/* if(open && (!node1 || !node2)) - close() - if(!node1) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (!node2) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ - - return - - initialize() - normalize_dir() - - var/node1_dir - var/node2_dir - - for(var/direction in cardinal) - if(direction&initialize_directions) - if (!node1_dir) - node1_dir = direction - else if (!node2_dir) - node2_dir = direction - - for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) - if(target.initialize_directions & get_dir(target,src)) - node1 = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) - if(target.initialize_directions & get_dir(target,src)) - node2 = target - break - - build_network() - - if(openDuringInit) - close() - open() - openDuringInit = 0 - -/* - var/connect_directions - switch(dir) - if(NORTH) - connect_directions = NORTH|SOUTH - if(SOUTH) - connect_directions = NORTH|SOUTH - if(EAST) - connect_directions = EAST|WEST - if(WEST) - connect_directions = EAST|WEST + if("valve_toggle") + if(open) + close() else - connect_directions = dir - - for(var/direction in cardinal) - if(direction&connect_directions) - for(var/obj/machinery/atmospherics/target in get_step(src,direction)) - if(target.initialize_directions & get_dir(target,src)) - connect_directions &= ~direction - node1 = target - break - if(node1) - break - - for(var/direction in cardinal) - if(direction&connect_directions) - for(var/obj/machinery/atmospherics/target in get_step(src,direction)) - if(target.initialize_directions & get_dir(target,src)) - node2 = target - break - if(node1) - break -*/ - build_network() - if(!network_node1 && node1) - network_node1 = new /datum/pipe_network() - network_node1.normal_members += src - network_node1.build_network(node1, src) - - if(!network_node2 && node2) - network_node2 = new /datum/pipe_network() - network_node2.normal_members += src - network_node2.build_network(node2, src) - - - return_network(obj/machinery/atmospherics/reference) - build_network() - - if(reference==node1) - return network_node1 - - if(reference==node2) - return network_node2 - - return null - - reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) - if(network_node1 == old_network) - network_node1 = new_network - if(network_node2 == old_network) - network_node2 = new_network + open() +/obj/machinery/atmospherics/valve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (istype(src, /obj/machinery/atmospherics/valve/digital)) + user << "\red You cannot unwrench this [src], it's too complicated." return 1 - - return_network_air(datum/network/reference) - return null - - disconnect(obj/machinery/atmospherics/reference) - if(reference==node1) - del(network_node1) - node1 = null - - else if(reference==node2) - del(network_node2) - node2 = null - - return null - - digital // can be controlled by AI - name = "digital valve" - desc = "A digitally controlled valve." - icon = 'icons/obj/atmospherics/digital_valve.dmi' - - attack_ai(mob/user as mob) - return src.attack_hand(user) - - attack_hand(mob/user as mob) - if(!src.allowed(user)) - user << "\red Access denied." - return - ..() - - //Radio remote control - - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) - - var/frequency = 0 - var/id = null - var/datum/radio_frequency/radio_connection - - initialize() - ..() - if(frequency) - set_frequency(frequency) - - receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id)) - return 0 - - switch(signal.data["command"]) - if("valve_open") - if(!open) - open() - - if("valve_close") - if(open) - close() - - if("valve_toggle") - if(open) - close() - else - open() - - attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (!istype(W, /obj/item/weapon/wrench)) - return ..() - if (istype(src, /obj/machinery/atmospherics/valve/digital)) - user << "\red You cannot unwrench this [src], it's too complicated." - return 1 - var/turf/T = src.loc - if (level==1 && isturf(T) && T.intact) - user << "\red You must remove the plating first." - return 1 - var/datum/gas_mixture/int_air = return_air() - var/datum/gas_mixture/env_air = loc.return_air() - if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) - user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." - add_fingerprint(user) - return 1 - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - user << "\blue You begin to unfasten \the [src]..." - if (do_after(user, 40)) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "\blue You have unfastened \the [src].", \ - "You hear ratchet.") - new /obj/item/pipe(loc, make_from=src) - del(src) + var/datum/gas_mixture/int_air = return_air() + var/datum/gas_mixture/env_air = loc.return_air() + if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) + user << "\red You cannot unwrench this [src], it too exerted due to internal pressure." + add_fingerprint(user) + return 1 + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + user << "\blue You begin to unfasten \the [src]..." + if (do_after(user, 40)) + user.visible_message( \ + "[user] unfastens \the [src].", \ + "\blue You have unfastened \the [src].", \ + "You hear ratchet.") + new /obj/item/pipe(loc, make_from=src) + del(src) \ No newline at end of file diff --git a/code/ATMOSPHERICS/mapdebugging.dm b/code/ATMOSPHERICS/mapdebugging.dm deleted file mode 100644 index 2dc39497136..00000000000 --- a/code/ATMOSPHERICS/mapdebugging.dm +++ /dev/null @@ -1,16 +0,0 @@ -client/verb/discon_pipes() - set name = "Show Disconnected Pipes" - set category = "Debug" - - for(var/obj/machinery/atmospherics/pipe/simple/P in world) - if(!P.node1 || !P.node2) - usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]" - - for(var/obj/machinery/atmospherics/pipe/manifold/P in world) - if(!P.node1 || !P.node2 || !P.node3) - usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]" - - for(var/obj/machinery/atmospherics/pipe/manifold4w/P in world) - if(!P.node1 || !P.node2 || !P.node3 || !P.node4) - usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]" -//With thanks to mini. Check before use, uncheck after. Do Not Use on a live server. \ No newline at end of file diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 11daee64c3d..875c5a67ee5 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -1,4 +1,4 @@ -obj/machinery/atmospherics/pipe +/obj/machinery/atmospherics/pipe var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke var/datum/pipeline/parent @@ -12,51 +12,57 @@ obj/machinery/atmospherics/pipe var/alert_pressure = 80*ONE_ATMOSPHERE //minimum pressure before check_pressure(...) should be called -obj/machinery/atmospherics/pipe/proc/pipeline_expansion() +/obj/machinery/atmospherics/pipe/New() + ..() + //so pipes under walls are hidden + if(!istype(get_turf(src), /turf/simulated/floor)) + level = 1 + +/obj/machinery/atmospherics/pipe/proc/pipeline_expansion() return null -obj/machinery/atmospherics/pipe/proc/check_pressure(pressure) +/obj/machinery/atmospherics/pipe/proc/check_pressure(pressure) //Return 1 if parent should continue checking other pipes //Return null if parent should stop checking other pipes. Recall: del(src) will by default return null return 1 -obj/machinery/atmospherics/pipe/return_air() +/obj/machinery/atmospherics/pipe/return_air() if(!parent) parent = new /datum/pipeline() parent.build_pipeline(src) return parent.air -obj/machinery/atmospherics/pipe/build_network() +/obj/machinery/atmospherics/pipe/build_network() if(!parent) parent = new /datum/pipeline() parent.build_pipeline(src) return parent.return_network() -obj/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) +/obj/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) if(!parent) parent = new /datum/pipeline() parent.build_pipeline(src) return parent.network_expand(new_network, reference) -obj/machinery/atmospherics/pipe/return_network(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/return_network(obj/machinery/atmospherics/reference) if(!parent) parent = new /datum/pipeline() parent.build_pipeline(src) return parent.return_network(reference) -obj/machinery/atmospherics/pipe/Del() +/obj/machinery/atmospherics/pipe/Del() del(parent) if(air_temporary) loc.assume_air(air_temporary) ..() -obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) +/obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) if (istype(src, /obj/machinery/atmospherics/pipe/tank)) return ..() if (istype(src, /obj/machinery/atmospherics/pipe/vent)) @@ -91,10 +97,44 @@ obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/u del(meter) del(src) +/obj/machinery/atmospherics/proc/change_color(var/new_color) + //only pass valid pipe colors please ~otherwise your pipe will turn invisible + if(!pipe_color_check(new_color)) + return -obj/machinery/atmospherics/pipe/simple - icon = 'icons/obj/pipes.dmi' + pipe_color = new_color + update_icon() +/obj/machinery/atmospherics/pipe/add_underlay(var/obj/machinery/atmospherics/node, var/direction) + if(istype(src, /obj/machinery/atmospherics/pipe/tank)) //todo: move tanks to unary devices + return ..() + + if(node) + var/temp_dir = get_dir(src, node) + underlays += icon_manager.get_atmos_icon("pipe_underlay_intact", temp_dir, color_cache_name(node)) + return temp_dir + else if(direction) + underlays += icon_manager.get_atmos_icon("pipe_underlay_exposed", direction, pipe_color) + else + return null + +/obj/machinery/atmospherics/pipe/color_cache_name(var/obj/machinery/atmospherics/node) + if(istype(src, /obj/machinery/atmospherics/pipe/tank)) + return ..() + + if(istype(node, /obj/machinery/atmospherics/pipe/manifold) || istype(node, /obj/machinery/atmospherics/pipe/manifold4w)) + if(pipe_color == node.pipe_color) + return node.pipe_color + else + return null + else if(istype(node, /obj/machinery/atmospherics/pipe/simple)) + return node.pipe_color + else + return pipe_color + +/obj/machinery/atmospherics/pipe/simple + icon = 'icons/atmos/pipes.dmi' + icon_state = "intact" name = "pipe" desc = "A one meter section of regular pipe" @@ -113,12 +153,16 @@ obj/machinery/atmospherics/pipe/simple var/fatigue_pressure = 55*ONE_ATMOSPHERE alert_pressure = 55*ONE_ATMOSPHERE - level = 1 -obj/machinery/atmospherics/pipe/simple/New() +/obj/machinery/atmospherics/pipe/simple/New() ..() + + // Pipe colors and icon states are handled by an image cache - so color and icon should + // be null. For mapping purposes color is defined in the object definitions. + icon = null alpha = 255 + switch(dir) if(SOUTH || NORTH) initialize_directions = SOUTH|NORTH @@ -133,53 +177,18 @@ obj/machinery/atmospherics/pipe/simple/New() if(SOUTHWEST) initialize_directions = SOUTH|WEST - -obj/machinery/atmospherics/pipe/simple/hide(var/i) +/obj/machinery/atmospherics/pipe/simple/hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 update_icon() -obj/machinery/atmospherics/pipe/simple/process() +/obj/machinery/atmospherics/pipe/simple/process() if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle ..() else . = PROCESS_KILL - /*if(!node1) - parent.mingle_with_turf(loc, volume) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - - else if(!node2) - parent.mingle_with_turf(loc, volume) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 - - - else if(parent) - var/environment_temperature = 0 - - if(istype(loc, /turf/simulated/)) - if(loc:blocks_air) - environment_temperature = loc:temperature - else - var/datum/gas_mixture/environment = loc.return_air() - environment_temperature = environment.temperature - - else - environment_temperature = loc:temperature - - var/datum/gas_mixture/pipe_air = return_air() - - if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference) - parent.temperature_interact(loc, volume, thermal_conductivity) - */ //Screw you heat lag - -obj/machinery/atmospherics/pipe/simple/check_pressure(pressure) +/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure) var/datum/gas_mixture/environment = loc.return_air() var/pressure_difference = pressure - environment.return_pressure() @@ -194,7 +203,7 @@ obj/machinery/atmospherics/pipe/simple/check_pressure(pressure) else return 1 -obj/machinery/atmospherics/pipe/simple/proc/burst() +/obj/machinery/atmospherics/pipe/simple/proc/burst() src.visible_message("\red \bold [src] bursts!"); playsound(src.loc, 'sound/effects/bang.ogg', 25, 1) var/datum/effect/effect/system/smoke_spread/smoke = new @@ -202,13 +211,13 @@ obj/machinery/atmospherics/pipe/simple/proc/burst() smoke.start() del(src) -obj/machinery/atmospherics/pipe/simple/proc/normalize_dir() +/obj/machinery/atmospherics/pipe/simple/proc/normalize_dir() if(dir==3) dir = 1 else if(dir==12) dir = 4 -obj/machinery/atmospherics/pipe/simple/Del() +/obj/machinery/atmospherics/pipe/simple/Del() if(node1) node1.disconnect(src) if(node2) @@ -216,42 +225,42 @@ obj/machinery/atmospherics/pipe/simple/Del() ..() -obj/machinery/atmospherics/pipe/simple/pipeline_expansion() +/obj/machinery/atmospherics/pipe/simple/pipeline_expansion() return list(node1, node2) -obj/machinery/atmospherics/pipe/simple/update_icon() - switch(pipe_color) - if ("red") color = COLOR_RED - if ("blue") color = COLOR_BLUE - if ("cyan") color = COLOR_CYAN - if ("green") color = COLOR_GREEN - if ("yellow") color = "#FFCC00" - if ("purple") color = "#5C1EC0" - if ("grey") color = null +/obj/machinery/atmospherics/pipe/simple/change_color(var/new_color) + ..() + //for updating connected atmos device pipes (i.e. vents, manifolds, etc) + if(node1) + node1.update_underlays() + if(node2) + node2.update_underlays() - if(node1 && node2) - icon_state = "intact[invisibility ? "-f" : "" ]" +/obj/machinery/atmospherics/pipe/simple/update_icon(var/safety = 0) + if(!check_icon_cache()) + return - //var/node1_direction = get_dir(src, node1) - //var/node2_direction = get_dir(src, node2) + alpha = 255 - //dir = node1_direction|node2_direction + overlays.Cut() + if(!node1 && !node2) + var/turf/T = get_turf(src) + new /obj/item/pipe(loc, make_from=src) + for (var/obj/machinery/meter/meter in T) + if (meter.target == src) + new /obj/item/pipe_meter(T) + del(meter) + del(src) + else if(node1 && node2) + overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "intact") else - if(!node1 && !node2) - var/turf/T = get_turf(src) - new /obj/item/pipe(loc, make_from=src) - for (var/obj/machinery/meter/meter in T) - if (meter.target == src) - new /obj/item/pipe_meter(T) - del(meter) - del(src) - var/have_node1 = node1?1:0 - var/have_node2 = node2?1:0 - icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]" + overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "exposed[node1?1:0][node2?1:0]") +/obj/machinery/atmospherics/pipe/simple/update_underlays() + return -obj/machinery/atmospherics/pipe/simple/initialize() +/obj/machinery/atmospherics/pipe/simple/initialize() normalize_dir() var/node1_dir var/node2_dir @@ -276,12 +285,12 @@ obj/machinery/atmospherics/pipe/simple/initialize() del(src) return - var/turf/T = src.loc // hide if turf is not intact - hide(T.intact) + var/turf/T = get_turf(src) + if(istype(T)) + hide(T.intact) update_icon() - //update_icon() -obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) @@ -296,55 +305,54 @@ obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/ref return null - - - -obj/machinery/atmospherics/pipe/simple/visible +/obj/machinery/atmospherics/pipe/simple/visible level = 2 - icon_state = "intact" -obj/machinery/atmospherics/pipe/simple/visible/scrubbers - name="Scrubbers pipe" - color=COLOR_RED +/obj/machinery/atmospherics/pipe/simple/visible/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/simple/visible/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/simple/visible/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/simple/visible/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/simple/visible/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/simple/visible/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/simple/visible/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/simple/visible/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/simple/visible/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/simple/visible/purple + color = PIPE_COLOR_PURPLE -obj/machinery/atmospherics/pipe/simple/hidden +/obj/machinery/atmospherics/pipe/simple/hidden level = 1 - icon_state = "intact-f" - alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game + alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game -obj/machinery/atmospherics/pipe/simple/hidden/scrubbers - name="Scrubbers pipe" - color=COLOR_RED +/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/simple/hidden/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/simple/hidden/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/simple/hidden/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/simple/hidden/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/simple/hidden/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/simple/hidden/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/simple/hidden/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/simple/hidden/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/simple/hidden/purple + color = PIPE_COLOR_PURPLE -obj/machinery/atmospherics/pipe/simple/insulated +/obj/machinery/atmospherics/pipe/simple/insulated icon = 'icons/obj/atmospherics/red_pipe.dmi' icon_state = "intact" @@ -357,9 +365,9 @@ obj/machinery/atmospherics/pipe/simple/insulated level = 2 -obj/machinery/atmospherics/pipe/manifold - icon = 'icons/obj/atmospherics/pipe_manifold.dmi' - +/obj/machinery/atmospherics/pipe/manifold + icon = 'icons/atmos/manifold.dmi' + icon_state = "map" name = "pipe manifold" desc = "A manifold composed of regular pipes" @@ -375,8 +383,11 @@ obj/machinery/atmospherics/pipe/manifold level = 1 layer = 2.4 //under wires with their 2.44 -obj/machinery/atmospherics/pipe/manifold/New() +/obj/machinery/atmospherics/pipe/manifold/New() + ..() alpha = 255 + icon = null + switch(dir) if(NORTH) initialize_directions = EAST|SOUTH|WEST @@ -387,43 +398,21 @@ obj/machinery/atmospherics/pipe/manifold/New() if(WEST) initialize_directions = NORTH|EAST|SOUTH - ..() - - - -obj/machinery/atmospherics/pipe/manifold/hide(var/i) +/obj/machinery/atmospherics/pipe/manifold/hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 update_icon() -obj/machinery/atmospherics/pipe/manifold/pipeline_expansion() +/obj/machinery/atmospherics/pipe/manifold/pipeline_expansion() return list(node1, node2, node3) -obj/machinery/atmospherics/pipe/manifold/process() +/obj/machinery/atmospherics/pipe/manifold/process() if(!parent) ..() else . = PROCESS_KILL -/* - if(!node1) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node2) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node3) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ -obj/machinery/atmospherics/pipe/manifold/Del() + +/obj/machinery/atmospherics/pipe/manifold/Del() if(node1) node1.disconnect(src) if(node2) @@ -433,7 +422,7 @@ obj/machinery/atmospherics/pipe/manifold/Del() ..() -obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) @@ -453,40 +442,51 @@ obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/r ..() -obj/machinery/atmospherics/pipe/manifold/update_icon() - if(node1&&node2&&node3) - switch(pipe_color) - if ("red") color = COLOR_RED - if ("blue") color = COLOR_BLUE - if ("cyan") color = COLOR_CYAN - if ("green") color = COLOR_GREEN - if ("yellow") color = "#FFCC00" - if ("purple") color = "#5C1EC0" - if ("grey") color = null - icon_state = "manifold[invisibility ? "-f" : "" ]" +/obj/machinery/atmospherics/pipe/manifold/change_color(var/new_color) + ..() + //for updating connected atmos device pipes (i.e. vents, manifolds, etc) + if(node1) + node1.update_underlays() + if(node2) + node2.update_underlays() + if(node3) + node3.update_underlays() +/obj/machinery/atmospherics/pipe/manifold/update_icon(var/safety = 0) + if(!check_icon_cache()) + return + + alpha = 255 + + if(!node1 && !node2 && !node3) + var/turf/T = get_turf(src) + new /obj/item/pipe(loc, make_from=src) + for (var/obj/machinery/meter/meter in T) + if (meter.target == src) + new /obj/item/pipe_meter(T) + del(meter) + del(src) else - var/connected = 0 - var/unconnected = 0 - var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir) + overlays.Cut() + overlays += icon_manager.get_atmos_icon("manifold", , pipe_color, "core") + overlays += icon_manager.get_atmos_icon("manifold", , , "clamps") + underlays.Cut() + + var/list/directions = list(NORTH, SOUTH, EAST, WEST) + directions -= dir - if(node1) - connected |= get_dir(src, node1) - if(node2) - connected |= get_dir(src, node2) - if(node3) - connected |= get_dir(src, node3) + directions -= add_underlay(node1) + directions -= add_underlay(node2) + directions -= add_underlay(node3) - unconnected = (~connected)&(connect_directions) + for(var/D in directions) + add_underlay(,D) - icon_state = "manifold_[connected]_[unconnected]" +/obj/machinery/atmospherics/pipe/manifold/update_underlays() + ..() + update_icon() - if(!connected) - del(src) - - return - -obj/machinery/atmospherics/pipe/manifold/initialize() +/obj/machinery/atmospherics/pipe/manifold/initialize() var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir) for(var/direction in cardinal) @@ -521,61 +521,61 @@ obj/machinery/atmospherics/pipe/manifold/initialize() if (node3) break - var/turf/T = src.loc // hide if turf is not intact - hide(T.intact) - //update_icon() + var/turf/T = get_turf(src) + if(istype(T)) + hide(T.intact) update_icon() - -obj/machinery/atmospherics/pipe/manifold/visible +/obj/machinery/atmospherics/pipe/manifold/visible level = 2 - icon_state = "manifold" -obj/machinery/atmospherics/pipe/manifold/visible/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/manifold/visible/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/manifold/visible/scrubbers - name="Scrubbers pipe" - color=COLOR_RED +/obj/machinery/atmospherics/pipe/manifold/visible/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/manifold/visible/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/manifold/visible/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/manifold/visible/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/manifold/visible/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/manifold/visible/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold/visible/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold/visible/purple + color = PIPE_COLOR_PURPLE -obj/machinery/atmospherics/pipe/manifold/hidden +/obj/machinery/atmospherics/pipe/manifold/hidden level = 1 - icon_state = "manifold-f" - alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game + alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game -obj/machinery/atmospherics/pipe/manifold/hidden/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers - name="Scrubbers pipe" - color = COLOR_RED +/obj/machinery/atmospherics/pipe/manifold/hidden/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/manifold/hidden/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/manifold/hidden/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/manifold/hidden/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/manifold/hidden/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/manifold/hidden/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold/hidden/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold/hidden/purple + color = PIPE_COLOR_PURPLE - -obj/machinery/atmospherics/pipe/manifold4w - icon = 'icons/obj/atmospherics/pipe_manifold.dmi' - +/obj/machinery/atmospherics/pipe/manifold4w + icon = 'icons/atmos/manifold.dmi' + icon_state = "map_4way" name = "4-way pipe manifold" desc = "A manifold composed of regular pipes" @@ -592,43 +592,21 @@ obj/machinery/atmospherics/pipe/manifold4w level = 1 layer = 2.4 //under wires with their 2.44 -obj/machinery/atmospherics/pipe/manifold4w/New() +/obj/machinery/atmospherics/pipe/manifold4w/New() ..() alpha = 255 + icon = null -obj/machinery/atmospherics/pipe/manifold4w/hide(var/i) - if(level == 1 && istype(loc, /turf/simulated)) - invisibility = i ? 101 : 0 - update_icon() - -obj/machinery/atmospherics/pipe/manifold4w/pipeline_expansion() +/obj/machinery/atmospherics/pipe/manifold4w/pipeline_expansion() return list(node1, node2, node3, node4) -obj/machinery/atmospherics/pipe/manifold4w/process() +/obj/machinery/atmospherics/pipe/manifold4w/process() if(!parent) ..() else . = PROCESS_KILL -/* - if(!node1) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node2) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node3) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ -obj/machinery/atmospherics/pipe/manifold4w/Del() + +/obj/machinery/atmospherics/pipe/manifold4w/Del() if(node1) node1.disconnect(src) if(node2) @@ -640,7 +618,7 @@ obj/machinery/atmospherics/pipe/manifold4w/Del() ..() -obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) @@ -665,37 +643,58 @@ obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics ..() -obj/machinery/atmospherics/pipe/manifold4w/update_icon() - overlays.Cut() - if(node1&&node2&&node3&&node4) - switch(pipe_color) - if ("red") color = COLOR_RED - if ("blue") color = COLOR_BLUE - if ("cyan") color = COLOR_CYAN - if ("green") color = COLOR_GREEN - if ("yellow") color = "#FFCC00" - if ("purple") color = "#5C1EC0" - if ("grey") color = null - icon_state = "manifold4w[invisibility ? "-f" : "" ]" +/obj/machinery/atmospherics/pipe/manifold4w/change_color(var/new_color) + ..() + //for updating connected atmos device pipes (i.e. vents, manifolds, etc) + if(node1) + node1.update_underlays() + if(node2) + node2.update_underlays() + if(node3) + node3.update_underlays() + if(node4) + node4.update_underlays() +/obj/machinery/atmospherics/pipe/manifold4w/update_icon(var/safety = 0) + if(!check_icon_cache()) + return + + alpha = 255 + + if(!node1 && !node2 && !node3 && !node4) + var/turf/T = get_turf(src) + new /obj/item/pipe(loc, make_from=src) + for (var/obj/machinery/meter/meter in T) + if (meter.target == src) + new /obj/item/pipe_meter(T) + del(meter) + del(src) else - icon_state = "manifold4w_ex" - var/icon/con = new/icon('icons/obj/atmospherics/pipe_manifold.dmi',"manifold4w_con") //Since 4-ways are supposed to be directionless, they need an overlay instead it seems. + overlays.Cut() + overlays += icon_manager.get_atmos_icon("manifold", , pipe_color, "4way") + overlays += icon_manager.get_atmos_icon("manifold", , , "clamps_4way") + underlays.Cut() + + var/list/directions = list(NORTH, SOUTH, EAST, WEST) - if(node1) - overlays += new/image(con,dir=1) - if(node2) - overlays += new/image(con,dir=2) - if(node3) - overlays += new/image(con,dir=4) - if(node4) - overlays += new/image(con,dir=8) + directions -= add_underlay(node1) + directions -= add_underlay(node2) + directions -= add_underlay(node3) + directions -= add_underlay(node4) - if(!node1 && !node2 && !node3 && !node4) - del(src) - return + for(var/D in directions) + add_underlay(,D) -obj/machinery/atmospherics/pipe/manifold4w/initialize() +/obj/machinery/atmospherics/pipe/manifold4w/update_underlays() + ..() + update_icon() + +/obj/machinery/atmospherics/pipe/manifold4w/hide(var/i) + if(level == 1 && istype(loc, /turf/simulated)) + invisibility = i ? 101 : 0 + update_icon() + +/obj/machinery/atmospherics/pipe/manifold4w/initialize() for(var/obj/machinery/atmospherics/target in get_step(src,1)) if(target.initialize_directions & 2) @@ -717,58 +716,59 @@ obj/machinery/atmospherics/pipe/manifold4w/initialize() node4 = target break - var/turf/T = src.loc // hide if turf is not intact - hide(T.intact) - //update_icon() + var/turf/T = get_turf(src) + if(istype(T)) + hide(T.intact) update_icon() - -obj/machinery/atmospherics/pipe/manifold4w/visible +/obj/machinery/atmospherics/pipe/manifold4w/visible level = 2 - icon_state = "manifold4w" -obj/machinery/atmospherics/pipe/manifold4w/visible/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers - name="Scrubbers pipe" - color=COLOR_RED +/obj/machinery/atmospherics/pipe/manifold4w/visible/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/manifold4w/visible/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/manifold4w/visible/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/manifold4w/visible/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/manifold4w/visible/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/manifold4w/visible/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold4w/visible/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold4w/visible/purple + color = PIPE_COLOR_PURPLE -obj/machinery/atmospherics/pipe/manifold4w/hidden +/obj/machinery/atmospherics/pipe/manifold4w/hidden level = 1 - icon_state = "manifold4w-f" - alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game + alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game -obj/machinery/atmospherics/pipe/manifold4w/hidden/supply - name="Air supply pipe" - color=COLOR_BLUE +/obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers + name = "Scrubbers pipe" + color = PIPE_COLOR_RED -obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers - name="Scrubbers pipe" - color=COLOR_RED +/obj/machinery/atmospherics/pipe/manifold4w/hidden/supply + name = "Air supply pipe" + color = PIPE_COLOR_BLUE -obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow - color="#FFCC00" +/obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow + color = PIPE_COLOR_YELLOW -obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan - color=COLOR_CYAN +/obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan + color = PIPE_COLOR_CYAN -obj/machinery/atmospherics/pipe/manifold4w/hidden/green - color=COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold4w/hidden/green + color = PIPE_COLOR_GREEN +/obj/machinery/atmospherics/pipe/manifold4w/hidden/purple + color = PIPE_COLOR_PURPLE -obj/machinery/atmospherics/pipe/cap +/obj/machinery/atmospherics/pipe/cap name = "pipe endcap" desc = "An endcap for pipes" icon = 'icons/obj/pipes.dmi' @@ -783,7 +783,7 @@ obj/machinery/atmospherics/pipe/cap var/obj/machinery/atmospherics/node -obj/machinery/atmospherics/pipe/cap/New() +/obj/machinery/atmospherics/pipe/cap/New() ..() switch(dir) if(SOUTH) @@ -795,26 +795,26 @@ obj/machinery/atmospherics/pipe/cap/New() if(EAST) initialize_directions = WEST -obj/machinery/atmospherics/pipe/cap/hide(var/i) +/obj/machinery/atmospherics/pipe/cap/hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 update_icon() -obj/machinery/atmospherics/pipe/cap/pipeline_expansion() +/obj/machinery/atmospherics/pipe/cap/pipeline_expansion() return list(node) -obj/machinery/atmospherics/pipe/cap/process() +/obj/machinery/atmospherics/pipe/cap/process() if(!parent) ..() else . = PROCESS_KILL -obj/machinery/atmospherics/pipe/cap/Del() +/obj/machinery/atmospherics/pipe/cap/Del() if(node) node.disconnect(src) ..() -obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/reference) if(reference == node) if(istype(node, /obj/machinery/atmospherics/pipe)) del(parent) @@ -824,13 +824,13 @@ obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/refere ..() -obj/machinery/atmospherics/pipe/cap/update_icon() +/obj/machinery/atmospherics/pipe/cap/update_icon() overlays = new() icon_state = "cap[invisibility ? "-f" : ""]" return -obj/machinery/atmospherics/pipe/cap/initialize() +/obj/machinery/atmospherics/pipe/cap/initialize() for(var/obj/machinery/atmospherics/target in get_step(src, dir)) if(target.initialize_directions & get_dir(target,src)) node = target @@ -838,151 +838,65 @@ obj/machinery/atmospherics/pipe/cap/initialize() var/turf/T = src.loc // hide if turf is not intact hide(T.intact) - //update_icon() update_icon() -obj/machinery/atmospherics/pipe/cap/visible +/obj/machinery/atmospherics/pipe/cap/visible level = 2 icon_state = "cap" -obj/machinery/atmospherics/pipe/cap/hidden +/obj/machinery/atmospherics/pipe/cap/hidden level = 1 icon_state = "cap-f" -obj/machinery/atmospherics/pipe/tank - icon = 'icons/obj/atmospherics/pipe_tank.dmi' - icon_state = "intact" +/obj/machinery/atmospherics/pipe/tank + icon = 'icons/atmos/tank.dmi' + icon_state = "air_map" name = "Pressure Tank" desc = "A large vessel containing pressurized gas." - volume = 2000 //in liters, 1 meters by 1 meters by 2 meters + volume = 10000 //in liters, 1 meters by 1 meters by 2 meters ~tweaked it a little to simulate a pressure tank without needing to recode them yet + level = 1 dir = SOUTH initialize_directions = SOUTH density = 1 var/obj/machinery/atmospherics/node1 -obj/machinery/atmospherics/pipe/tank/New() +/obj/machinery/atmospherics/pipe/tank/New() + icon_state = "air" initialize_directions = dir ..() -obj/machinery/atmospherics/pipe/tank/process() +/obj/machinery/atmospherics/pipe/tank/process() if(!parent) ..() else . = PROCESS_KILL -/* if(!node1) - parent.mingle_with_turf(loc, 200) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ -obj/machinery/atmospherics/pipe/tank/carbon_dioxide - name = "Pressure Tank (Carbon Dioxide)" - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T20C - - air_temporary.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - ..() - -obj/machinery/atmospherics/pipe/tank/phoron - icon = 'icons/obj/atmospherics/orange_pipe_tank.dmi' - name = "Pressure Tank (Phoron)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T20C - - air_temporary.phoron = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - ..() - -obj/machinery/atmospherics/pipe/tank/oxygen_agent_b - icon = 'icons/obj/atmospherics/red_orange_pipe_tank.dmi' - name = "Pressure Tank (Oxygen + Phoron)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T0C - - var/datum/gas/oxygen_agent_b/trace_gas = new - trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - air_temporary.trace_gases += trace_gas - - ..() - -obj/machinery/atmospherics/pipe/tank/oxygen - icon = 'icons/obj/atmospherics/blue_pipe_tank.dmi' - name = "Pressure Tank (Oxygen)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T20C - - air_temporary.oxygen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - ..() - -obj/machinery/atmospherics/pipe/tank/nitrogen - icon = 'icons/obj/atmospherics/red_pipe_tank.dmi' - name = "Pressure Tank (Nitrogen)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T20C - - air_temporary.nitrogen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - ..() - -obj/machinery/atmospherics/pipe/tank/air - icon = 'icons/obj/atmospherics/red_pipe_tank.dmi' - name = "Pressure Tank (Air)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T20C - - air_temporary.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - air_temporary.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - ..() - -obj/machinery/atmospherics/pipe/tank/Del() +/obj/machinery/atmospherics/pipe/tank/Del() if(node1) node1.disconnect(src) ..() -obj/machinery/atmospherics/pipe/tank/pipeline_expansion() +/obj/machinery/atmospherics/pipe/tank/pipeline_expansion() return list(node1) -obj/machinery/atmospherics/pipe/tank/update_icon() - if(node1) - icon_state = "intact" +/obj/machinery/atmospherics/pipe/tank/update_underlays() + if(..()) + underlays.Cut() + var/turf/T = get_turf(src) + if(!istype(T)) + return + add_underlay(T, node1, dir) - dir = get_dir(src, node1) - - else - icon_state = "exposed" - -obj/machinery/atmospherics/pipe/tank/initialize() +/obj/machinery/atmospherics/pipe/tank/hide() + update_underlays() +/obj/machinery/atmospherics/pipe/tank/initialize() var/connect_direction = dir for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction)) @@ -990,20 +904,23 @@ obj/machinery/atmospherics/pipe/tank/initialize() node1 = target break - update_icon() + update_underlays() -obj/machinery/atmospherics/pipe/tank/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/tank/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) node1 = null - update_icon() + update_underlays() return null -obj/machinery/atmospherics/pipe/tank/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) - if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1) +/obj/machinery/atmospherics/pipe/tank/attackby(var/obj/item/W as obj, var/mob/user as mob) + if(istype(W, /obj/item/device/pipe_painter)) + return + + if(istype(W, /obj/item/device/analyzer) && in_range(user, src)) for (var/mob/O in viewers(user, null)) O << "\red [user] has used the analyzer on \icon[icon]" @@ -1030,7 +947,95 @@ obj/machinery/atmospherics/pipe/tank/attackby(var/obj/item/weapon/W as obj, var/ else user << "\blue Tank is empty!" -obj/machinery/atmospherics/pipe/vent +/obj/machinery/atmospherics/pipe/tank/air + name = "Pressure Tank (Air)" + icon_state = "air_map" + +/obj/machinery/atmospherics/pipe/tank/air/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T20C + + air_temporary.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + air_temporary.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + ..() + icon_state = "air" + +/obj/machinery/atmospherics/pipe/tank/oxygen + name = "Pressure Tank (Oxygen)" + icon_state = "o2_map" + +/obj/machinery/atmospherics/pipe/tank/oxygen/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T20C + + air_temporary.oxygen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + ..() + icon_state = "o2" + +/obj/machinery/atmospherics/pipe/tank/nitrogen + name = "Pressure Tank (Nitrogen)" + icon_state = "n2_map" + +/obj/machinery/atmospherics/pipe/tank/nitrogen/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T20C + + air_temporary.nitrogen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + ..() + icon_state = "n2" + +/obj/machinery/atmospherics/pipe/tank/carbon_dioxide + name = "Pressure Tank (Carbon Dioxide)" + icon_state = "co2_map" + +/obj/machinery/atmospherics/pipe/tank/carbon_dioxide/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T20C + + air_temporary.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + ..() + icon_state = "co2" + +/obj/machinery/atmospherics/pipe/tank/phoron + name = "Pressure Tank (Phoron)" + icon_state = "phoron_map" + +/obj/machinery/atmospherics/pipe/tank/phoron/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T20C + + air_temporary.phoron = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + ..() + icon_state = "phoron" + +/obj/machinery/atmospherics/pipe/tank/nitrous_oxide + name = "Pressure Tank (Nitrous Oxide)" + icon_state = "n2o_map" + +/obj/machinery/atmospherics/pipe/tank/nitrous_oxide/New() + air_temporary = new + air_temporary.volume = volume + air_temporary.temperature = T0C + + var/datum/gas/sleeping_agent/trace_gas = new + trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) + + air_temporary.trace_gases += trace_gas + + ..() + icon_state = "n2o" + +/obj/machinery/atmospherics/pipe/vent icon = 'icons/obj/atmospherics/pipe_vent.dmi' icon_state = "intact" @@ -1048,15 +1053,15 @@ obj/machinery/atmospherics/pipe/vent var/obj/machinery/atmospherics/node1 -obj/machinery/atmospherics/pipe/vent/New() +/obj/machinery/atmospherics/pipe/vent/New() initialize_directions = dir ..() -obj/machinery/atmospherics/pipe/vent/high_volume +/obj/machinery/atmospherics/pipe/vent/high_volume name = "Larger vent" volume = 1000 -obj/machinery/atmospherics/pipe/vent/process() +/obj/machinery/atmospherics/pipe/vent/process() if(!parent) if(build_killswitch <= 0) . = PROCESS_KILL @@ -1066,24 +1071,17 @@ obj/machinery/atmospherics/pipe/vent/process() return else parent.mingle_with_turf(loc, volume) -/* - if(!node1) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ -obj/machinery/atmospherics/pipe/vent/Del() + +/obj/machinery/atmospherics/pipe/vent/Del() if(node1) node1.disconnect(src) ..() -obj/machinery/atmospherics/pipe/vent/pipeline_expansion() +/obj/machinery/atmospherics/pipe/vent/pipeline_expansion() return list(node1) -obj/machinery/atmospherics/pipe/vent/update_icon() +/obj/machinery/atmospherics/pipe/vent/update_icon() if(node1) icon_state = "intact" @@ -1092,7 +1090,7 @@ obj/machinery/atmospherics/pipe/vent/update_icon() else icon_state = "exposed" -obj/machinery/atmospherics/pipe/vent/initialize() +/obj/machinery/atmospherics/pipe/vent/initialize() var/connect_direction = dir for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction)) @@ -1102,7 +1100,7 @@ obj/machinery/atmospherics/pipe/vent/initialize() update_icon() -obj/machinery/atmospherics/pipe/vent/disconnect(obj/machinery/atmospherics/reference) +/obj/machinery/atmospherics/pipe/vent/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) @@ -1112,7 +1110,7 @@ obj/machinery/atmospherics/pipe/vent/disconnect(obj/machinery/atmospherics/refer return null -obj/machinery/atmospherics/pipe/vent/hide(var/i) //to make the little pipe section invisible, the icon changes. +/obj/machinery/atmospherics/pipe/vent/hide(var/i) //to make the little pipe section invisible, the icon changes. if(node1) icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact" dir = get_dir(src, node1) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index cb52b2252fa..2ae5d1db1e8 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -79,13 +79,6 @@ datum/controller/game_controller/proc/setup() for(var/i=0, iGenerating resource distribution map." + var/datum/ore_distribution/O = new() + O.populate_distribution_map() + + //Set up spawn points. + populate_spawn_points() + + //Set up gear list. + populate_gear_list() + world << "\red \b Initializations complete." sleep(-1) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 64408038f6e..c8be3a2351a 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -346,9 +346,42 @@ var/global/datum/controller/occupations/job_master proc/EquipRank(var/mob/living/carbon/human/H, var/rank, var/joined_late = 0) + if(!H) return 0 + var/datum/job/job = GetJob(rank) + var/list/spawn_in_storage = list() + if(job) + + //Equip custom gear loadout. + if(H.client.prefs.gear && H.client.prefs.gear.len) + + for(var/thing in H.client.prefs.gear) + var/datum/gear/G = gear_datums[thing] + if(G) + var/permitted + if(G.allowed_roles) + for(var/job_name in G.allowed_roles) + if(job.title == job_name) + permitted = 1 + else + permitted = 1 + + if(G.whitelisted && !is_alien_whitelisted(H, G.whitelisted)) + permitted = 0 + + if(!permitted) + H << "\red Your current job or whitelist status does not permit you to spawn with [thing]!" + continue + + if(G.slot) + H.equip_to_slot_or_del(new G.path(H), G.slot) + else + spawn_in_storage += thing + + + //Equip job items. job.equip(H) else H << "Your job is [rank] and the game just can't handle it! Please report this bug to an administrator." @@ -428,17 +461,28 @@ var/global/datum/controller/occupations/job_master new /obj/item/weapon/storage/box/survival(BPK) H.equip_to_slot_or_del(BPK, slot_back,1) + //Deferred item spawning. + var/obj/item/weapon/storage/B = locate(/obj/item/weapon/storage/backpack) in H.contents + + if(isnull(B) || istype(B)) + B = locate(/obj/item/weapon/storage/box) in H.contents + + if(!isnull(B)) + for(var/thing in spawn_in_storage) + var/datum/gear/G = gear_datums[thing] + new G.path(B) + //TODO: Generalize this by-species if(H.species) if(H.species.name == "Tajaran" || H.species.name == "Unathi") H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(H),slot_shoes,1) else if(H.species.name == "Vox") - H.equip_to_slot_or_del(new /obj/item/clothing/mask/breath(src), slot_wear_mask) + H.equip_to_slot_or_del(new /obj/item/clothing/mask/breath(H), slot_wear_mask) if(!H.r_hand) - H.equip_to_slot_or_del(new /obj/item/weapon/tank/nitrogen(src), slot_r_hand) + H.equip_to_slot_or_del(new /obj/item/weapon/tank/nitrogen(H), slot_r_hand) H.internal = H.r_hand else if (!H.l_hand) - H.equip_to_slot_or_del(new /obj/item/weapon/tank/nitrogen(src), slot_l_hand) + H.equip_to_slot_or_del(new /obj/item/weapon/tank/nitrogen(H), slot_l_hand) H.internal = H.l_hand H.internals.icon_state = "internal1" diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 864e893dc9f..e8ec749a31a 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -52,7 +52,7 @@ Buildable meters if (make_from) src.dir = make_from.dir src.pipename = make_from.name - color = make_from.color + color = make_from.pipe_color var/is_bent if (make_from.initialize_directions in list(NORTH|SOUTH, WEST|EAST)) is_bent = 0 @@ -324,12 +324,12 @@ Buildable meters return 1 // no conflicts found - var/pipefailtext = "\red There's nothing to connect this pipe section to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" + var/pipefailtext = "\red There's nothing to connect this pipe section to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" switch(pipe_type) if(PIPE_SIMPLE_STRAIGHT, PIPE_SIMPLE_BENT) var/obj/machinery/atmospherics/pipe/simple/P = new( src.loc ) - P.color = color + P.pipe_color = color P.dir = src.dir P.initialize_directions = pipe_dir var/turf/T = P.loc @@ -382,7 +382,7 @@ Buildable meters if(PIPE_MANIFOLD) //manifold var/obj/machinery/atmospherics/pipe/manifold/M = new( src.loc ) - M.color = color + M.pipe_color = color M.dir = dir M.initialize_directions = pipe_dir //M.New() @@ -390,7 +390,7 @@ Buildable meters M.level = T.intact ? 2 : 1 M.initialize() if (!M) - usr << "There's nothing to connect this manifold to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" + usr << "There's nothing to connect this manifold to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" return 1 M.build_network() if (M.node1) @@ -405,7 +405,7 @@ Buildable meters if(PIPE_MANIFOLD4W) //4-way manifold var/obj/machinery/atmospherics/pipe/manifold4w/M = new( src.loc ) - M.color = color + M.pipe_color = color M.dir = dir M.initialize_directions = pipe_dir //M.New() @@ -413,7 +413,7 @@ Buildable meters M.level = T.intact ? 2 : 1 M.initialize() if (!M) - usr << "There's nothing to connect this manifold to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" + usr << "There's nothing to connect this manifold to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" return 1 M.build_network() if (M.node1) @@ -438,7 +438,7 @@ Buildable meters //P.level = T.intact ? 2 : 1 P.initialize() if (!P) - usr << "There's nothing to connect this pipe to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" + usr << pipefailtext //"There's nothing to connect this pipe to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" return 1 P.build_network() if (P.node1) @@ -709,7 +709,7 @@ Buildable meters C.node.initialize() C.node.build_network() ///// Z-Level stuff - if(PIPE_UP) //volume pump + if(PIPE_UP) var/obj/machinery/atmospherics/pipe/zpipe/up/P = new(src.loc) P.dir = dir P.initialize_directions = pipe_dir @@ -725,7 +725,7 @@ Buildable meters if (P.node2) P.node2.initialize() P.node2.build_network() - if(PIPE_DOWN) //volume pump + if(PIPE_DOWN) var/obj/machinery/atmospherics/pipe/zpipe/down/P = new(src.loc) P.dir = dir P.initialize_directions = pipe_dir diff --git a/code/game/objects/items/devices/pipe_painter.dm b/code/game/objects/items/devices/pipe_painter.dm index 3a062adca48..74374297cc0 100644 --- a/code/game/objects/items/devices/pipe_painter.dm +++ b/code/game/objects/items/devices/pipe_painter.dm @@ -3,8 +3,15 @@ icon = 'icons/obj/bureaucracy.dmi' icon_state = "labeler1" item_state = "flight" - var/list/modes = list("grey","red","blue","cyan","green","yellow","purple") - var/mode = "grey" + var/list/modes + var/mode + +/obj/item/device/pipe_painter/New() + ..() + modes = new() + for(var/C in pipe_colors) + modes += "[C]" + mode = pick(modes) /obj/item/device/pipe_painter/afterattack(atom/A, mob/user as mob) if(!istype(A,/obj/machinery/atmospherics/pipe) || istype(A,/obj/machinery/atmospherics/pipe/tank) || istype(A,/obj/machinery/atmospherics/pipe/vent) || istype(A,/obj/machinery/atmospherics/pipe/simple/heat_exchanging) || istype(A,/obj/machinery/atmospherics/pipe/simple/insulated) || !in_range(user, A)) @@ -16,12 +23,10 @@ user << "\red You must remove the plating first." return - P.pipe_color = mode - user.visible_message("[user] paints \the [P] [mode].","You paint \the [P] [mode].") - P.update_icon() + P.change_color(pipe_colors[mode]) /obj/item/device/pipe_painter/attack_self(mob/user as mob) - mode = input("Which colour do you want to use?","Pipe painter") in modes + mode = input("Which colour do you want to use?", "Pipe painter", mode) in modes /obj/item/device/pipe_painter/examine() ..() diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 441dee233ad..c1cf3aa8f0b 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -48,11 +48,13 @@ REAGENT SCANNER if(O.invisibility == 101) O.invisibility = 0 + O.alpha = 128 spawn(10) if(O) var/turf/U = O.loc if(U.intact) O.invisibility = 101 + O.alpha = 255 var/mob/living/M = locate() in T if(M && M.invisibility == 2) diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 01f06f14a4b..19bbcf36f45 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -71,7 +71,9 @@ "You hear metal clanking") unbuckle() src.add_fingerprint(user) - return + return 1 + + return 0 /obj/structure/stool/bed/proc/buckle_mob(mob/M as mob, mob/user as mob) if (!ticker) @@ -112,6 +114,18 @@ icon_state = "down" anchored = 0 +/obj/structure/stool/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/roller_holder)) + if(buckled_mob) + manual_unbuckle() + else + visible_message("[user] collapses \the [src.name].") + new/obj/item/roller(get_turf(src)) + spawn(0) + del(src) + return + ..() + /obj/item/roller name = "roller bed" desc = "A collapsed roller bed that can be carried around." @@ -119,11 +133,47 @@ icon_state = "folded" w_class = 4.0 // Can't be put in backpacks. Oh well. - attack_self(mob/user) +/obj/item/roller/attack_self(mob/user) var/obj/structure/stool/bed/roller/R = new /obj/structure/stool/bed/roller(user.loc) R.add_fingerprint(user) del(src) +/obj/item/roller/attackby(obj/item/weapon/W as obj, mob/user as mob) + + if(istype(W,/obj/item/roller_holder)) + var/obj/item/roller_holder/RH = W + if(!RH.held) + user << "\blue You collect the roller bed." + src.loc = RH + RH.held = src + return + + ..() + +/obj/item/roller_holder + name = "roller bed rack" + desc = "A rack for carrying a collapsed roller bed." + icon = 'icons/obj/rollerbed.dmi' + icon_state = "folded" + var/obj/item/roller/held + +/obj/item/roller_holder/New() + ..() + held = new /obj/item/roller(src) + +/obj/item/roller_holder/attack_self(mob/user as mob) + + if(!held) + user << "\blue The rack is empty." + return + + user << "\blue You deploy the roller bed." + var/obj/structure/stool/bed/roller/R = new /obj/structure/stool/bed/roller(user.loc) + R.add_fingerprint(user) + del(held) + held = null + + /obj/structure/stool/bed/roller/Move() ..() if(buckled_mob) diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm index dec999f0fce..932e40e8c5a 100644 --- a/code/game/turfs/simulated/floor_types.dm +++ b/code/game/turfs/simulated/floor_types.dm @@ -53,6 +53,7 @@ icon_state = "engine" thermal_conductivity = 0.025 heat_capacity = 325000 + intact = 0 /turf/simulated/floor/engine/attackby(obj/item/weapon/C as obj, mob/user as mob) if(!C) @@ -154,7 +155,7 @@ name = "skipjack floor" oxygen = 0 nitrogen = MOLES_N2STANDARD + MOLES_O2STANDARD - + /turf/simulated/floor/beach name = "Beach" icon = 'icons/misc/beach.dmi' diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index dd5fee98f6c..f4e163394cb 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -1,11 +1,16 @@ /client/proc/atmosscan() set category = "Mapping" - set name = "Check Plumbing" + set name = "Check Piping" + set background = 1 if(!src.holder) src << "Only administrators may use this command." return feedback_add_details("admin_verb","CP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + + if(alert("WARNING: This command should not be run on a live server. Do you want to continue?", "Check Piping", "No", "Yes") == "No") + return + usr << "Checking for disconnected pipes..." //all plumbing - yes, some things might get stated twice, doesn't matter. for (var/obj/machinery/atmospherics/plumbing in world) if (plumbing.nodealert) @@ -21,6 +26,19 @@ if (!pipe.node1 || !pipe.node2) usr << "Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])" + usr << "Checking for overlapping pipes..." + next_turf: + for(var/turf/T in world) + for(var/dir in cardinal) + var/check = 0 + for(var/obj/machinery/atmospherics/pipe in T) + if(dir & pipe.initialize_directions) + check++ + if(check > 1) + usr << "Overlapping pipe ([pipe.name]) located at [T.x],[T.y],[T.z] ([get_area(T)])" + continue next_turf + usr << "Done" + /client/proc/powerdebug() set category = "Mapping" set name = "Check Power" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index c05a0d98390..448662c4516 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -73,8 +73,9 @@ datum/preferences var/r_eyes = 0 //Eye color var/g_eyes = 0 //Eye color var/b_eyes = 0 //Eye color - var/species = "Human" + var/species = "Human" //Species datum to use. var/language = "None" //Secondary language + var/list/gear //Custom/fluff item loadout. //Mob preview var/icon/preview_icon = null @@ -104,7 +105,6 @@ datum/preferences // maps each organ to either null(intact), "cyborg" or "amputated" // will probably not be able to do this for head and torso ;) var/list/organ_data = list() - var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor" var/flavor_text = "" @@ -132,6 +132,8 @@ datum/preferences gender = pick(MALE, FEMALE) real_name = random_name(gender) + gear = list() + /datum/preferences proc/ZeroSkills(var/forced = 0) for(var/V in SKILLS) for(var/datum/skill/S in SKILLS[V]) @@ -264,7 +266,27 @@ datum/preferences if(config.allow_Metadata) dat += "OOC Notes: Edit
" - dat += "
Occupation Choices
" + dat += "
Custom Loadout: " + var/total_cost = 0 + + if(isnull(gear) || !islist(gear)) gear = list() + + if(gear && gear.len) + dat += "
" + for(var/gear_name in gear) + if(gear_datums[gear_name]) + var/datum/gear/G = gear_datums[gear_name] + total_cost += G.cost + dat += "[gear_name] \[remove\]
" + + dat += "Used: [total_cost] points." + else + dat += "none." + + if(total_cost < MAX_GEAR_COST) + dat += " \[add\]" + + dat += "

Occupation Choices
" dat += "\tSet Preferences
" dat += "
Body " @@ -835,6 +857,48 @@ datum/preferences ShowChoices(user) return 1 + else if (href_list["preference"] == "loadout") + + if(href_list["task"] == "input") + + var/list/valid_gear_choices = list() + + for(var/gear_name in gear_datums) + var/datum/gear/G = gear_datums[gear_name] + if(G.whitelisted && !is_alien_whitelisted(user, G.whitelisted)) + continue + valid_gear_choices += gear_name + + var/choice = input(user, "Select gear to add: ") as null|anything in valid_gear_choices + + if(choice && gear_datums[choice]) + + var/total_cost = 0 + + if(isnull(gear) || !islist(gear)) gear = list() + + if(gear && gear.len) + for(var/gear_name in gear) + if(gear_datums[gear_name]) + var/datum/gear/G = gear_datums[gear_name] + total_cost += G.cost + + var/datum/gear/C = gear_datums[choice] + total_cost += C.cost + if(C && total_cost <= MAX_GEAR_COST) + gear += choice + user << "\blue Added [choice] for [C.cost] points ([MAX_GEAR_COST - total_cost] points remaining)." + else + user << "\red That item will exceed the maximum loadout cost of [MAX_GEAR_COST] points." + + else if(href_list["task"] == "remove") + var/to_remove = href_list["gear"] + if(!to_remove) return + for(var/gear_name in gear) + if(gear_name == to_remove) + gear -= gear_name + break + switch(href_list["task"]) if("random") switch(href_list["preference"]) @@ -962,14 +1026,14 @@ datum/preferences var/datum/language/lang = all_languages[L] if((!(lang.flags & RESTRICTED)) && (is_alien_whitelisted(user, L)||(!( lang.flags & WHITELISTED ))||(S && (L in S.secondary_langs)))) new_languages += lang - + //Apparently there's some PHP script that needs to be updated in order to give people whitelist languages. //This workaround should be removed once that has been properly updated if (lang.name == "Siik'maas") new_languages |= all_languages["Siik'tajr"] if (lang.name == "Siik'tajr") new_languages |= all_languages["Siik'maas"] - + languages_available = 1 if(!(languages_available)) diff --git a/code/modules/client/preferences_gear.dm b/code/modules/client/preferences_gear.dm new file mode 100644 index 00000000000..e8df54ddfd8 --- /dev/null +++ b/code/modules/client/preferences_gear.dm @@ -0,0 +1,404 @@ +var/global/list/gear_datums = list() + +proc/populate_gear_list() + for(var/type in typesof(/datum/gear)-/datum/gear) + var/datum/gear/G = new type() + gear_datums[G.display_name] = G + +/datum/gear + var/display_name //Name/index. + var/path //Path to item. + var/cost //Number of points used. + var/slot //Slot to equip to. + var/list/allowed_roles //Roles that can spawn with this item. + var/whitelisted //Term to check the whitelist for.. + +//Standard gear datums. + +/datum/gear/cards + display_name = "deck of cards" + path = /obj/item/weapon/deck + cost = 2 + +/datum/gear/dice + display_name = "d20" + path = /obj/item/weapon/dice/d20 + cost = 1 + +/datum/gear/comb + display_name = "purple comb" + path = /obj/item/weapon/fluff/cado_keppel_1 + cost = 1 + +/datum/gear/tie_horrible + display_name = "horrible tie" + path = /obj/item/clothing/tie/horrible + cost = 2 + +/datum/gear/tie_blue + display_name = "blue tie" + path = /obj/item/clothing/tie/blue + cost = 2 + +/datum/gear/tie_red + display_name = "red tie" + path = /obj/item/clothing/tie/red + cost = 2 + +/datum/gear/hairflower + display_name = "hair flower pin" + path = /obj/item/clothing/head/hairflower + cost = 2 + slot = slot_head + +/datum/gear/bandana + display_name = "pirate bandana" + path = /obj/item/clothing/head/bandana + cost = 3 + slot = slot_head + +/datum/gear/overalls + display_name = "overalls" + path = /obj/item/clothing/suit/apron/overalls + cost = 2 + slot = slot_wear_suit + +/datum/gear/wcoat + display_name = "waistcoat" + path = /obj/item/clothing/suit/wcoat + cost = 2 + slot = slot_wear_suit + +/datum/gear/prescription + display_name = "prescription sunglasses" + path = /obj/item/clothing/glasses/sunglasses/prescription + cost = 3 + slot = slot_glasses + +/datum/gear/eyepatch + display_name = "eyepatch" + path = /obj/item/clothing/glasses/eyepatch + cost = 3 + slot = slot_glasses + +/datum/gear/flatcap + display_name = "flat cap" + path = /obj/item/clothing/head/flatcap + cost = 2 + slot = slot_head + +/datum/gear/labcoat + display_name = "labcoat" + path = /obj/item/clothing/suit/storage/labcoat + cost = 3 + slot = slot_wear_suit + +/datum/gear/sandal + display_name = "sandals" + path = /obj/item/clothing/shoes/sandal + cost = 1 + slot = slot_shoes + +/datum/gear/leather + display_name = "leather shoes" + path = /obj/item/clothing/shoes/leather + cost = 2 + slot = slot_shoes + +/datum/gear/dress_shoes + display_name = "dress shoes" + path = /obj/item/clothing/shoes/centcom + cost = 2 + slot = slot_shoes + +/datum/gear/black_gloves + display_name = "black gloves" + path = /obj/item/clothing/gloves/black + cost = 1 + slot = slot_gloves + +/datum/gear/red_gloves + display_name = "red gloves" + path = /obj/item/clothing/gloves/red + cost = 1 + slot = slot_gloves + +/datum/gear/blue_gloves + display_name = "blue gloves" + path = /obj/item/clothing/gloves/blue + cost = 1 + slot = slot_gloves + +/datum/gear/orange_gloves + display_name = "orange gloves" + path = /obj/item/clothing/gloves/orange + cost = 1 + slot = slot_gloves + +/datum/gear/purple_gloves + display_name = "purple gloves" + path = /obj/item/clothing/gloves/purple + cost = 1 + slot = slot_gloves + +/datum/gear/brown_gloves + display_name = "brown gloves" + path = /obj/item/clothing/gloves/brown + cost = 1 + slot = slot_gloves + +/datum/gear/green_gloves + display_name = "green gloves" + path = /obj/item/clothing/gloves/green + cost = 2 + slot = slot_gloves + +/datum/gear/white_gloves + display_name = "white gloves" + path = /obj/item/clothing/gloves/white + cost = 2 + slot = slot_gloves + +/datum/gear/black_shoes + display_name = "black shoes" + path = /obj/item/clothing/shoes/black + cost = 2 + slot = slot_shoes + +/datum/gear/blue_shoes + display_name = "blue shoes" + path = /obj/item/clothing/shoes/blue + cost = 2 + slot = slot_shoes + +/datum/gear/brown_shoes + display_name = "brown shoes" + path = /obj/item/clothing/shoes/brown + cost = 2 + slot = slot_shoes + +/datum/gear/green_shoes + display_name = "green shoes" + path = /obj/item/clothing/shoes/green + cost = 2 + slot = slot_shoes + +/datum/gear/orange_shoes + display_name = "orange shoes" + path = /obj/item/clothing/shoes/orange + cost = 2 + slot = slot_shoes + +/datum/gear/purple_shoes + display_name = "purple shoes" + path = /obj/item/clothing/shoes/purple + cost = 2 + slot = slot_shoes + +/datum/gear/red_shoes + display_name = "red shoes" + path = /obj/item/clothing/shoes/red + cost = 2 + slot = slot_shoes + +/datum/gear/white_shoes + display_name = "white shoes" + path = /obj/item/clothing/shoes/white + cost = 2 + slot = slot_shoes + +/datum/gear/yellow_shoes + display_name = "yellow shoes" + path = /obj/item/clothing/shoes/yellow + cost = 2 + slot = slot_shoes + +/datum/gear/jackboots + display_name = "jackboots" + path = /obj/item/clothing/shoes/jackboots + cost = 3 + slot = slot_shoes + +/datum/gear/webbing + display_name = "webbing" + path = /obj/item/clothing/tie/storage/webbing + cost = 1 + +/datum/gear/armband + display_name = "red armband" + path = /obj/item/clothing/tie/armband + cost = 1 + +/datum/gear/armband_cargo + display_name = "cargo armband" + path = /obj/item/clothing/tie/armband/cargo + cost = 1 + +/datum/gear/armband_engineering + display_name = "engineering armband" + path = /obj/item/clothing/tie/armband/engine + cost = 1 + +/datum/gear/armband_science + display_name = "science armband" + path = /obj/item/clothing/tie/armband/science + cost = 1 + +/datum/gear/armband_hydroponics + display_name = "hydroponics armband" + path = /obj/item/clothing/tie/armband/hydro + cost = 1 + +/datum/gear/armband_medical + display_name = "medical armband" + path = /obj/item/clothing/tie/armband/med + cost = 1 + +/datum/gear/armband_emt + display_name = "EMT armband" + path = /obj/item/clothing/tie/armband/medgreen + cost = 1 + +/datum/gear/skirt_blue + display_name = "blue plaid skirt" + path = /obj/item/clothing/under/dress/plaid_blue + slot = slot_w_uniform + cost = 3 + +/datum/gear/skirt_red + display_name = "red plaid skirt" + path = /obj/item/clothing/under/dress/plaid_red + slot = slot_w_uniform + cost = 3 + +/datum/gear/skirt_purple + display_name = "purple plaid skirt" + path = /obj/item/clothing/under/dress/plaid_purple + slot = slot_w_uniform + cost = 3 + +/datum/gear/skirt_black + display_name = "black skirt" + path = /obj/item/clothing/under/blackskirt + slot = slot_w_uniform + cost = 3 + +/datum/gear/sundress + display_name = "sundress" + path = /obj/item/clothing/under/sundress + slot = slot_w_uniform + cost = 3 + +/datum/gear/uniform_captain + display_name = "captain's dress uniform" + path = /obj/item/clothing/under/dress/dress_cap + slot = slot_w_uniform + cost = 3 + allowed_roles = list("Captain") + +/datum/gear/uniform_hop + display_name = "HoP dress uniform" + path = /obj/item/clothing/under/dress/dress_hop + slot = slot_w_uniform + cost = 3 + allowed_roles = list("Head of Personnel") + +/datum/gear/uniform_hr + display_name = "HR director uniform" + path = /obj/item/clothing/under/dress/dress_hr + slot = slot_w_uniform + cost = 3 + allowed_roles = list("Head of Personnel") + +/datum/gear/kilt + display_name = "kilt" + path = /obj/item/clothing/under/kilt + slot = slot_w_uniform + cost = 3 + +/datum/gear/exec_suit + display_name = "executive suit" + path = /obj/item/clothing/under/suit_jacket/really_black + slot = slot_w_uniform + cost = 3 + +//Security +/datum/gear/security + display_name = "Security HUD" + path = /obj/item/clothing/glasses/hud/security + cost = 3 + slot = slot_glasses + allowed_roles = list("Security Officer","Head of Security","Warden") + +/datum/gear/black_vest + display_name = "black webbing vest" + path = /obj/item/clothing/tie/storage/black_vest + cost = 3 + allowed_roles = list("Security Officer","Head of Security","Warden") + +/datum/gear/armpit + display_name = "shoulder holster" + path = /obj/item/clothing/tie/holster/armpit + cost = 3 + allowed_roles = list("Captain", "Head of Personnel", "Security Officer", "Head of Security") + +/datum/gear/sec_beret + display_name = "security beret" + path = /obj/item/clothing/head/beret/sec + cost = 1 + slot = slot_head + allowed_roles = list("Security Officer","Head of Security","Warden") + +//Engineering +/datum/gear/eng_beret + display_name = "engineering beret" + path = /obj/item/clothing/head/beret/eng + cost = 1 + slot = slot_head + allowed_roles = list("Station Engineer","Atmospheric Technician","Chief Engineer") + +/datum/gear/brown_vest + display_name = "brown webbing vest" + path = /obj/item/clothing/tie/storage/brown_vest + cost = 3 + allowed_roles = list("Station Engineer","Atmospheric Technician","Chief Engineer") + +/datum/gear/engineer_bandana + display_name = "engineering bandana" + path = /obj/item/clothing/head/helmet/greenbandana/fluff/taryn_kifer_1 + cost = 2 + allowed_roles = list("Station Engineer","Atmospheric Technician","Chief Engineer") + +//Science +/datum/gear/scanning_goggles + display_name = "scanning goggles" + path = /obj/item/clothing/glasses/fluff/uzenwa_sissra_1 + cost = 2 + allowed_roles = list("Roboticist", "Scientist", "Research Director") + +//Species-specific gear datums. +/datum/gear/zhan_furs + display_name = "Zhan-Khazan furs" + path = /obj/item/clothing/suit/tajaran/furs + cost = 3 + whitelisted = "Tajaran" + +/datum/gear/zhan_scarf + display_name = "Zhan-Khazan headscarf" + path = /obj/item/clothing/head/tajaran/scarf + cost = 2 + whitelisted = "Tajaran" + +/datum/gear/unathi_robe + display_name = "roughspun robe" + path = /obj/item/clothing/suit/unathi/robe + cost = 3 + slot = slot_wear_suit + whitelisted = "Unathi" + +/datum/gear/unathi_mantle + display_name = "hide mantle" + path = /obj/item/clothing/suit/unathi/mantle + cost = 2 + slot = slot_wear_suit + whitelisted = "Unathi" diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 68bb5a9e3eb..ef3b8e5c035 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -155,6 +155,7 @@ S["skills"] >> skills S["skill_specialization"] >> skill_specialization S["organ_data"] >> organ_data + S["gear"] >> gear S["nanotrasen_relation"] >> nanotrasen_relation //S["skin_style"] >> skin_style @@ -211,6 +212,7 @@ if(isnull(disabilities)) disabilities = 0 if(!player_alt_titles) player_alt_titles = new() if(!organ_data) src.organ_data = list() + if(!gear) src.gear = list() //if(!skin_style) skin_style = "Default" return 1 @@ -248,6 +250,7 @@ S["undershirt"] << undershirt S["backbag"] << backbag S["b_type"] << b_type + S["spawnpoint"] << spawnpoint //Jobs S["alternate_option"] << alternate_option @@ -273,6 +276,7 @@ S["skills"] << skills S["skill_specialization"] << skill_specialization S["organ_data"] << organ_data + S["gear"] << gear S["nanotrasen_relation"] << nanotrasen_relation //S["skin_style"] << skin_style diff --git a/code/modules/clothing/suits/alien.dm b/code/modules/clothing/suits/alien.dm index 5b664f21b35..539efcaacc9 100644 --- a/code/modules/clothing/suits/alien.dm +++ b/code/modules/clothing/suits/alien.dm @@ -12,4 +12,18 @@ desc = "A rather grisly selection of cured hides and skin, sewn together to form a ragged mantle." icon_state = "mantle-unathi" item_state = "mantle-unathi" - body_parts_covered = UPPER_TORSO \ No newline at end of file + body_parts_covered = UPPER_TORSO + +//Taj clothing. + +/obj/item/clothing/suit/tajaran/furs + name = "heavy furs" + desc = "A traditional Zhan-Khazan garment." + icon_state = "zhan_furs" + item_state = "zhan_furs" + body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS + +/obj/item/clothing/head/tajaran/scarf + name = "headscarf" + desc = "A scarf of coarse fabric. Seems to have ear-holes." + icon_state = "zhan_scarf" \ No newline at end of file diff --git a/code/modules/clothing/under/miscellaneous.dm b/code/modules/clothing/under/miscellaneous.dm index c182d820246..3e4cf1a3d1b 100644 --- a/code/modules/clothing/under/miscellaneous.dm +++ b/code/modules/clothing/under/miscellaneous.dm @@ -294,13 +294,13 @@ /obj/item/clothing/under/dress/dress_cap - name = "captain dress uniform" + name = "captain's dress uniform" desc = "Feminine fashion for the style concious captain." icon_state = "dress_cap" item_color = "dress_cap" /obj/item/clothing/under/dress/dress_hop - name = "head of personal dress uniform" + name = "head of personnel dress uniform" desc = "Feminine fashion for the style concious HoP." icon_state = "dress_hop" item_color = "dress_hop" diff --git a/code/modules/clothing/under/ties.dm b/code/modules/clothing/under/ties.dm index 57cc66865b1..d8b1bdf70b0 100644 --- a/code/modules/clothing/under/ties.dm +++ b/code/modules/clothing/under/ties.dm @@ -22,7 +22,7 @@ has_suit = S loc = has_suit has_suit.overlays += inv_overlay - + user << "You attach [src] to [has_suit]." src.add_fingerprint(user) @@ -157,38 +157,38 @@ item_color = "red" /obj/item/clothing/tie/armband/cargo - name = "cargo bay guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is brown." + name = "cargo armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is brown." icon_state = "cargo" item_color = "cargo" /obj/item/clothing/tie/armband/engine - name = "engineering guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is orange with a reflective strip!" + name = "engineering armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is orange with a reflective strip!" icon_state = "engie" item_color = "engie" /obj/item/clothing/tie/armband/science - name = "science guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is purple." + name = "science armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is purple." icon_state = "rnd" item_color = "rnd" /obj/item/clothing/tie/armband/hydro - name = "hydroponics guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is green and blue." + name = "hydroponics armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is green and blue." icon_state = "hydro" item_color = "hydro" /obj/item/clothing/tie/armband/med - name = "medical guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is white." + name = "medical armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is white." icon_state = "med" item_color = "med" /obj/item/clothing/tie/armband/medgreen - name = "medical guard armband" - desc = "An armband, worn by the station's security forces to display which department they're assigned to. This one is white and green." + name = "EMT armband" + desc = "An armband, worn by the crew to display which department they're assigned to. This one is white and green." icon_state = "medgreen" item_color = "medgreen" @@ -208,16 +208,16 @@ if(holstered) user << "\red There is already a [holstered] holstered here!" return - + if (!istype(I, /obj/item/weapon/gun)) user << "\red Only guns can be holstered!" return - + var/obj/item/weapon/gun/W = I if (!can_holster(W)) user << "\red This [W] won't fit in the [src]!" return - + holstered = W user.drop_from_inventory(holstered) holstered.loc = src @@ -227,7 +227,7 @@ /obj/item/clothing/tie/holster/proc/unholster(mob/user as mob) if(!holstered) return - + if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj)) user << "\red You need an empty hand to draw the [holstered]!" else @@ -246,7 +246,7 @@ if (holstered) unholster(user) return - + ..(user) /obj/item/clothing/tie/holster/attackby(obj/item/W as obj, mob/user as mob) @@ -280,7 +280,7 @@ set src in usr if(!istype(usr, /mob/living)) return if(usr.stat) return - + var/obj/item/clothing/tie/holster/H = null if (istype(src, /obj/item/clothing/tie/holster)) H = src @@ -288,7 +288,7 @@ var/obj/item/clothing/under/S = src if (S.hastie) H = S.hastie - + if (!H) usr << "/red Something is very wrong." @@ -330,14 +330,14 @@ if (has_suit) //if we are part of a suit hold.open(user) return - + if (hold.handle_attack_hand(user)) //otherwise interact as a regular storage item ..(user) /obj/item/clothing/tie/storage/MouseDrop(obj/over_object as obj) if (has_suit) return - + if (hold.handle_mousedrop(usr, over_object)) ..(over_object) @@ -471,6 +471,6 @@ "/obj/item/weapon/kitchen/utensil/pknife",\ "/obj/item/weapon/kitchenknife",\ "/obj/item/weapon/kitchenknife/ritual") - + new /obj/item/weapon/hatchet/unathiknife(hold) new /obj/item/weapon/hatchet/unathiknife(hold) diff --git a/code/modules/mining/drilling/distribution.dm b/code/modules/mining/drilling/distribution.dm index 2ca9a3f685c..1b4c698ea9b 100644 --- a/code/modules/mining/drilling/distribution.dm +++ b/code/modules/mining/drilling/distribution.dm @@ -75,9 +75,6 @@ Deep minerals: //Halfassed diamond-square algorithm with some fuckery since it's a single dimension array. /datum/ore_distribution/proc/populate_distribution_map() - //Announce it! - world << "Generating resource distribution map." - //Seed beginning values. var/x = 1 var/y = 1 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f4edb30e240..4f6368ad6fa 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1458,3 +1458,39 @@ M.apply_damage(50,BRUTE) if(M.stat == 2) M.gib() + +/mob/living/carbon/human/proc/commune() + set category = "IC" + set name = "Commune with creature" + set desc = "Send a telepathic message to an unlucky recipient." + + var/list/targets = list() + var/target = null + var/text = null + + targets += getmobs() //Fill list, prompt user with list + target = input("Select a creature!", "Speak to creature", null, null) as null|anything in targets + + if(!target) return + + text = input("What would you like to say?", "Speak to creature", null, null) + + text = trim(copytext(sanitize(text), 1, MAX_MESSAGE_LEN)) + + if(!text) return + + var/mob/M = targets[target] + + if(istype(M, /mob/dead/observer) || M.stat == DEAD) + src << "Not even a [src.species.name] can speak to the dead." + return + + log_say("[key_name(src)] communed to [key_name(M)]: [text]") + + M << "\blue Like lead slabs crashing into the ocean, alien thoughts drop into your mind: [text]" + if(istype(M,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = M + if(H.species.name == src.species.name) + return + H << "\red Your nose begins to bleed..." + H.drip(1) diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index c2ecf6d539d..feb74deb548 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -215,6 +215,7 @@ /datum/species/vox/armalis/handle_post_spawn(var/mob/living/carbon/human/H) H.verbs += /mob/living/carbon/human/proc/gut + H.verbs += /mob/living/carbon/human/proc/commune ..() /datum/species/vox/armalis diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm index 7c2dc565a4e..dfe1a9db29e 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -28,6 +28,19 @@ //Item currently being held. var/obj/item/wrapped = null +/obj/item/weapon/gripper/paperwork + name = "paperwork gripper" + desc = "A simple grasping tool for clerical work." + icon = 'icons/obj/device.dmi' + icon_state = "gripper" + + can_hold = list( + /obj/item/weapon/clipboard, + /obj/item/weapon/paper, + /obj/item/weapon/paper_bundle, + /obj/item/weapon/card/id + ) + /obj/item/weapon/gripper/attack_self(mob/user as mob) if(wrapped) wrapped.attack_self(user) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 1d0dd77e284..8d1823f0c51 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -5,7 +5,7 @@ icon_state = "robot" maxHealth = 200 health = 200 - + var/sight_mode = 0 var/custom_name = "" var/custom_sprite = 0 //Due to all the sprites involved, a var for our custom borgs may be best @@ -163,7 +163,7 @@ /mob/living/silicon/robot/proc/pick_module() if(module) return - var/list/modules = list("Standard", "Engineering", "Medical", "Miner", "Janitor", "Service", "Security") + var/list/modules = list("Standard", "Engineering", "Construction", "Surgeon", "Crisis", "Miner", "Janitor", "Service", "Clerical", "Security") if(crisis && security_level == SEC_LEVEL_RED) //Leaving this in until it's balanced appropriately. src << "\red Crisis mode active. Combat module available." modules+="Combat" @@ -189,6 +189,14 @@ module_sprites["Rich"] = "maximillion" module_sprites["Default"] = "Service2" + if("Clerical") + module = new /obj/item/weapon/robot_module/clerical(src) + module_sprites["Waitress"] = "Service" + module_sprites["Kent"] = "toiletbot" + module_sprites["Bro"] = "Brobot" + module_sprites["Rich"] = "maximillion" + module_sprites["Default"] = "Service2" + if("Miner") module = new /obj/item/weapon/robot_module/miner(src) module.channels = list("Supply" = 1) @@ -198,15 +206,26 @@ module_sprites["Advanced Droid"] = "droid-miner" module_sprites["Treadhead"] = "Miner" - if("Medical") - module = new /obj/item/weapon/robot_module/medical(src) + if("Crisis") + module = new /obj/item/weapon/robot_module/crisis(src) module.channels = list("Medical" = 1) if(camera && "Robots" in camera.network) camera.network.Add("Medical") module_sprites["Basic"] = "Medbot" + module_sprites["Standard"] = "surgeon" module_sprites["Advanced Droid"] = "droid-medical" module_sprites["Needles"] = "medicalrobot" + + if("Surgeon") + module = new /obj/item/weapon/robot_module/surgeon(src) + module.channels = list("Medical" = 1) + if(camera && "Robots" in camera.network) + camera.network.Add("Medical") + + module_sprites["Basic"] = "Medbot" module_sprites["Standard"] = "surgeon" + module_sprites["Advanced Droid"] = "droid-medical" + module_sprites["Needles"] = "medicalrobot" if("Security") module = new /obj/item/weapon/robot_module/security(src) @@ -225,6 +244,15 @@ module_sprites["Antique"] = "engineerrobot" module_sprites["Landmate"] = "landmate" + if("Construction") + module = new /obj/item/weapon/robot_module/construction(src) + module.channels = list("Engineering" = 1) + if(camera && "Robots" in camera.network) + camera.network.Add("Engineering") + module_sprites["Basic"] = "Engineering" + module_sprites["Antique"] = "engineerrobot" + module_sprites["Landmate"] = "landmate" + if("Janitor") module = new /obj/item/weapon/robot_module/janitor(src) module_sprites["Basic"] = "JanBot2" @@ -238,7 +266,7 @@ //languages module.add_languages(src) - + //Custom_sprite check and entry if (custom_sprite == 1) module_sprites["Custom"] = "[src.ckey]-[modtype]" diff --git a/code/modules/mob/living/silicon/robot/robot_items.dm b/code/modules/mob/living/silicon/robot/robot_items.dm index 1c24a5e75dd..931cb0556be 100644 --- a/code/modules/mob/living/silicon/robot/robot_items.dm +++ b/code/modules/mob/living/silicon/robot/robot_items.dm @@ -95,14 +95,26 @@ var/mode = 1 /obj/item/weapon/pen/robopen/attack_self(mob/user as mob) + + var/choice = input("Would you like to change colour or mode?") as null|anything in list("Colour","Mode") + if(!choice) return + playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) - if (mode == 1) - mode = 2 - user << "Changed printing mode to 'Rename Paper'" - return - if (mode == 2) - mode = 1 - user << "Changed printing mode to 'Write Paper'" + + switch(choice) + + if("Colour") + var/newcolour = input("Which colour would you like to use?") as null|anything in list("black","blue","red","green","yellow") + if(newcolour) colour = newcolour + + if("Mode") + if (mode == 1) + mode = 2 + else + mode = 1 + user << "Changed printing mode to '[mode == 2 ? "Rename Paper" : "Write Paper"]'" + + return // Copied over from paper's rename verb // see code\modules\paperwork\paper.dm line 62 @@ -120,6 +132,33 @@ add_fingerprint(user) return +//TODO: Add prewritten forms to dispense when you work out a good way to store the strings. +/obj/item/weapon/form_printer + //name = "paperwork printer" + name = "paper dispenser" + icon = 'icons/obj/bureaucracy.dmi' + icon_state = "paper_bin1" + item_state = "sheet-metal" + +/obj/item/weapon/form_printer/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) + return + +/obj/item/weapon/form_printer/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag, params) + + if(!target || !flag) + return + + if(istype(target,/obj/structure/table)) + deploy_paper(get_turf(target)) + +/obj/item/weapon/form_printer/attack_self(mob/user as mob) + deploy_paper(get_turf(src)) + +/obj/item/weapon/form_printer/proc/deploy_paper(var/turf/T) + T.visible_message("\blue \The [src.loc] dispenses a sheet of crisp white paper.") + new /obj/item/weapon/paper(T) + + //Personal shielding for the combat module. /obj/item/borg/combat/shield name = "personal shielding" diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 0e48a8f33e1..00caecb8f0a 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -9,6 +9,7 @@ var/list/modules = list() var/obj/item/emag = null var/obj/item/borg/upgrade/jetpack = null + var/list/stacktypes emp_act(severity) if(modules) @@ -31,7 +32,21 @@ /obj/item/weapon/robot_module/proc/respawn_consumable(var/mob/living/silicon/robot/R) - return + + if(!stacktypes || !stacktypes.len) return + + for(var/T in stacktypes) + var/O = locate(T) in src.modules + var/obj/item/stack/S = O + + if(!S) + src.modules -= null + S = new T(src) + src.modules += S + S.amount = 1 + + if(S && S.amount < stacktypes[T]) + S.amount++ /obj/item/weapon/robot_module/proc/rebuild()//Rebuilds the list so it's possible to add/remove items from the module var/list/temp_list = modules @@ -41,7 +56,9 @@ modules += O /obj/item/weapon/robot_module/proc/add_languages(var/mob/living/silicon/robot/R) - R.add_language("Tradeband", 0) + R.add_language("Tradeband", 1) + R.add_language("Sol Common", 1) + /obj/item/weapon/robot_module/standard name = "standard robot module" @@ -57,8 +74,49 @@ src.emag = new /obj/item/weapon/melee/energy/sword(src) return -/obj/item/weapon/robot_module/medical - name = "medical robot module" +/obj/item/weapon/robot_module/surgeon + name = "surgeon robot module" + stacktypes = list( + /obj/item/stack/medical/advanced/bruise_pack = 5, + /obj/item/stack/nanopaste = 5 + ) + + New() + src.modules += new /obj/item/device/flashlight(src) + src.modules += new /obj/item/device/flash(src) + src.modules += new /obj/item/device/healthanalyzer(src) + src.modules += new /obj/item/weapon/reagent_containers/borghypo/surgeon(src) + src.modules += new /obj/item/weapon/scalpel(src) + src.modules += new /obj/item/weapon/hemostat(src) + src.modules += new /obj/item/weapon/retractor(src) + src.modules += new /obj/item/weapon/cautery(src) + src.modules += new /obj/item/weapon/bonegel(src) + src.modules += new /obj/item/weapon/bonesetter(src) + src.modules += new /obj/item/weapon/circular_saw(src) + src.modules += new /obj/item/weapon/surgicaldrill(src) + src.modules += new /obj/item/weapon/extinguisher/mini(src) + src.modules += new /obj/item/stack/medical/advanced/bruise_pack(src) + src.modules += new /obj/item/stack/nanopaste(src) + + src.emag = new /obj/item/weapon/reagent_containers/spray(src) + + src.emag.reagents.add_reagent("pacid", 250) + src.emag.name = "Polyacid spray" + return + +/obj/item/weapon/robot_module/surgeon/respawn_consumable(var/mob/living/silicon/robot/R) + if(src.emag) + var/obj/item/weapon/reagent_containers/spray/PS = src.emag + PS.reagents.add_reagent("pacid", 2) + ..() + +/obj/item/weapon/robot_module/crisis + name = "crisis robot module" + stacktypes = list( + /obj/item/stack/medical/ointment = 5, + /obj/item/stack/medical/bruise_pack = 5, + /obj/item/stack/medical/splint = 5 + ) New() src.modules += new /obj/item/device/flashlight(src) @@ -66,40 +124,74 @@ src.modules += new /obj/item/borg/sight/hud/med(src) src.modules += new /obj/item/device/healthanalyzer(src) src.modules += new /obj/item/device/reagent_scanner/adv(src) - src.modules += new /obj/item/weapon/reagent_containers/borghypo(src) + src.modules += new /obj/item/roller_holder(src) + src.modules += new /obj/item/stack/medical/ointment(src) + src.modules += new /obj/item/stack/medical/bruise_pack(src) + src.modules += new /obj/item/stack/medical/splint(src) + src.modules += new /obj/item/weapon/reagent_containers/borghypo/crisis(src) src.modules += new /obj/item/weapon/reagent_containers/glass/beaker/large(src) src.modules += new /obj/item/weapon/reagent_containers/robodropper(src) src.modules += new /obj/item/weapon/reagent_containers/syringe(src) src.modules += new /obj/item/weapon/extinguisher/mini(src) + src.emag = new /obj/item/weapon/reagent_containers/spray(src) src.emag.reagents.add_reagent("pacid", 250) src.emag.name = "Polyacid spray" return -/obj/item/weapon/robot_module/medical/respawn_consumable(var/mob/living/silicon/robot/R) +/obj/item/weapon/robot_module/crisis/respawn_consumable(var/mob/living/silicon/robot/R) + var/obj/item/weapon/reagent_containers/syringe/S = locate() in src.modules - if(S.mode == 2)//SYRINGE_BROKEN + if(S.mode == 2) S.reagents.clear_reagents() S.mode = initial(S.mode) S.desc = initial(S.desc) S.update_icon() + if(src.emag) var/obj/item/weapon/reagent_containers/spray/PS = src.emag PS.reagents.add_reagent("pacid", 2) -/obj/item/weapon/robot_module/engineering - name = "engineering robot module" + ..() +/obj/item/weapon/robot_module/construction + name = "construction robot module" + + stacktypes = list( + /obj/item/stack/sheet/metal = 50, + /obj/item/stack/sheet/plasteel = 10, + /obj/item/stack/sheet/rglass = 50 + ) + + New() + src.modules += new /obj/item/device/flashlight(src) + src.modules += new /obj/item/device/flash(src) + src.modules += new /obj/item/borg/sight/meson(src) + src.modules += new /obj/item/weapon/extinguisher(src) + src.modules += new /obj/item/weapon/rcd/borg(src) + src.modules += new /obj/item/weapon/screwdriver(src) + src.modules += new /obj/item/weapon/wrench(src) + src.modules += new /obj/item/weapon/crowbar(src) + src.modules += new /obj/item/weapon/pickaxe/plasmacutter(src) + +/obj/item/weapon/robot_module/engineering + name = "engineering robot module" + + stacktypes = list( + /obj/item/stack/sheet/metal = 50, + /obj/item/stack/sheet/glass = 50, + /obj/item/stack/sheet/rglass = 50, + /obj/item/weapon/cable_coil = 50, + /obj/item/stack/rods = 15, + /obj/item/stack/tile/plasteel = 15 + ) New() src.modules += new /obj/item/device/flashlight(src) src.modules += new /obj/item/device/flash(src) src.modules += new /obj/item/borg/sight/meson(src) - src.emag = new /obj/item/borg/stun(src) - src.modules += new /obj/item/weapon/rcd/borg(src) src.modules += new /obj/item/weapon/extinguisher(src) -// src.modules += new /obj/item/device/flashlight(src) src.modules += new /obj/item/weapon/weldingtool/largetank(src) src.modules += new /obj/item/weapon/screwdriver(src) src.modules += new /obj/item/weapon/wrench(src) @@ -109,12 +201,20 @@ src.modules += new /obj/item/device/t_scanner(src) src.modules += new /obj/item/device/analyzer(src) src.modules += new /obj/item/taperoll/engineering(src) + src.modules += new /obj/item/weapon/gripper(src) + src.modules += new /obj/item/weapon/matter_decompiler(src) + + src.emag = new /obj/item/borg/stun(src) var/obj/item/stack/sheet/metal/cyborg/M = new /obj/item/stack/sheet/metal/cyborg(src) M.amount = 50 src.modules += M - var/obj/item/stack/sheet/rglass/cyborg/G = new /obj/item/stack/sheet/rglass/cyborg(src) + var/obj/item/stack/sheet/rglass/cyborg/R = new /obj/item/stack/sheet/rglass/cyborg(src) + R.amount = 50 + src.modules += R + + var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src) G.amount = 50 src.modules += G @@ -124,24 +224,6 @@ return -/obj/item/weapon/robot_module/engineering/respawn_consumable(var/mob/living/silicon/robot/R) - var/list/stacks = list ( - /obj/item/stack/sheet/metal, - /obj/item/stack/sheet/rglass, - /obj/item/weapon/cable_coil, - ) - for(var/T in stacks) - var/O = locate(T) in src.modules - if(O) - if(O:amount < 50) - O:amount++ - else - src.modules -= null - O = new T(src) - src.modules += O - O:amount = 1 - return - /obj/item/weapon/robot_module/security name = "security robot module" @@ -202,7 +284,6 @@ src.modules += new /obj/item/device/flash(src) src.modules += new /obj/item/weapon/reagent_containers/food/drinks/cans/beer(src) src.modules += new /obj/item/weapon/reagent_containers/food/condiment/enzyme(src) - src.modules += new /obj/item/weapon/pen/robopen(src) var/obj/item/weapon/rsf/M = new /obj/item/weapon/rsf(src) M.matter = 30 @@ -236,6 +317,28 @@ R.add_language("Tradeband", 1) R.add_language("Gutter", 1) +/obj/item/weapon/robot_module/clerical + name = "clerical robot module" + + New() + src.modules += new /obj/item/device/flashlight(src) + src.modules += new /obj/item/device/flash(src) + src.modules += new /obj/item/weapon/pen/robopen(src) + src.modules += new /obj/item/weapon/form_printer(src) + src.modules += new /obj/item/weapon/gripper/paperwork(src) + + src.emag = new /obj/item/weapon/stamp/denied(src) + + add_languages(var/mob/living/silicon/robot/R) + R.add_language("Sol Common", 1) + R.add_language("Sinta'unathi", 1) + R.add_language("Siik'maas", 1) + R.add_language("Siik'tajr", 0) + R.add_language("Skrellian", 1) + R.add_language("Rootspeak", 1) + R.add_language("Tradeband", 1) + R.add_language("Gutter", 1) + /obj/item/weapon/robot_module/butler/respawn_consumable(var/mob/living/silicon/robot/R) var/obj/item/weapon/reagent_containers/food/condiment/enzyme/E = locate() in src.modules E.reagents.add_reagent("enzyme", 2) @@ -250,11 +353,12 @@ src.modules += new /obj/item/device/flashlight(src) src.modules += new /obj/item/device/flash(src) src.modules += new /obj/item/borg/sight/meson(src) - src.emag = new /obj/item/borg/stun(src) + src.modules += new /obj/item/weapon/wrench(src) + src.modules += new /obj/item/weapon/screwdriver(src) src.modules += new /obj/item/weapon/storage/bag/ore(src) src.modules += new /obj/item/weapon/pickaxe/borgdrill(src) src.modules += new /obj/item/weapon/storage/bag/sheetsnatcher/borg(src) -// src.modules += new /obj/item/weapon/shovel(src) Uneeded due to buffed drill + src.emag = new /obj/item/weapon/pickaxe/plasmacutter(src) return /obj/item/weapon/robot_module/syndicate @@ -286,7 +390,7 @@ /obj/item/weapon/robot_module/drone name = "drone module" - var/list/stacktypes = list( + stacktypes = list( /obj/item/stack/sheet/wood/cyborg = 1, /obj/item/stack/sheet/mineral/plastic/cyborg = 1, /obj/item/stack/sheet/rglass/cyborg = 5, @@ -327,29 +431,17 @@ var/obj/item/weapon/reagent_containers/spray/cleaner/C = locate() in src.modules C.reagents.add_reagent("cleaner", 3) - for(var/T in stacktypes) - var/O = locate(T) in src.modules - var/obj/item/stack/sheet/S = O - - if(!S) - src.modules -= null - S = new T(src) - src.modules += S - S.amount = 1 - - if(S && S.amount < stacktypes[T]) - S.amount++ - var/obj/item/device/lightreplacer/LR = locate() in src.modules LR.Charge(R) + ..() return //checks whether this item is a module of the robot it is located in. /obj/item/proc/is_robot_module() if (!istype(src.loc, /mob/living/silicon/robot)) return 0 - + var/mob/living/silicon/robot/R = src.loc - - return (src in R.module.modules) + + return (src in R.module.modules) diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index f1a62754b4b..c3b7d43c05c 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -1,3 +1,8 @@ +/mob/living/silicon/robot/Process_Spaceslipping(var/prob_slip) + if(module && (istype(module,/obj/item/weapon/robot_module/construction) || istype(module,/obj/item/weapon/robot_module/drone))) + return 0 + ..(prob_slip) + /mob/living/silicon/robot/Process_Spacemove() if(module) for(var/obj/item/weapon/tank/jetpack/J in module.modules) diff --git a/code/modules/mob/living/simple_animal/vox.dm b/code/modules/mob/living/simple_animal/vox.dm deleted file mode 100644 index f3354ce8561..00000000000 --- a/code/modules/mob/living/simple_animal/vox.dm +++ /dev/null @@ -1,160 +0,0 @@ -/mob/living/simple_animal/vox/armalis/ - - name = "serpentine alien" - real_name = "serpentine alien" - desc = "A one-eyed, serpentine creature, half-machine, easily nine feet from tail to beak!" - icon = 'icons/mob/vox.dmi' - icon_state = "armalis" - icon_living = "armalis" - maxHealth = 500 - health = 500 - response_harm = "slashes at the" - harm_intent_damage = 0 - melee_damage_lower = 30 - melee_damage_upper = 40 - attacktext = "slammed its enormous claws into" - speed = -1 - wall_smash = 1 - attack_sound = 'sound/weapons/bladeslice.ogg' - status_flags = 0 - universal_speak = 1 - - var/armour = null - var/amp = null - var/quills = 3 - -/mob/living/simple_animal/vox/armalis/Die() - - living_mob_list -= src - dead_mob_list += src - stat = DEAD - visible_message("\red [src] shudders violently and explodes!","\red You feel your body rupture!") - explosion(get_turf(loc), -1, -1, 3, 5) - src.gib() - return - -/mob/living/simple_animal/vox/armalis/attackby(var/obj/item/O as obj, var/mob/user as mob) - if(O.force) - if(O.force >= 25) - var/damage = O.force - if (O.damtype == HALLOSS) - damage = 0 - health -= damage - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red \b [src] has been attacked with the [O] by [user]. ") - else - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red \b The [O] bounces harmlessly off of [src]. ") - else - usr << "\red This weapon is ineffective, it does no damage." - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red [user] gently taps [src] with the [O]. ") - -/mob/living/simple_animal/vox/armalis/verb/fire_quill(mob/target as mob in oview()) - - set name = "Fire quill" - set desc = "Fires a viciously pointed quill at a high speed." - set category = "Alien" - - if(quills<=0) - return - - src << "\red You launch a razor-sharp quill at [target]!" - for(var/mob/O in oviewers()) - if ((O.client && !( O.blinded ))) - O << "\red [src] launches a razor-sharp quill at [target]!" - - var/obj/item/weapon/arrow/quill/Q = new(loc) - Q.fingerprintslast = src.ckey - Q.throw_at(target,10,30) - quills-- - - spawn(100) - src << "\red You feel a fresh quill slide into place." - quills++ - -/mob/living/simple_animal/vox/armalis/verb/message_mob() - set category = "Alien" - set name = "Commune with creature" - set desc = "Send a telepathic message to an unlucky recipient." - - var/list/targets = list() - var/target = null - var/text = null - - targets += getmobs() //Fill list, prompt user with list - target = input("Select a creature!", "Speak to creature", null, null) as null|anything in targets - text = input("What would you like to say?", "Speak to creature", null, null) - - if (!target || !text) - return - - var/mob/M = targets[target] - - if(istype(M, /mob/dead/observer) || M.stat == DEAD) - src << "Not even the armalis can speak to the dead." - return - - M << "\blue Like lead slabs crashing into the ocean, alien thoughts drop into your mind: [text]" - if(istype(M,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = M - if(H.species.name == "Vox") - return - H << "\red Your nose begins to bleed..." - H.drip(1) - -/mob/living/simple_animal/vox/armalis/verb/shriek() - set category = "Alien" - set name = "Shriek" - set desc = "Give voice to a psychic shriek." - -/mob/living/simple_animal/vox/armalis/attackby(var/obj/item/O as obj, var/mob/user as mob) - if(istype(O,/obj/item/vox/armalis_armour)) - user.drop_item() - armour = O - speed = 1 - maxHealth += 200 - health += 200 - O.loc = src - visible_message("\blue [src] is quickly outfitted in [O] by [user].","\blue You quickly outfit [src] in [O].") - regenerate_icons() - return - if(istype(O,/obj/item/vox/armalis_amp)) - user.drop_item() - amp = O - O.loc = src - visible_message("\blue [src] is quickly outfitted in [O] by [user].","\blue You quickly outfit [src] in [O].") - regenerate_icons() - return - return ..() - -/mob/living/simple_animal/vox/armalis/regenerate_icons() - - overlays = list() - if(armour) - var/icon/armour = image('icons/mob/vox.dmi',"armour") - speed = 1 - overlays += armour - if(amp) - var/icon/amp = image('icons/mob/vox.dmi',"amplifier") - overlays += amp - return - -/obj/item/vox/armalis_armour - - name = "strange armour" - desc = "Hulking reinforced armour for something huge." - icon = 'icons/obj/clothing/suits.dmi' - icon_state = "armalis_armour" - item_state = "armalis_armour" - -/obj/item/vox/armalis_amp - - name = "strange lenses" - desc = "A series of metallic lenses and chains." - icon = 'icons/obj/clothing/hats.dmi' - icon_state = "amp" - item_state = "amp" \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index a8d88bcf20b..d69773b5d4d 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -18,6 +18,12 @@ var/list/reagent_ids = list("tricordrazine", "inaprovaline", "spaceacillin") //var/list/reagent_ids = list("dexalin", "kelotane", "bicaridine", "anti_toxin", "inaprovaline", "spaceacillin") +/obj/item/weapon/reagent_containers/borghypo/surgeon + reagent_ids = list("bicaridine", "inaprovaline", "dexalin") + +/obj/item/weapon/reagent_containers/borghypo/crisis + reagent_ids = list("tricordrazine", "inaprovaline", "tramadol") + /obj/item/weapon/reagent_containers/borghypo/New() ..() for(var/R in reagent_ids) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 38e1ff3bfbb..0280599d5e7 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -736,10 +736,10 @@ // this will be revealed if a T-scanner is used // if visible, use regular icon_state proc/updateicon() - if(invisibility) +/* if(invisibility) //we hide things with alpha now, no need for transparent icons icon_state = "[base_icon_state]f" else - icon_state = base_icon_state + icon_state = base_icon_state*/ return diff --git a/code/setup.dm b/code/setup.dm index 5b4fd76e08a..3023a7b551c 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -814,4 +814,6 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse #define IS_DIONA 1 #define IS_VOX 2 #define IS_SKRELL 3 -#define IS_UNATHI 4 \ No newline at end of file +#define IS_UNATHI 4 + +#define MAX_GEAR_COST 5 //Used in chargen for loadout limit. diff --git a/icons/atmos/connector.dmi b/icons/atmos/connector.dmi new file mode 100644 index 00000000000..cf4ea7a3c84 Binary files /dev/null and b/icons/atmos/connector.dmi differ diff --git a/icons/atmos/digital_tvalve.dmi b/icons/atmos/digital_tvalve.dmi new file mode 100644 index 00000000000..b34d2903b5c Binary files /dev/null and b/icons/atmos/digital_tvalve.dmi differ diff --git a/icons/atmos/digital_valve.dmi b/icons/atmos/digital_valve.dmi new file mode 100644 index 00000000000..b1adc8b6519 Binary files /dev/null and b/icons/atmos/digital_valve.dmi differ diff --git a/icons/atmos/filter.dmi b/icons/atmos/filter.dmi new file mode 100644 index 00000000000..8b5cd81c707 Binary files /dev/null and b/icons/atmos/filter.dmi differ diff --git a/icons/atmos/injector.dmi b/icons/atmos/injector.dmi new file mode 100644 index 00000000000..03a60d2e5d1 Binary files /dev/null and b/icons/atmos/injector.dmi differ diff --git a/icons/atmos/manifold.dmi b/icons/atmos/manifold.dmi new file mode 100644 index 00000000000..f6b24341c9a Binary files /dev/null and b/icons/atmos/manifold.dmi differ diff --git a/icons/atmos/mixer.dmi b/icons/atmos/mixer.dmi new file mode 100644 index 00000000000..0fcb92820f4 Binary files /dev/null and b/icons/atmos/mixer.dmi differ diff --git a/icons/atmos/omni_devices.dmi b/icons/atmos/omni_devices.dmi new file mode 100644 index 00000000000..494ea7e24d4 Binary files /dev/null and b/icons/atmos/omni_devices.dmi differ diff --git a/icons/atmos/passive_gate.dmi b/icons/atmos/passive_gate.dmi new file mode 100644 index 00000000000..3fa7ec6d143 Binary files /dev/null and b/icons/atmos/passive_gate.dmi differ diff --git a/icons/atmos/pipe_underlays.dmi b/icons/atmos/pipe_underlays.dmi new file mode 100644 index 00000000000..0edf79e5008 Binary files /dev/null and b/icons/atmos/pipe_underlays.dmi differ diff --git a/icons/atmos/pipes.dmi b/icons/atmos/pipes.dmi new file mode 100644 index 00000000000..019be28ffd8 Binary files /dev/null and b/icons/atmos/pipes.dmi differ diff --git a/icons/atmos/pump.dmi b/icons/atmos/pump.dmi new file mode 100644 index 00000000000..6350782a2f1 Binary files /dev/null and b/icons/atmos/pump.dmi differ diff --git a/icons/atmos/tank.dmi b/icons/atmos/tank.dmi new file mode 100644 index 00000000000..bc2fb0b9014 Binary files /dev/null and b/icons/atmos/tank.dmi differ diff --git a/icons/atmos/tvalve.dmi b/icons/atmos/tvalve.dmi new file mode 100644 index 00000000000..197862b32a0 Binary files /dev/null and b/icons/atmos/tvalve.dmi differ diff --git a/icons/atmos/valve.dmi b/icons/atmos/valve.dmi new file mode 100644 index 00000000000..04351917b65 Binary files /dev/null and b/icons/atmos/valve.dmi differ diff --git a/icons/atmos/vent_pump.dmi b/icons/atmos/vent_pump.dmi new file mode 100644 index 00000000000..8846103633c Binary files /dev/null and b/icons/atmos/vent_pump.dmi differ diff --git a/icons/atmos/vent_scrubber.dmi b/icons/atmos/vent_scrubber.dmi new file mode 100644 index 00000000000..a116f6ab67f Binary files /dev/null and b/icons/atmos/vent_scrubber.dmi differ diff --git a/icons/atmos/volume_pump.dmi b/icons/atmos/volume_pump.dmi new file mode 100644 index 00000000000..0f81c408eea Binary files /dev/null and b/icons/atmos/volume_pump.dmi differ diff --git a/icons/mob/head.dmi b/icons/mob/head.dmi index c4453316df9..feafab49836 100644 Binary files a/icons/mob/head.dmi and b/icons/mob/head.dmi differ diff --git a/icons/mob/roaper.dmi b/icons/mob/roaper.dmi new file mode 100644 index 00000000000..272251ec8ae Binary files /dev/null and b/icons/mob/roaper.dmi differ diff --git a/icons/mob/species/tajaran/suit.dmi b/icons/mob/species/tajaran/suit.dmi index 620da66a60c..d0eca318fd2 100644 Binary files a/icons/mob/species/tajaran/suit.dmi and b/icons/mob/species/tajaran/suit.dmi differ diff --git a/icons/mob/suit.dmi b/icons/mob/suit.dmi index 8e5903fbc67..9b8c463bab0 100644 Binary files a/icons/mob/suit.dmi and b/icons/mob/suit.dmi differ diff --git a/icons/obj/atmospherics/omni_devices.dmi b/icons/obj/atmospherics/omni_devices.dmi index 642e90a0f1d..398fd5f159e 100644 Binary files a/icons/obj/atmospherics/omni_devices.dmi and b/icons/obj/atmospherics/omni_devices.dmi differ diff --git a/icons/obj/clothing/hats.dmi b/icons/obj/clothing/hats.dmi index d2d32b4b1d1..31be71e8e9e 100644 Binary files a/icons/obj/clothing/hats.dmi and b/icons/obj/clothing/hats.dmi differ diff --git a/icons/obj/clothing/suits.dmi b/icons/obj/clothing/suits.dmi index 31a605f9352..7506de201e0 100644 Binary files a/icons/obj/clothing/suits.dmi and b/icons/obj/clothing/suits.dmi differ