mirror of
https://github.com/Yawn-Wider/YWPolarisVore.git
synced 2026-07-12 16:45:12 +01:00
Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings * Whitespace changes * Comment out merger hooks in gitattributes Corrupt maps would have to be resolved in repo before hooks could be updated * Revert "Whitespace changes" This reverts commit afbdd1d8442973f5d570c30920d9d865b5acd479. * Whitespace again minus example * Gitignore example changelog * Restore changelog merge setting * Keep older dmi hook attribute until hooks can be updated * update vscode settings too * Renormalize remaining * Revert "Gitignore example changelog" This reverts commit de22ad375d3ee4d5930c550da2fd23a29a86e616. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
@@ -1,129 +1,129 @@
|
||||
/obj/machinery/atmospherics/binary
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
|
||||
var/datum/pipe_network/network1
|
||||
var/datum/pipe_network/network2
|
||||
|
||||
/obj/machinery/atmospherics/binary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/binary/init_dir()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(EAST)
|
||||
initialize_directions = EAST|WEST
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
/obj/machinery/atmospherics/binary/get_neighbor_nodes_for_init()
|
||||
return list(node1, node2)
|
||||
|
||||
/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node1)
|
||||
network1 = new_network
|
||||
|
||||
else if(reference == node2)
|
||||
network2 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/binary/Destroy()
|
||||
. = ..()
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/atmos_init()
|
||||
if(node1 && node2)
|
||||
return
|
||||
|
||||
var/node2_connect = dir
|
||||
var/node1_connect = turn(dir, 180)
|
||||
|
||||
STANDARD_ATMOS_CHOOSE_NODE(1, node1_connect)
|
||||
STANDARD_ATMOS_CHOOSE_NODE(2, node2_connect)
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/build_network()
|
||||
if(!network1 && node1)
|
||||
network1 = new /datum/pipe_network()
|
||||
network1.normal_members += src
|
||||
network1.build_network(node1, src)
|
||||
|
||||
if(!network2 && node2)
|
||||
network2 = new /datum/pipe_network()
|
||||
network2.normal_members += src
|
||||
network2.build_network(node2, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network1
|
||||
|
||||
if(reference==node2)
|
||||
return network2
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/binary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network1 == old_network)
|
||||
network1 = new_network
|
||||
if(network2 == old_network)
|
||||
network2 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(network1 == reference)
|
||||
results += air1
|
||||
if(network2 == reference)
|
||||
results += air2
|
||||
|
||||
return results
|
||||
|
||||
/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
qdel(network1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
qdel(network2)
|
||||
node2 = null
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
|
||||
var/datum/pipe_network/network1
|
||||
var/datum/pipe_network/network2
|
||||
|
||||
/obj/machinery/atmospherics/binary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/binary/init_dir()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(EAST)
|
||||
initialize_directions = EAST|WEST
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
/obj/machinery/atmospherics/binary/get_neighbor_nodes_for_init()
|
||||
return list(node1, node2)
|
||||
|
||||
/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node1)
|
||||
network1 = new_network
|
||||
|
||||
else if(reference == node2)
|
||||
network2 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/binary/Destroy()
|
||||
. = ..()
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/atmos_init()
|
||||
if(node1 && node2)
|
||||
return
|
||||
|
||||
var/node2_connect = dir
|
||||
var/node1_connect = turn(dir, 180)
|
||||
|
||||
STANDARD_ATMOS_CHOOSE_NODE(1, node1_connect)
|
||||
STANDARD_ATMOS_CHOOSE_NODE(2, node2_connect)
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/build_network()
|
||||
if(!network1 && node1)
|
||||
network1 = new /datum/pipe_network()
|
||||
network1.normal_members += src
|
||||
network1.build_network(node1, src)
|
||||
|
||||
if(!network2 && node2)
|
||||
network2 = new /datum/pipe_network()
|
||||
network2.normal_members += src
|
||||
network2.build_network(node2, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network1
|
||||
|
||||
if(reference==node2)
|
||||
return network2
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/binary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network1 == old_network)
|
||||
network1 = new_network
|
||||
if(network2 == old_network)
|
||||
network2 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(network1 == reference)
|
||||
results += air1
|
||||
if(network2 == reference)
|
||||
results += air2
|
||||
|
||||
return results
|
||||
|
||||
/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
qdel(network1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
qdel(network2)
|
||||
node2 = null
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
@@ -1,152 +1,152 @@
|
||||
//node1, air1, network1 correspond to input
|
||||
//node2, air2, network2 correspond to output
|
||||
/obj/machinery/atmospherics/binary/circulator
|
||||
name = "circulator"
|
||||
desc = "A gas circulator turbine and heat exchanger."
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "circ-unassembled"
|
||||
anchored = FALSE
|
||||
unacidable = TRUE
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
|
||||
var/kinetic_efficiency = 0.04 //combined kinetic and kinetic-to-electric efficiency
|
||||
var/volume_ratio = 0.2
|
||||
|
||||
var/recent_moles_transferred = 0
|
||||
var/last_heat_capacity = 0
|
||||
var/last_temperature = 0
|
||||
var/last_pressure_delta = 0
|
||||
var/last_worldtime_transfer = 0
|
||||
var/last_stored_energy_transferred = 0
|
||||
var/volume_capacity_used = 0
|
||||
var/stored_energy = 0
|
||||
var/temperature_overlay
|
||||
|
||||
density = TRUE
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/New()
|
||||
..()
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
air1.volume = 400
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||
var/datum/gas_mixture/removed
|
||||
if(anchored && !(stat&BROKEN) && network1)
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
last_pressure_delta = max(input_starting_pressure - output_starting_pressure - 5, 0)
|
||||
|
||||
//only circulate air if there is a pressure difference (plus 5kPa kinetic, 10kPa static friction)
|
||||
if(air1.temperature > 0 && last_pressure_delta > 5)
|
||||
|
||||
//Calculate necessary moles to transfer using PV = nRT
|
||||
recent_moles_transferred = (last_pressure_delta*network1.volume/(air1.temperature * R_IDEAL_GAS_EQUATION))/3 //uses the volume of the whole network, not just itself
|
||||
volume_capacity_used = min( (last_pressure_delta*network1.volume/3)/(input_starting_pressure*air1.volume) , 1) //how much of the gas in the input air volume is consumed
|
||||
|
||||
//Calculate energy generated from kinetic turbine
|
||||
stored_energy += 1/ADIABATIC_EXPONENT * min(last_pressure_delta * network1.volume , input_starting_pressure*air1.volume) * (1 - volume_ratio**ADIABATIC_EXPONENT) * kinetic_efficiency
|
||||
|
||||
//Actually transfer the gas
|
||||
removed = air1.remove(recent_moles_transferred)
|
||||
if(removed)
|
||||
last_heat_capacity = removed.heat_capacity()
|
||||
last_temperature = removed.temperature
|
||||
|
||||
//Update the gas networks.
|
||||
network1.update = 1
|
||||
|
||||
last_worldtime_transfer = world.time
|
||||
else
|
||||
recent_moles_transferred = 0
|
||||
|
||||
update_icon()
|
||||
return removed
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_stored_energy()
|
||||
last_stored_energy_transferred = stored_energy
|
||||
stored_energy = 0
|
||||
return last_stored_energy_transferred
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/process()
|
||||
..()
|
||||
|
||||
if(last_worldtime_transfer < world.time - 50)
|
||||
recent_moles_transferred = 0
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/update_icon()
|
||||
icon_state = anchored ? "circ-assembled" : "circ-unassembled"
|
||||
cut_overlays()
|
||||
if (stat & (BROKEN|NOPOWER) || !anchored)
|
||||
return 1
|
||||
if (last_pressure_delta > 0 && recent_moles_transferred > 0)
|
||||
if (temperature_overlay)
|
||||
add_overlay(temperature_overlay)
|
||||
if (last_pressure_delta > 5*ONE_ATMOSPHERE)
|
||||
add_overlay("circ-run")
|
||||
else
|
||||
add_overlay("circ-slow")
|
||||
else
|
||||
add_overlay("circ-off")
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
anchored = !anchored
|
||||
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \
|
||||
"You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
|
||||
if(anchored)
|
||||
temperature_overlay = null
|
||||
if(dir & (NORTH|SOUTH))
|
||||
initialize_directions = NORTH|SOUTH
|
||||
else if(dir & (EAST|WEST))
|
||||
initialize_directions = EAST|WEST
|
||||
|
||||
atmos_init()
|
||||
build_network()
|
||||
if (node1)
|
||||
node1.atmos_init()
|
||||
node1.build_network()
|
||||
if (node2)
|
||||
node2.atmos_init()
|
||||
node2.build_network()
|
||||
else
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/verb/rotate_clockwise()
|
||||
set name = "Rotate Circulator Clockwise"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Circulator Counterclockwise"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
//node1, air1, network1 correspond to input
|
||||
//node2, air2, network2 correspond to output
|
||||
/obj/machinery/atmospherics/binary/circulator
|
||||
name = "circulator"
|
||||
desc = "A gas circulator turbine and heat exchanger."
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "circ-unassembled"
|
||||
anchored = FALSE
|
||||
unacidable = TRUE
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
|
||||
var/kinetic_efficiency = 0.04 //combined kinetic and kinetic-to-electric efficiency
|
||||
var/volume_ratio = 0.2
|
||||
|
||||
var/recent_moles_transferred = 0
|
||||
var/last_heat_capacity = 0
|
||||
var/last_temperature = 0
|
||||
var/last_pressure_delta = 0
|
||||
var/last_worldtime_transfer = 0
|
||||
var/last_stored_energy_transferred = 0
|
||||
var/volume_capacity_used = 0
|
||||
var/stored_energy = 0
|
||||
var/temperature_overlay
|
||||
|
||||
density = TRUE
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/New()
|
||||
..()
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
air1.volume = 400
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||
var/datum/gas_mixture/removed
|
||||
if(anchored && !(stat&BROKEN) && network1)
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
last_pressure_delta = max(input_starting_pressure - output_starting_pressure - 5, 0)
|
||||
|
||||
//only circulate air if there is a pressure difference (plus 5kPa kinetic, 10kPa static friction)
|
||||
if(air1.temperature > 0 && last_pressure_delta > 5)
|
||||
|
||||
//Calculate necessary moles to transfer using PV = nRT
|
||||
recent_moles_transferred = (last_pressure_delta*network1.volume/(air1.temperature * R_IDEAL_GAS_EQUATION))/3 //uses the volume of the whole network, not just itself
|
||||
volume_capacity_used = min( (last_pressure_delta*network1.volume/3)/(input_starting_pressure*air1.volume) , 1) //how much of the gas in the input air volume is consumed
|
||||
|
||||
//Calculate energy generated from kinetic turbine
|
||||
stored_energy += 1/ADIABATIC_EXPONENT * min(last_pressure_delta * network1.volume , input_starting_pressure*air1.volume) * (1 - volume_ratio**ADIABATIC_EXPONENT) * kinetic_efficiency
|
||||
|
||||
//Actually transfer the gas
|
||||
removed = air1.remove(recent_moles_transferred)
|
||||
if(removed)
|
||||
last_heat_capacity = removed.heat_capacity()
|
||||
last_temperature = removed.temperature
|
||||
|
||||
//Update the gas networks.
|
||||
network1.update = 1
|
||||
|
||||
last_worldtime_transfer = world.time
|
||||
else
|
||||
recent_moles_transferred = 0
|
||||
|
||||
update_icon()
|
||||
return removed
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_stored_energy()
|
||||
last_stored_energy_transferred = stored_energy
|
||||
stored_energy = 0
|
||||
return last_stored_energy_transferred
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/process()
|
||||
..()
|
||||
|
||||
if(last_worldtime_transfer < world.time - 50)
|
||||
recent_moles_transferred = 0
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/update_icon()
|
||||
icon_state = anchored ? "circ-assembled" : "circ-unassembled"
|
||||
cut_overlays()
|
||||
if (stat & (BROKEN|NOPOWER) || !anchored)
|
||||
return 1
|
||||
if (last_pressure_delta > 0 && recent_moles_transferred > 0)
|
||||
if (temperature_overlay)
|
||||
add_overlay(temperature_overlay)
|
||||
if (last_pressure_delta > 5*ONE_ATMOSPHERE)
|
||||
add_overlay("circ-run")
|
||||
else
|
||||
add_overlay("circ-slow")
|
||||
else
|
||||
add_overlay("circ-off")
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
anchored = !anchored
|
||||
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \
|
||||
"You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
|
||||
if(anchored)
|
||||
temperature_overlay = null
|
||||
if(dir & (NORTH|SOUTH))
|
||||
initialize_directions = NORTH|SOUTH
|
||||
else if(dir & (EAST|WEST))
|
||||
initialize_directions = EAST|WEST
|
||||
|
||||
atmos_init()
|
||||
build_network()
|
||||
if (node1)
|
||||
node1.atmos_init()
|
||||
node1.build_network()
|
||||
if (node2)
|
||||
node2.atmos_init()
|
||||
node2.build_network()
|
||||
else
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/verb/rotate_clockwise()
|
||||
set name = "Rotate Circulator Clockwise"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Circulator Counterclockwise"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
@@ -1,263 +1,263 @@
|
||||
#define DEFAULT_PRESSURE_DELTA 10000
|
||||
|
||||
#define EXTERNAL_PRESSURE_BOUND ONE_ATMOSPHERE
|
||||
#define INTERNAL_PRESSURE_BOUND 0
|
||||
#define PRESSURE_CHECKS 1
|
||||
|
||||
#define PRESSURE_CHECK_EXTERNAL 1
|
||||
#define PRESSURE_CHECK_INPUT 2
|
||||
#define PRESSURE_CHECK_OUTPUT 4
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump
|
||||
icon = 'icons/atmos/vent_pump.dmi'
|
||||
icon_state = "map_dp_vent"
|
||||
|
||||
//node2 is output port
|
||||
//node1 is input port
|
||||
|
||||
name = "Dual Port Air Vent"
|
||||
desc = "Has a valve and pump attached to it. There are two ports."
|
||||
|
||||
level = 1
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //7500 W ~ 10 HP
|
||||
|
||||
pipe_flags = PIPING_ALL_LAYER
|
||||
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER //connects to regular, supply and scrubbers pipes
|
||||
|
||||
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
||||
|
||||
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
|
||||
var/input_pressure_min = INTERNAL_PRESSURE_BOUND
|
||||
var/output_pressure_max = DEFAULT_PRESSURE_DELTA
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
var/pressure_checks = PRESSURE_CHECK_EXTERNAL
|
||||
//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()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
icon = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/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 = ATMOS_DEFAULT_VOLUME_PUMP + 800
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP + 800
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0)
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
cut_overlays()
|
||||
|
||||
var/vent_icon = "vent"
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
if(!T.is_plating() && 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 += "[use_power ? "[pump_direction ? "out" : "in"]" : "off"]"
|
||||
|
||||
add_overlay(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.is_plating() && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
else
|
||||
if (node1)
|
||||
add_underlay(T, node1, turn(dir, -180), node1.icon_connect_type)
|
||||
else
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
if (node2)
|
||||
add_underlay(T, node2, dir, node2.icon_connect_type)
|
||||
else
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i)
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if(stat & (NOPOWER|BROKEN) || !use_power)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/power_draw = -1
|
||||
|
||||
//Figure out the target pressure difference
|
||||
var/pressure_delta = get_pressure_delta(environment)
|
||||
|
||||
if(pressure_delta > 0.5)
|
||||
if(pump_direction) //internal -> external
|
||||
if (node1 && (environment.temperature || air1.temperature))
|
||||
var/transfer_moles = calculate_transfer_moles(air1, environment, pressure_delta)
|
||||
power_draw = pump_gas(src, air1, environment, transfer_moles, power_rating)
|
||||
|
||||
if(power_draw >= 0 && network1)
|
||||
network1.update = 1
|
||||
else //external -> internal
|
||||
if (node2 && (environment.temperature || air2.temperature))
|
||||
var/transfer_moles = calculate_transfer_moles(environment, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
|
||||
//limit flow rate from turfs
|
||||
transfer_moles = min(transfer_moles, environment.total_moles*air2.volume/environment.volume) //group_multiplier gets divided out here
|
||||
power_draw = pump_gas(src, environment, air2, transfer_moles, power_rating)
|
||||
|
||||
if(power_draw >= 0 && network2)
|
||||
network2.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/get_pressure_delta(datum/gas_mixture/environment)
|
||||
var/pressure_delta = DEFAULT_PRESSURE_DELTA
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
if(pump_direction) //internal -> external
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, external_pressure_bound - environment_pressure) //increasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_INPUT)
|
||||
pressure_delta = min(pressure_delta, air1.return_pressure() - input_pressure_min) //decreasing the pressure here
|
||||
else //external -> internal
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, environment_pressure - external_pressure_bound) //decreasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_OUTPUT)
|
||||
pressure_delta = min(pressure_delta, output_pressure_max - air2.return_pressure()) //increasing the pressure here
|
||||
|
||||
return pressure_delta
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "ADVP",
|
||||
"power" = use_power,
|
||||
"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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/examine(mob/user)
|
||||
. = ..()
|
||||
if(Adjacent(user))
|
||||
. += "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/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"])
|
||||
update_use_power(text2num(signal.data["power"]))
|
||||
|
||||
if(signal.data["power_toggle"])
|
||||
update_use_power(!use_power)
|
||||
|
||||
if(signal.data["direction"])
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
|
||||
if(signal.data["checks"])
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
|
||||
if(signal.data["purge"])
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if(signal.data["stabalize"])
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
if(signal.data["set_input_pressure"])
|
||||
input_pressure_min = between(0, text2num(signal.data["set_input_pressure"]), ONE_ATMOSPHERE*50)
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
output_pressure_max = between(0, text2num(signal.data["set_output_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(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
#undef DEFAULT_PRESSURE_DELTA
|
||||
|
||||
#undef EXTERNAL_PRESSURE_BOUND
|
||||
#undef INTERNAL_PRESSURE_BOUND
|
||||
#undef PRESSURE_CHECKS
|
||||
|
||||
#undef PRESSURE_CHECK_EXTERNAL
|
||||
#undef PRESSURE_CHECK_INPUT
|
||||
#undef PRESSURE_CHECK_OUTPUT
|
||||
#define DEFAULT_PRESSURE_DELTA 10000
|
||||
|
||||
#define EXTERNAL_PRESSURE_BOUND ONE_ATMOSPHERE
|
||||
#define INTERNAL_PRESSURE_BOUND 0
|
||||
#define PRESSURE_CHECKS 1
|
||||
|
||||
#define PRESSURE_CHECK_EXTERNAL 1
|
||||
#define PRESSURE_CHECK_INPUT 2
|
||||
#define PRESSURE_CHECK_OUTPUT 4
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump
|
||||
icon = 'icons/atmos/vent_pump.dmi'
|
||||
icon_state = "map_dp_vent"
|
||||
|
||||
//node2 is output port
|
||||
//node1 is input port
|
||||
|
||||
name = "Dual Port Air Vent"
|
||||
desc = "Has a valve and pump attached to it. There are two ports."
|
||||
|
||||
level = 1
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //7500 W ~ 10 HP
|
||||
|
||||
pipe_flags = PIPING_ALL_LAYER
|
||||
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER //connects to regular, supply and scrubbers pipes
|
||||
|
||||
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
||||
|
||||
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
|
||||
var/input_pressure_min = INTERNAL_PRESSURE_BOUND
|
||||
var/output_pressure_max = DEFAULT_PRESSURE_DELTA
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
var/pressure_checks = PRESSURE_CHECK_EXTERNAL
|
||||
//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()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
icon = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/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 = ATMOS_DEFAULT_VOLUME_PUMP + 800
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP + 800
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0)
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
cut_overlays()
|
||||
|
||||
var/vent_icon = "vent"
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
if(!T.is_plating() && 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 += "[use_power ? "[pump_direction ? "out" : "in"]" : "off"]"
|
||||
|
||||
add_overlay(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.is_plating() && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
else
|
||||
if (node1)
|
||||
add_underlay(T, node1, turn(dir, -180), node1.icon_connect_type)
|
||||
else
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
if (node2)
|
||||
add_underlay(T, node2, dir, node2.icon_connect_type)
|
||||
else
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i)
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if(stat & (NOPOWER|BROKEN) || !use_power)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/power_draw = -1
|
||||
|
||||
//Figure out the target pressure difference
|
||||
var/pressure_delta = get_pressure_delta(environment)
|
||||
|
||||
if(pressure_delta > 0.5)
|
||||
if(pump_direction) //internal -> external
|
||||
if (node1 && (environment.temperature || air1.temperature))
|
||||
var/transfer_moles = calculate_transfer_moles(air1, environment, pressure_delta)
|
||||
power_draw = pump_gas(src, air1, environment, transfer_moles, power_rating)
|
||||
|
||||
if(power_draw >= 0 && network1)
|
||||
network1.update = 1
|
||||
else //external -> internal
|
||||
if (node2 && (environment.temperature || air2.temperature))
|
||||
var/transfer_moles = calculate_transfer_moles(environment, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
|
||||
//limit flow rate from turfs
|
||||
transfer_moles = min(transfer_moles, environment.total_moles*air2.volume/environment.volume) //group_multiplier gets divided out here
|
||||
power_draw = pump_gas(src, environment, air2, transfer_moles, power_rating)
|
||||
|
||||
if(power_draw >= 0 && network2)
|
||||
network2.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/get_pressure_delta(datum/gas_mixture/environment)
|
||||
var/pressure_delta = DEFAULT_PRESSURE_DELTA
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
if(pump_direction) //internal -> external
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, external_pressure_bound - environment_pressure) //increasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_INPUT)
|
||||
pressure_delta = min(pressure_delta, air1.return_pressure() - input_pressure_min) //decreasing the pressure here
|
||||
else //external -> internal
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, environment_pressure - external_pressure_bound) //decreasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_OUTPUT)
|
||||
pressure_delta = min(pressure_delta, output_pressure_max - air2.return_pressure()) //increasing the pressure here
|
||||
|
||||
return pressure_delta
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "ADVP",
|
||||
"power" = use_power,
|
||||
"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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/examine(mob/user)
|
||||
. = ..()
|
||||
if(Adjacent(user))
|
||||
. += "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/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"])
|
||||
update_use_power(text2num(signal.data["power"]))
|
||||
|
||||
if(signal.data["power_toggle"])
|
||||
update_use_power(!use_power)
|
||||
|
||||
if(signal.data["direction"])
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
|
||||
if(signal.data["checks"])
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
|
||||
if(signal.data["purge"])
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if(signal.data["stabalize"])
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
if(signal.data["set_input_pressure"])
|
||||
input_pressure_min = between(0, text2num(signal.data["set_input_pressure"]), ONE_ATMOSPHERE*50)
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
output_pressure_max = between(0, text2num(signal.data["set_output_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(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
#undef DEFAULT_PRESSURE_DELTA
|
||||
|
||||
#undef EXTERNAL_PRESSURE_BOUND
|
||||
#undef INTERNAL_PRESSURE_BOUND
|
||||
#undef PRESSURE_CHECKS
|
||||
|
||||
#undef PRESSURE_CHECK_EXTERNAL
|
||||
#undef PRESSURE_CHECK_INPUT
|
||||
#undef PRESSURE_CHECK_OUTPUT
|
||||
|
||||
@@ -1,302 +1,302 @@
|
||||
#define REGULATE_NONE 0
|
||||
#define REGULATE_INPUT 1 //shuts off when input side is below the target pressure
|
||||
#define REGULATE_OUTPUT 2 //shuts off when output side is above the target pressure
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate
|
||||
icon = 'icons/atmos/passive_gate.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "passivegate"
|
||||
level = 1
|
||||
|
||||
name = "pressure regulator"
|
||||
desc = "A one-way air valve that can be used to regulate input or output pressure, and flow rate. Does not require power."
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
interact_offline = TRUE
|
||||
|
||||
var/unlocked = 0 //If 0, then the valve is locked closed, otherwise it is open(-able, it's a one-way valve so it closes if gas would flow backwards).
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
var/max_pressure_setting = 15000 //kPa
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
var/regulate_mode = REGULATE_OUTPUT
|
||||
|
||||
var/flowing = 0 //for icons - becomes zero if the valve closes itself due to regulation mode
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/update_icon()
|
||||
icon_state = (unlocked && flowing)? "on" : "off"
|
||||
|
||||
/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)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/process()
|
||||
..()
|
||||
|
||||
last_flow_rate = 0
|
||||
|
||||
if(!unlocked)
|
||||
return 0
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
|
||||
var/pressure_delta
|
||||
switch (regulate_mode)
|
||||
if (REGULATE_INPUT)
|
||||
pressure_delta = input_starting_pressure - target_pressure
|
||||
if (REGULATE_OUTPUT)
|
||||
pressure_delta = target_pressure - output_starting_pressure
|
||||
if (REGULATE_NONE)
|
||||
pressure_delta = input_starting_pressure - output_starting_pressure
|
||||
|
||||
//-1 if pump_gas() did not move any gas, >= 0 otherwise
|
||||
var/returnval = -1
|
||||
if((regulate_mode == REGULATE_NONE || pressure_delta > 0.01) && (air1.temperature > 0 || air2.temperature > 0)) //since it's basically a valve, it makes sense to check both temperatures
|
||||
flowing = 1
|
||||
|
||||
//flow rate limit
|
||||
var/transfer_moles = (set_flow_rate/air1.volume)*air1.total_moles
|
||||
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
switch (regulate_mode)
|
||||
if (REGULATE_INPUT)
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air2, air1, pressure_delta, (network1)? network1.volume : 0))
|
||||
if (REGULATE_OUTPUT)
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0))
|
||||
if (REGULATE_NONE)
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
transfer_moles = max(0, calculate_equalize_moles(source, sink)) // Not regulated, don't care about flow rate
|
||||
|
||||
//pump_gas() will return a negative number if no flow occurred
|
||||
if(regulate_mode == REGULATE_NONE) // ACTUALLY move gases from the whole network, not just the immediate pipes
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
returnval = pump_gas_passive(src, source, sink, transfer_moles)
|
||||
else
|
||||
returnval = pump_gas_passive(src, air1, air2, transfer_moles)
|
||||
|
||||
if (returnval >= 0)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if (last_flow_rate)
|
||||
flowing = 1
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = unlocked,
|
||||
"target_output" = target_pressure,
|
||||
"regulate_mode" = regulate_mode,
|
||||
"set_flow_rate" = set_flow_rate,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/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" in signal.data)
|
||||
unlocked = text2num(signal.data["power"])
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
unlocked = !unlocked
|
||||
|
||||
if("set_target_pressure" in signal.data)
|
||||
target_pressure = between(0, text2num(signal.data["set_target_pressure"]), max_pressure_setting)
|
||||
|
||||
if("set_regulate_mode" in signal.data)
|
||||
regulate_mode = text2num(signal.data["set_regulate_mode"])
|
||||
|
||||
if("set_flow_rate" in signal.data)
|
||||
regulate_mode = text2num(signal.data["set_flow_rate"])
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
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
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & BROKEN)
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "PressureRegulator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_data(mob/user)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
"on" = unlocked,
|
||||
"pressure_set" = round(target_pressure*100), //Nano UI can't handle rounded non-integers, apparently.
|
||||
"max_pressure" = max_pressure_setting,
|
||||
"input_pressure" = round(air1.return_pressure()*100),
|
||||
"output_pressure" = round(air2.return_pressure()*100),
|
||||
"regulate_mode" = regulate_mode,
|
||||
"set_flow_rate" = round(set_flow_rate*10),
|
||||
"last_flow_rate" = round(last_flow_rate*10),
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("toggle_valve")
|
||||
. = TRUE
|
||||
unlocked = !unlocked
|
||||
if("regulate_mode")
|
||||
. = TRUE
|
||||
switch(params["mode"])
|
||||
if("off") regulate_mode = REGULATE_NONE
|
||||
if("input") regulate_mode = REGULATE_INPUT
|
||||
if("output") regulate_mode = REGULATE_OUTPUT
|
||||
|
||||
if("set_press")
|
||||
. = TRUE
|
||||
switch(params["press"])
|
||||
if("min")
|
||||
target_pressure = 0
|
||||
if("max")
|
||||
target_pressure = max_pressure_setting
|
||||
if("set")
|
||||
var/new_pressure = tgui_input_number(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",src.target_pressure,max_pressure_setting,0)
|
||||
src.target_pressure = between(0, new_pressure, max_pressure_setting)
|
||||
|
||||
if("set_flow_rate")
|
||||
. = TRUE
|
||||
switch(params["press"])
|
||||
if("min")
|
||||
set_flow_rate = 0
|
||||
if("max")
|
||||
set_flow_rate = air1.volume
|
||||
if("set")
|
||||
var/new_flow_rate = tgui_input_number(usr,"Enter new flow rate limit (0-[air1.volume]L/s)","Flow Rate Control",src.set_flow_rate,air1.volume,0)
|
||||
src.set_flow_rate = between(0, new_flow_rate, air1.volume)
|
||||
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
if (unlocked)
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>")
|
||||
return 1
|
||||
if(!can_unwrench())
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40 * W.toolspeed))
|
||||
user.visible_message( \
|
||||
"<b>\The [user]</b> unfastens \the [src].", \
|
||||
"<span class='notice'>You have unfastened \the [src].</span>", \
|
||||
"You hear ratchet.")
|
||||
deconstruct()
|
||||
|
||||
#undef REGULATE_NONE
|
||||
#undef REGULATE_INPUT
|
||||
#undef REGULATE_OUTPUT
|
||||
#define REGULATE_NONE 0
|
||||
#define REGULATE_INPUT 1 //shuts off when input side is below the target pressure
|
||||
#define REGULATE_OUTPUT 2 //shuts off when output side is above the target pressure
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate
|
||||
icon = 'icons/atmos/passive_gate.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "passivegate"
|
||||
level = 1
|
||||
|
||||
name = "pressure regulator"
|
||||
desc = "A one-way air valve that can be used to regulate input or output pressure, and flow rate. Does not require power."
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
interact_offline = TRUE
|
||||
|
||||
var/unlocked = 0 //If 0, then the valve is locked closed, otherwise it is open(-able, it's a one-way valve so it closes if gas would flow backwards).
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
var/max_pressure_setting = 15000 //kPa
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
var/regulate_mode = REGULATE_OUTPUT
|
||||
|
||||
var/flowing = 0 //for icons - becomes zero if the valve closes itself due to regulation mode
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP * 2.5
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/update_icon()
|
||||
icon_state = (unlocked && flowing)? "on" : "off"
|
||||
|
||||
/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)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/process()
|
||||
..()
|
||||
|
||||
last_flow_rate = 0
|
||||
|
||||
if(!unlocked)
|
||||
return 0
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
|
||||
var/pressure_delta
|
||||
switch (regulate_mode)
|
||||
if (REGULATE_INPUT)
|
||||
pressure_delta = input_starting_pressure - target_pressure
|
||||
if (REGULATE_OUTPUT)
|
||||
pressure_delta = target_pressure - output_starting_pressure
|
||||
if (REGULATE_NONE)
|
||||
pressure_delta = input_starting_pressure - output_starting_pressure
|
||||
|
||||
//-1 if pump_gas() did not move any gas, >= 0 otherwise
|
||||
var/returnval = -1
|
||||
if((regulate_mode == REGULATE_NONE || pressure_delta > 0.01) && (air1.temperature > 0 || air2.temperature > 0)) //since it's basically a valve, it makes sense to check both temperatures
|
||||
flowing = 1
|
||||
|
||||
//flow rate limit
|
||||
var/transfer_moles = (set_flow_rate/air1.volume)*air1.total_moles
|
||||
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
switch (regulate_mode)
|
||||
if (REGULATE_INPUT)
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air2, air1, pressure_delta, (network1)? network1.volume : 0))
|
||||
if (REGULATE_OUTPUT)
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0))
|
||||
if (REGULATE_NONE)
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
transfer_moles = max(0, calculate_equalize_moles(source, sink)) // Not regulated, don't care about flow rate
|
||||
|
||||
//pump_gas() will return a negative number if no flow occurred
|
||||
if(regulate_mode == REGULATE_NONE) // ACTUALLY move gases from the whole network, not just the immediate pipes
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
returnval = pump_gas_passive(src, source, sink, transfer_moles)
|
||||
else
|
||||
returnval = pump_gas_passive(src, air1, air2, transfer_moles)
|
||||
|
||||
if (returnval >= 0)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if (last_flow_rate)
|
||||
flowing = 1
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = unlocked,
|
||||
"target_output" = target_pressure,
|
||||
"regulate_mode" = regulate_mode,
|
||||
"set_flow_rate" = set_flow_rate,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/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" in signal.data)
|
||||
unlocked = text2num(signal.data["power"])
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
unlocked = !unlocked
|
||||
|
||||
if("set_target_pressure" in signal.data)
|
||||
target_pressure = between(0, text2num(signal.data["set_target_pressure"]), max_pressure_setting)
|
||||
|
||||
if("set_regulate_mode" in signal.data)
|
||||
regulate_mode = text2num(signal.data["set_regulate_mode"])
|
||||
|
||||
if("set_flow_rate" in signal.data)
|
||||
regulate_mode = text2num(signal.data["set_flow_rate"])
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
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
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & BROKEN)
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "PressureRegulator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_data(mob/user)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
"on" = unlocked,
|
||||
"pressure_set" = round(target_pressure*100), //Nano UI can't handle rounded non-integers, apparently.
|
||||
"max_pressure" = max_pressure_setting,
|
||||
"input_pressure" = round(air1.return_pressure()*100),
|
||||
"output_pressure" = round(air2.return_pressure()*100),
|
||||
"regulate_mode" = regulate_mode,
|
||||
"set_flow_rate" = round(set_flow_rate*10),
|
||||
"last_flow_rate" = round(last_flow_rate*10),
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("toggle_valve")
|
||||
. = TRUE
|
||||
unlocked = !unlocked
|
||||
if("regulate_mode")
|
||||
. = TRUE
|
||||
switch(params["mode"])
|
||||
if("off") regulate_mode = REGULATE_NONE
|
||||
if("input") regulate_mode = REGULATE_INPUT
|
||||
if("output") regulate_mode = REGULATE_OUTPUT
|
||||
|
||||
if("set_press")
|
||||
. = TRUE
|
||||
switch(params["press"])
|
||||
if("min")
|
||||
target_pressure = 0
|
||||
if("max")
|
||||
target_pressure = max_pressure_setting
|
||||
if("set")
|
||||
var/new_pressure = tgui_input_number(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",src.target_pressure,max_pressure_setting,0)
|
||||
src.target_pressure = between(0, new_pressure, max_pressure_setting)
|
||||
|
||||
if("set_flow_rate")
|
||||
. = TRUE
|
||||
switch(params["press"])
|
||||
if("min")
|
||||
set_flow_rate = 0
|
||||
if("max")
|
||||
set_flow_rate = air1.volume
|
||||
if("set")
|
||||
var/new_flow_rate = tgui_input_number(usr,"Enter new flow rate limit (0-[air1.volume]L/s)","Flow Rate Control",src.set_flow_rate,air1.volume,0)
|
||||
src.set_flow_rate = between(0, new_flow_rate, air1.volume)
|
||||
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
if (unlocked)
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>")
|
||||
return 1
|
||||
if(!can_unwrench())
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40 * W.toolspeed))
|
||||
user.visible_message( \
|
||||
"<b>\The [user]</b> unfastens \the [src].", \
|
||||
"<span class='notice'>You have unfastened \the [src].</span>", \
|
||||
"You hear ratchet.")
|
||||
deconstruct()
|
||||
|
||||
#undef REGULATE_NONE
|
||||
#undef REGULATE_INPUT
|
||||
#undef REGULATE_OUTPUT
|
||||
|
||||
@@ -1,258 +1,258 @@
|
||||
/*
|
||||
Every cycle, the pump uses the air in air_in to try and make air_out the perfect pressure.
|
||||
|
||||
node1, air1, network1 correspond to input
|
||||
node2, air2, network2 correspond to output
|
||||
|
||||
Thus, the two variables affect pump operation are set in New():
|
||||
air1.volume
|
||||
This is the volume of gas available to the pump that may be transfered to the output
|
||||
air2.volume
|
||||
Higher quantities of this cause more air to be perfected later
|
||||
but overall network volume is also increased as this increases...
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump
|
||||
icon = 'icons/atmos/pump.dmi'
|
||||
icon_state = "map_off"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "pump"
|
||||
level = 1
|
||||
var/base_icon = "pump"
|
||||
|
||||
name = "gas pump"
|
||||
desc = "A pump that moves gas from one place to another."
|
||||
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
//var/max_volume_transfer = 10000
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //7500 W ~ 10 HP
|
||||
|
||||
var/max_pressure_setting = 15000 //kPa
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/on
|
||||
icon_state = "map_on"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/fuel
|
||||
icon_state = "map_off-fuel"
|
||||
base_icon = "pump-fuel"
|
||||
icon_connect_type = "-fuel"
|
||||
connect_types = CONNECT_TYPE_FUEL
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/fuel/on
|
||||
icon_state = "map_on-fuel"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/aux
|
||||
icon_state = "map_off-aux"
|
||||
base_icon = "pump-aux"
|
||||
icon_connect_type = "-aux"
|
||||
connect_types = CONNECT_TYPE_AUX
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/aux/on
|
||||
icon_state = "map_on-aux"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "[base_icon]-off"
|
||||
else
|
||||
icon_state = "[use_power ? "[base_icon]-on" : "[base_icon]-off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, turn(dir, -180), node1?.icon_connect_type)
|
||||
add_underlay(T, node2, dir, node2?.icon_connect_type)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/process()
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
var/power_draw = -1
|
||||
var/pressure_delta = target_pressure - air2.return_pressure()
|
||||
|
||||
if(pressure_delta > 0.01 && air1.temperature > 0)
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
var/transfer_moles = calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
power_draw = pump_gas(src, air1, air2, transfer_moles, power_rating)
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = use_power,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "GasPump", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_data(mob/user)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
"on" = use_power,
|
||||
"pressure_set" = round(target_pressure*100), //Nano UI can't handle rounded non-integers, apparently.
|
||||
"max_pressure" = max_pressure_setting,
|
||||
"last_flow_rate" = round(last_flow_rate*10),
|
||||
"last_power_draw" = round(last_power_draw),
|
||||
"max_power_draw" = power_rating,
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
/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(signal.data["power"])
|
||||
if(text2num(signal.data["power"]))
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
else
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
update_use_power(!use_power)
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
target_pressure = between(0, text2num(signal.data["set_output_pressure"]), ONE_ATMOSPHERE*50)
|
||||
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_ghost(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("set_press")
|
||||
var/press = params["press"]
|
||||
switch(press)
|
||||
if("min")
|
||||
target_pressure = 0
|
||||
if("max")
|
||||
target_pressure = max_pressure_setting
|
||||
if("set")
|
||||
var/new_pressure = tgui_input_number(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure,max_pressure_setting,0)
|
||||
src.target_pressure = between(0, new_pressure, max_pressure_setting)
|
||||
. = TRUE
|
||||
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && use_power)
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>")
|
||||
return 1
|
||||
if(!can_unwrench())
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench this [src], it too exerted due to internal pressure.</span>")
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40 * W.toolspeed))
|
||||
user.visible_message( \
|
||||
"<b>\The [user]</b> unfastens \the [src].", \
|
||||
"<span class='notice'>You have unfastened \the [src].</span>", \
|
||||
"You hear ratchet.")
|
||||
deconstruct()
|
||||
/*
|
||||
Every cycle, the pump uses the air in air_in to try and make air_out the perfect pressure.
|
||||
|
||||
node1, air1, network1 correspond to input
|
||||
node2, air2, network2 correspond to output
|
||||
|
||||
Thus, the two variables affect pump operation are set in New():
|
||||
air1.volume
|
||||
This is the volume of gas available to the pump that may be transfered to the output
|
||||
air2.volume
|
||||
Higher quantities of this cause more air to be perfected later
|
||||
but overall network volume is also increased as this increases...
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump
|
||||
icon = 'icons/atmos/pump.dmi'
|
||||
icon_state = "map_off"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "pump"
|
||||
level = 1
|
||||
var/base_icon = "pump"
|
||||
|
||||
name = "gas pump"
|
||||
desc = "A pump that moves gas from one place to another."
|
||||
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
//var/max_volume_transfer = 10000
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //7500 W ~ 10 HP
|
||||
|
||||
var/max_pressure_setting = 15000 //kPa
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/on
|
||||
icon_state = "map_on"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/fuel
|
||||
icon_state = "map_off-fuel"
|
||||
base_icon = "pump-fuel"
|
||||
icon_connect_type = "-fuel"
|
||||
connect_types = CONNECT_TYPE_FUEL
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/fuel/on
|
||||
icon_state = "map_on-fuel"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/aux
|
||||
icon_state = "map_off-aux"
|
||||
base_icon = "pump-aux"
|
||||
icon_connect_type = "-aux"
|
||||
connect_types = CONNECT_TYPE_AUX
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/aux/on
|
||||
icon_state = "map_on-aux"
|
||||
use_power = USE_POWER_IDLE
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "[base_icon]-off"
|
||||
else
|
||||
icon_state = "[use_power ? "[base_icon]-on" : "[base_icon]-off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, turn(dir, -180), node1?.icon_connect_type)
|
||||
add_underlay(T, node2, dir, node2?.icon_connect_type)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/process()
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
var/power_draw = -1
|
||||
var/pressure_delta = target_pressure - air2.return_pressure()
|
||||
|
||||
if(pressure_delta > 0.01 && air1.temperature > 0)
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
var/transfer_moles = calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
power_draw = pump_gas(src, air1, air2, transfer_moles, power_rating)
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
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, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = TRANSMISSION_RADIO //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = use_power,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "GasPump", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_data(mob/user)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
"on" = use_power,
|
||||
"pressure_set" = round(target_pressure*100), //Nano UI can't handle rounded non-integers, apparently.
|
||||
"max_pressure" = max_pressure_setting,
|
||||
"last_flow_rate" = round(last_flow_rate*10),
|
||||
"last_power_draw" = round(last_power_draw),
|
||||
"max_power_draw" = power_rating,
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
/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(signal.data["power"])
|
||||
if(text2num(signal.data["power"]))
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
else
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
update_use_power(!use_power)
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
target_pressure = between(0, text2num(signal.data["set_output_pressure"]), ONE_ATMOSPHERE*50)
|
||||
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_ghost(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("set_press")
|
||||
var/press = params["press"]
|
||||
switch(press)
|
||||
if("min")
|
||||
target_pressure = 0
|
||||
if("max")
|
||||
target_pressure = max_pressure_setting
|
||||
if("set")
|
||||
var/new_pressure = tgui_input_number(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure,max_pressure_setting,0)
|
||||
src.target_pressure = between(0, new_pressure, max_pressure_setting)
|
||||
. = TRUE
|
||||
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && use_power)
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>")
|
||||
return 1
|
||||
if(!can_unwrench())
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench this [src], it too exerted due to internal pressure.</span>")
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40 * W.toolspeed))
|
||||
user.visible_message( \
|
||||
"<b>\The [user]</b> unfastens \the [src].", \
|
||||
"<span class='notice'>You have unfastened \the [src].</span>", \
|
||||
"You hear ratchet.")
|
||||
deconstruct()
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/obj/machinery/atmospherics/binary/pump/high_power
|
||||
icon = 'icons/atmos/volume_pump.dmi'
|
||||
icon_state = "map_off"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "volumepump"
|
||||
level = 1
|
||||
|
||||
name = "high power gas pump"
|
||||
desc = "A pump that moves gas from one place to another. Has double the power rating of the standard gas pump."
|
||||
|
||||
power_rating = 15000 //15000 W ~ 20 HP
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/high_power/on
|
||||
use_power = USE_POWER_IDLE
|
||||
icon_state = "map_on"
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/high_power/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
else
|
||||
/obj/machinery/atmospherics/binary/pump/high_power
|
||||
icon = 'icons/atmos/volume_pump.dmi'
|
||||
icon_state = "map_off"
|
||||
construction_type = /obj/item/pipe/directional
|
||||
pipe_state = "volumepump"
|
||||
level = 1
|
||||
|
||||
name = "high power gas pump"
|
||||
desc = "A pump that moves gas from one place to another. Has double the power rating of the standard gas pump."
|
||||
|
||||
power_rating = 15000 //15000 W ~ 20 HP
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/high_power/on
|
||||
use_power = USE_POWER_IDLE
|
||||
icon_state = "map_on"
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/high_power/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
else
|
||||
icon_state = "[use_power ? "on" : "off"]"
|
||||
Reference in New Issue
Block a user