mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 04:28: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 commitafbdd1d844. * 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 commitde22ad375d. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
@@ -1,231 +1,231 @@
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter
|
||||
icon = 'icons/atmos/filter.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/trinary/flippable
|
||||
pipe_state = "filter"
|
||||
density = FALSE
|
||||
level = 1
|
||||
|
||||
name = "Gas filter"
|
||||
desc = "Filters one type of gas from an input, and pushes it out the side."
|
||||
|
||||
use_power = USE_POWER_IDLE
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //This also doubles as a measure of how powerful the filter is, in Watts. 7500 W ~ 10 HP
|
||||
|
||||
var/temp = null // -- TLE
|
||||
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
|
||||
/*
|
||||
Filter types:
|
||||
-1: Nothing
|
||||
0: Phoron: Phoron, Oxygen Agent B
|
||||
1: Oxygen: Oxygen ONLY
|
||||
2: Nitrogen: Nitrogen ONLY
|
||||
3: Carbon Dioxide: Carbon Dioxide ONLY
|
||||
4: Nitrous Oxide (Formerly called Sleeping Agent) (N2O)
|
||||
*/
|
||||
var/filter_type = -1
|
||||
var/list/filtered_out = list()
|
||||
|
||||
|
||||
var/frequency = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_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)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/New()
|
||||
..()
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out = list("phoron")
|
||||
if(1) //removing O2
|
||||
filtered_out = list("oxygen")
|
||||
if(2) //removing N2
|
||||
filtered_out = list("nitrogen")
|
||||
if(3) //removing CO2
|
||||
filtered_out = list("carbon_dioxide")
|
||||
if(4)//removing N2O
|
||||
filtered_out = list("nitrous_oxide")
|
||||
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
air3.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/update_icon()
|
||||
if(mirrored)
|
||||
icon_state = "m"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += use_power ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
//Figure out the amount of moles to transfer
|
||||
var/transfer_moles = (set_flow_rate/air1.volume)*air1.total_moles
|
||||
|
||||
var/power_draw = -1
|
||||
if (transfer_moles > MINIMUM_MOLES_TO_FILTER)
|
||||
power_draw = filter_gas(src, filtered_out, air1, air2, air3, transfer_moles, power_rating)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/attack_hand(user) // -- TLE
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!src.allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
|
||||
tgui_interact(user)
|
||||
|
||||
// var/dat
|
||||
// var/current_filter_type
|
||||
// switch(filter_type)
|
||||
// if(0)
|
||||
// current_filter_type = "Phoron"
|
||||
// if(1)
|
||||
// current_filter_type = "Oxygen"
|
||||
// if(2)
|
||||
// current_filter_type = "Nitrogen"
|
||||
// if(3)
|
||||
// current_filter_type = "Carbon Dioxide"
|
||||
// if(4)
|
||||
// current_filter_type = "Nitrous Oxide"
|
||||
// if(-1)
|
||||
// current_filter_type = "Nothing"
|
||||
// else
|
||||
// current_filter_type = "ERROR - Report this bug to the admin, please!"
|
||||
|
||||
// dat += {"
|
||||
// <b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
|
||||
// <b>Filtering: </b>[current_filter_type]<br><HR>
|
||||
// <h4>Set Filter Type:</h4>
|
||||
// <A href='?src=\ref[src];filterset=0'>Phoron</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=4'>Nitrous Oxide</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=-1'>Nothing</A><BR>
|
||||
// <HR>
|
||||
// <B>Set Flow Rate Limit:</B>
|
||||
// [src.set_flow_rate]L/s | <a href='?src=\ref[src];set_flow_rate=1'>Change</a><BR>
|
||||
// <B>Flow rate: </B>[round(last_flow_rate, 0.1)]L/s
|
||||
// "}
|
||||
|
||||
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmos_filter")
|
||||
// onclose(user, "atmos_filter")
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AtmosFilter", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["on"] = use_power
|
||||
data["rate"] = set_flow_rate
|
||||
data["max_rate"] = air1.volume
|
||||
data["last_flow_rate"] = round(last_flow_rate, 0.1)
|
||||
|
||||
data["filter_types"] = list()
|
||||
data["filter_types"] += list(list("name" = "Nothing", "f_type" = -1, "selected" = filter_type == -1))
|
||||
data["filter_types"] += list(list("name" = "Phoron", "f_type" = 0, "selected" = filter_type == 0))
|
||||
data["filter_types"] += list(list("name" = "Oxygen", "f_type" = 1, "selected" = filter_type == 1))
|
||||
data["filter_types"] += list(list("name" = "Nitrogen", "f_type" = 2, "selected" = filter_type == 2))
|
||||
data["filter_types"] += list(list("name" = "Carbon Dioxide", "f_type" = 3, "selected" = filter_type == 3))
|
||||
data["filter_types"] += list(list("name" = "Nitrous Oxide", "f_type" = 4, "selected" = filter_type == 4))
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
if("rate")
|
||||
var/rate = params["rate"]
|
||||
if(rate == "max")
|
||||
rate = air1.volume
|
||||
. = TRUE
|
||||
else if(text2num(rate) != null)
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_flow_rate = clamp(rate, 0, air1.volume)
|
||||
if("filter")
|
||||
. = TRUE
|
||||
filter_type = text2num(params["filterset"])
|
||||
filtered_out.Cut() //no need to create new lists unnecessarily
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out += "phoron"
|
||||
filtered_out += "oxygen_agent_b"
|
||||
if(1) //removing O2
|
||||
filtered_out += "oxygen"
|
||||
if(2) //removing N2
|
||||
filtered_out += "nitrogen"
|
||||
if(3) //removing CO2
|
||||
filtered_out += "carbon_dioxide"
|
||||
if(4)//removing N2O
|
||||
filtered_out += "nitrous_oxide"
|
||||
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
|
||||
//
|
||||
// Mirrored Orientation - Flips the output dir to opposite side from normal.
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/m_filter
|
||||
icon_state = "mmap"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
mirrored = TRUE
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter
|
||||
icon = 'icons/atmos/filter.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/trinary/flippable
|
||||
pipe_state = "filter"
|
||||
density = FALSE
|
||||
level = 1
|
||||
|
||||
name = "Gas filter"
|
||||
desc = "Filters one type of gas from an input, and pushes it out the side."
|
||||
|
||||
use_power = USE_POWER_IDLE
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 7500 //This also doubles as a measure of how powerful the filter is, in Watts. 7500 W ~ 10 HP
|
||||
|
||||
var/temp = null // -- TLE
|
||||
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
|
||||
/*
|
||||
Filter types:
|
||||
-1: Nothing
|
||||
0: Phoron: Phoron, Oxygen Agent B
|
||||
1: Oxygen: Oxygen ONLY
|
||||
2: Nitrogen: Nitrogen ONLY
|
||||
3: Carbon Dioxide: Carbon Dioxide ONLY
|
||||
4: Nitrous Oxide (Formerly called Sleeping Agent) (N2O)
|
||||
*/
|
||||
var/filter_type = -1
|
||||
var/list/filtered_out = list()
|
||||
|
||||
|
||||
var/frequency = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_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)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/New()
|
||||
..()
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out = list("phoron")
|
||||
if(1) //removing O2
|
||||
filtered_out = list("oxygen")
|
||||
if(2) //removing N2
|
||||
filtered_out = list("nitrogen")
|
||||
if(3) //removing CO2
|
||||
filtered_out = list("carbon_dioxide")
|
||||
if(4)//removing N2O
|
||||
filtered_out = list("nitrous_oxide")
|
||||
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
air3.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/update_icon()
|
||||
if(mirrored)
|
||||
icon_state = "m"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += use_power ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
//Figure out the amount of moles to transfer
|
||||
var/transfer_moles = (set_flow_rate/air1.volume)*air1.total_moles
|
||||
|
||||
var/power_draw = -1
|
||||
if (transfer_moles > MINIMUM_MOLES_TO_FILTER)
|
||||
power_draw = filter_gas(src, filtered_out, air1, air2, air3, transfer_moles, power_rating)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/Initialize()
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/attack_hand(user) // -- TLE
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!src.allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
|
||||
tgui_interact(user)
|
||||
|
||||
// var/dat
|
||||
// var/current_filter_type
|
||||
// switch(filter_type)
|
||||
// if(0)
|
||||
// current_filter_type = "Phoron"
|
||||
// if(1)
|
||||
// current_filter_type = "Oxygen"
|
||||
// if(2)
|
||||
// current_filter_type = "Nitrogen"
|
||||
// if(3)
|
||||
// current_filter_type = "Carbon Dioxide"
|
||||
// if(4)
|
||||
// current_filter_type = "Nitrous Oxide"
|
||||
// if(-1)
|
||||
// current_filter_type = "Nothing"
|
||||
// else
|
||||
// current_filter_type = "ERROR - Report this bug to the admin, please!"
|
||||
|
||||
// dat += {"
|
||||
// <b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
|
||||
// <b>Filtering: </b>[current_filter_type]<br><HR>
|
||||
// <h4>Set Filter Type:</h4>
|
||||
// <A href='?src=\ref[src];filterset=0'>Phoron</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=4'>Nitrous Oxide</A><BR>
|
||||
// <A href='?src=\ref[src];filterset=-1'>Nothing</A><BR>
|
||||
// <HR>
|
||||
// <B>Set Flow Rate Limit:</B>
|
||||
// [src.set_flow_rate]L/s | <a href='?src=\ref[src];set_flow_rate=1'>Change</a><BR>
|
||||
// <B>Flow rate: </B>[round(last_flow_rate, 0.1)]L/s
|
||||
// "}
|
||||
|
||||
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmos_filter")
|
||||
// onclose(user, "atmos_filter")
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AtmosFilter", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["on"] = use_power
|
||||
data["rate"] = set_flow_rate
|
||||
data["max_rate"] = air1.volume
|
||||
data["last_flow_rate"] = round(last_flow_rate, 0.1)
|
||||
|
||||
data["filter_types"] = list()
|
||||
data["filter_types"] += list(list("name" = "Nothing", "f_type" = -1, "selected" = filter_type == -1))
|
||||
data["filter_types"] += list(list("name" = "Phoron", "f_type" = 0, "selected" = filter_type == 0))
|
||||
data["filter_types"] += list(list("name" = "Oxygen", "f_type" = 1, "selected" = filter_type == 1))
|
||||
data["filter_types"] += list(list("name" = "Nitrogen", "f_type" = 2, "selected" = filter_type == 2))
|
||||
data["filter_types"] += list(list("name" = "Carbon Dioxide", "f_type" = 3, "selected" = filter_type == 3))
|
||||
data["filter_types"] += list(list("name" = "Nitrous Oxide", "f_type" = 4, "selected" = filter_type == 4))
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
if("rate")
|
||||
var/rate = params["rate"]
|
||||
if(rate == "max")
|
||||
rate = air1.volume
|
||||
. = TRUE
|
||||
else if(text2num(rate) != null)
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_flow_rate = clamp(rate, 0, air1.volume)
|
||||
if("filter")
|
||||
. = TRUE
|
||||
filter_type = text2num(params["filterset"])
|
||||
filtered_out.Cut() //no need to create new lists unnecessarily
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out += "phoron"
|
||||
filtered_out += "oxygen_agent_b"
|
||||
if(1) //removing O2
|
||||
filtered_out += "oxygen"
|
||||
if(2) //removing N2
|
||||
filtered_out += "nitrogen"
|
||||
if(3) //removing CO2
|
||||
filtered_out += "carbon_dioxide"
|
||||
if(4)//removing N2O
|
||||
filtered_out += "nitrous_oxide"
|
||||
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
|
||||
//
|
||||
// Mirrored Orientation - Flips the output dir to opposite side from normal.
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/atmos_filter/m_filter
|
||||
icon_state = "mmap"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
mirrored = TRUE
|
||||
|
||||
@@ -1,181 +1,181 @@
|
||||
/obj/machinery/atmospherics/trinary/mixer
|
||||
icon = 'icons/atmos/mixer.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/trinary/flippable
|
||||
pipe_state = "mixer"
|
||||
density = FALSE
|
||||
level = 1
|
||||
|
||||
name = "Gas mixer"
|
||||
|
||||
use_power = USE_POWER_IDLE
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 3700 //This also doubles as a measure of how powerful the mixer is, in Watts. 3700 W ~ 5 HP
|
||||
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
var/list/mixing_inputs
|
||||
|
||||
//for mapping
|
||||
var/node1_concentration = 0.5
|
||||
var/node2_concentration = 0.5
|
||||
|
||||
//node 3 is the outlet, nodes 1 & 2 are intakes
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_icon(var/safety = 0)
|
||||
if(tee)
|
||||
icon_state = "t"
|
||||
else if(mirrored)
|
||||
icon_state = "m"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += use_power ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
air3.volume = ATMOS_DEFAULT_VOLUME_MIXER * 1.5
|
||||
|
||||
if (!mixing_inputs)
|
||||
mixing_inputs = list(src.air1 = node1_concentration, src.air2 = node2_concentration)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
//Figure out the amount of moles to transfer
|
||||
var/transfer_moles = (set_flow_rate*mixing_inputs[air1]/air1.volume)*air1.total_moles + (set_flow_rate*mixing_inputs[air1]/air2.volume)*air2.total_moles
|
||||
|
||||
var/power_draw = -1
|
||||
if (transfer_moles > MINIMUM_MOLES_TO_FILTER)
|
||||
power_draw = mix_gas(src, mixing_inputs, air3, transfer_moles, power_rating)
|
||||
|
||||
if(network1 && mixing_inputs[air1])
|
||||
network1.update = 1
|
||||
|
||||
if(network2 && mixing_inputs[air2])
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AtmosMixer", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["on"] = use_power
|
||||
data["set_pressure"] = round(set_flow_rate)
|
||||
data["max_pressure"] = min(air1.volume, air2.volume)
|
||||
data["node1_concentration"] = round(mixing_inputs[air1]*100, 1)
|
||||
data["node2_concentration"] = round(mixing_inputs[air2]*100, 1)
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
data["node1_dir"] = dir_name(node_connects[1],TRUE)
|
||||
data["node2_dir"] = dir_name(node_connects[2],TRUE)
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
tgui_interact(user)
|
||||
// src.add_fingerprint(usr)
|
||||
// if(!src.allowed(user))
|
||||
// to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
// return
|
||||
// usr.set_machine(src)
|
||||
// var/list/node_connects = get_node_connect_dirs()
|
||||
// var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
|
||||
// <b>Set Flow Rate Limit: </b>
|
||||
// [set_flow_rate]L/s | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
// <br>
|
||||
// <b>Flow Rate: </b>[round(last_flow_rate, 0.1)]L/s
|
||||
// <br><hr>
|
||||
// <b>Node 1 ([dir_name(node_connects[1],TRUE)]) Concentration:</b>
|
||||
// <a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
|
||||
// <a href='?src=\ref[src];node1_c=-0.01'>-</a>
|
||||
// [mixing_inputs[air1]]([mixing_inputs[air1]*100]%)
|
||||
// <a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
|
||||
// <a href='?src=\ref[src];node1_c=0.1'>+</a>
|
||||
// <br>
|
||||
// <b>Node 2 ([dir_name(node_connects[2],TRUE)]) Concentration:</b>
|
||||
// <a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
|
||||
// <a href='?src=\ref[src];node2_c=-0.01'>-</a>
|
||||
// [mixing_inputs[air2]]([mixing_inputs[air2]*100]%)
|
||||
// <a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
|
||||
// <a href='?src=\ref[src];node2_c=0.1'>+</a>
|
||||
// "}
|
||||
|
||||
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
|
||||
// onclose(user, "atmo_mixer")
|
||||
// return
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "max")
|
||||
pressure = min(air1.volume, air2.volume)
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_flow_rate = clamp(pressure, 0, min(air1.volume, air2.volume))
|
||||
if("node1")
|
||||
var/value = text2num(params["concentration"])
|
||||
mixing_inputs[air1] = max(0, min(1, value / 100))
|
||||
mixing_inputs[air2] = 1.0 - mixing_inputs[air1]
|
||||
. = TRUE
|
||||
if("node2")
|
||||
var/value = text2num(params["concentration"])
|
||||
mixing_inputs[air2] = max(0, min(1, value / 100))
|
||||
mixing_inputs[air1] = 1.0 - mixing_inputs[air2]
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
//
|
||||
// "T" Orientation - Inputs are on oposite sides instead of adjacent
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/mixer/t_mixer
|
||||
icon_state = "tmap"
|
||||
construction_type = /obj/item/pipe/trinary // Can't flip a "T", its symmetrical
|
||||
pipe_state = "t_mixer"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|EAST|WEST
|
||||
tee = TRUE
|
||||
|
||||
//
|
||||
// Mirrored Orientation - Flips the output dir to opposite side from normal.
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/mixer/m_mixer
|
||||
icon_state = "mmap"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
mirrored = TRUE
|
||||
/obj/machinery/atmospherics/trinary/mixer
|
||||
icon = 'icons/atmos/mixer.dmi'
|
||||
icon_state = "map"
|
||||
construction_type = /obj/item/pipe/trinary/flippable
|
||||
pipe_state = "mixer"
|
||||
density = FALSE
|
||||
level = 1
|
||||
|
||||
name = "Gas mixer"
|
||||
|
||||
use_power = USE_POWER_IDLE
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 3700 //This also doubles as a measure of how powerful the mixer is, in Watts. 3700 W ~ 5 HP
|
||||
|
||||
var/set_flow_rate = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
var/list/mixing_inputs
|
||||
|
||||
//for mapping
|
||||
var/node1_concentration = 0.5
|
||||
var/node2_concentration = 0.5
|
||||
|
||||
//node 3 is the outlet, nodes 1 & 2 are intakes
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_icon(var/safety = 0)
|
||||
if(tee)
|
||||
icon_state = "t"
|
||||
else if(mirrored)
|
||||
icon_state = "m"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += use_power ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
update_use_power(USE_POWER_OFF)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/New()
|
||||
..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_MIXER
|
||||
air3.volume = ATMOS_DEFAULT_VOLUME_MIXER * 1.5
|
||||
|
||||
if (!mixing_inputs)
|
||||
mixing_inputs = list(src.air1 = node1_concentration, src.air2 = node2_concentration)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/process()
|
||||
..()
|
||||
|
||||
last_power_draw = 0
|
||||
last_flow_rate = 0
|
||||
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
//Figure out the amount of moles to transfer
|
||||
var/transfer_moles = (set_flow_rate*mixing_inputs[air1]/air1.volume)*air1.total_moles + (set_flow_rate*mixing_inputs[air1]/air2.volume)*air2.total_moles
|
||||
|
||||
var/power_draw = -1
|
||||
if (transfer_moles > MINIMUM_MOLES_TO_FILTER)
|
||||
power_draw = mix_gas(src, mixing_inputs, air3, transfer_moles, power_rating)
|
||||
|
||||
if(network1 && mixing_inputs[air1])
|
||||
network1.update = 1
|
||||
|
||||
if(network2 && mixing_inputs[air2])
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AtmosMixer", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["on"] = use_power
|
||||
data["set_pressure"] = round(set_flow_rate)
|
||||
data["max_pressure"] = min(air1.volume, air2.volume)
|
||||
data["node1_concentration"] = round(mixing_inputs[air1]*100, 1)
|
||||
data["node2_concentration"] = round(mixing_inputs[air2]*100, 1)
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
data["node1_dir"] = dir_name(node_connects[1],TRUE)
|
||||
data["node2_dir"] = dir_name(node_connects[2],TRUE)
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
tgui_interact(user)
|
||||
// src.add_fingerprint(usr)
|
||||
// if(!src.allowed(user))
|
||||
// to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
// return
|
||||
// usr.set_machine(src)
|
||||
// var/list/node_connects = get_node_connect_dirs()
|
||||
// var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
|
||||
// <b>Set Flow Rate Limit: </b>
|
||||
// [set_flow_rate]L/s | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
// <br>
|
||||
// <b>Flow Rate: </b>[round(last_flow_rate, 0.1)]L/s
|
||||
// <br><hr>
|
||||
// <b>Node 1 ([dir_name(node_connects[1],TRUE)]) Concentration:</b>
|
||||
// <a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
|
||||
// <a href='?src=\ref[src];node1_c=-0.01'>-</a>
|
||||
// [mixing_inputs[air1]]([mixing_inputs[air1]*100]%)
|
||||
// <a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
|
||||
// <a href='?src=\ref[src];node1_c=0.1'>+</a>
|
||||
// <br>
|
||||
// <b>Node 2 ([dir_name(node_connects[2],TRUE)]) Concentration:</b>
|
||||
// <a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
|
||||
// <a href='?src=\ref[src];node2_c=-0.01'>-</a>
|
||||
// [mixing_inputs[air2]]([mixing_inputs[air2]*100]%)
|
||||
// <a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
|
||||
// <a href='?src=\ref[src];node2_c=0.1'>+</a>
|
||||
// "}
|
||||
|
||||
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
|
||||
// onclose(user, "atmo_mixer")
|
||||
// return
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "max")
|
||||
pressure = min(air1.volume, air2.volume)
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_flow_rate = clamp(pressure, 0, min(air1.volume, air2.volume))
|
||||
if("node1")
|
||||
var/value = text2num(params["concentration"])
|
||||
mixing_inputs[air1] = max(0, min(1, value / 100))
|
||||
mixing_inputs[air2] = 1.0 - mixing_inputs[air1]
|
||||
. = TRUE
|
||||
if("node2")
|
||||
var/value = text2num(params["concentration"])
|
||||
mixing_inputs[air2] = max(0, min(1, value / 100))
|
||||
mixing_inputs[air1] = 1.0 - mixing_inputs[air2]
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
//
|
||||
// "T" Orientation - Inputs are on oposite sides instead of adjacent
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/mixer/t_mixer
|
||||
icon_state = "tmap"
|
||||
construction_type = /obj/item/pipe/trinary // Can't flip a "T", its symmetrical
|
||||
pipe_state = "t_mixer"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|EAST|WEST
|
||||
tee = TRUE
|
||||
|
||||
//
|
||||
// Mirrored Orientation - Flips the output dir to opposite side from normal.
|
||||
//
|
||||
/obj/machinery/atmospherics/trinary/mixer/m_mixer
|
||||
icon_state = "mmap"
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
mirrored = TRUE
|
||||
|
||||
@@ -1,248 +1,248 @@
|
||||
/obj/machinery/atmospherics/trinary
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
use_power = USE_POWER_OFF
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
|
||||
var/mirrored = FALSE
|
||||
var/tee = FALSE
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
var/datum/gas_mixture/air3
|
||||
|
||||
var/obj/machinery/atmospherics/node3
|
||||
|
||||
var/datum/pipe_network/network1
|
||||
var/datum/pipe_network/network2
|
||||
var/datum/pipe_network/network3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
air3 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
air3.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/trinary/init_dir()
|
||||
initialize_directions = get_initialize_directions_trinary(dir, mirrored, tee)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
add_underlay(T, node1, node_connects[1])
|
||||
add_underlay(T, node2, node_connects[2])
|
||||
add_underlay(T, node3, node_connects[3])
|
||||
|
||||
/obj/machinery/atmospherics/trinary/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/power_change()
|
||||
var/old_stat = stat
|
||||
. = ..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
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 a ratchet.")
|
||||
deconstruct()
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
/obj/machinery/atmospherics/trinary/get_neighbor_nodes_for_init()
|
||||
return list(node1, node2, node3)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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
|
||||
|
||||
else if (reference == node3)
|
||||
network3 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/Destroy()
|
||||
. = ..()
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
if(node3)
|
||||
node3.disconnect(src)
|
||||
qdel(network3)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
node3 = null
|
||||
|
||||
// Get the direction each node is facing to connect.
|
||||
// It now returns as a list so it can be fetched nicely, each entry corresponds to node of same number.
|
||||
/obj/machinery/atmospherics/trinary/get_node_connect_dirs()
|
||||
return get_node_connect_dirs_trinary(dir, mirrored, tee)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_init()
|
||||
if(node1 && node2 && node3)
|
||||
return
|
||||
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
|
||||
STANDARD_ATMOS_CHOOSE_NODE(1, node_connects[1])
|
||||
STANDARD_ATMOS_CHOOSE_NODE(2, node_connects[2])
|
||||
STANDARD_ATMOS_CHOOSE_NODE(3, node_connects[3])
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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)
|
||||
|
||||
if(!network3 && node3)
|
||||
network3 = new /datum/pipe_network()
|
||||
network3.normal_members += src
|
||||
network3.build_network(node3, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/trinary/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network1
|
||||
|
||||
if(reference==node2)
|
||||
return network2
|
||||
|
||||
if(reference==node3)
|
||||
return network3
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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
|
||||
if(network3 == old_network)
|
||||
network3 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(network1 == reference)
|
||||
results += air1
|
||||
if(network2 == reference)
|
||||
results += air2
|
||||
if(network3 == reference)
|
||||
results += air3
|
||||
|
||||
return results
|
||||
|
||||
/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
qdel(network1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
qdel(network2)
|
||||
node2 = null
|
||||
|
||||
else if(reference==node3)
|
||||
qdel(network3)
|
||||
node3 = null
|
||||
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
|
||||
// Trinary init_dir() logic in a separate proc so it can be referenced from "trinary-ish" places like T-Valves
|
||||
// TODO - Someday refactor those places under atmospherics/trinary
|
||||
/proc/get_initialize_directions_trinary(var/dir, var/mirrored = FALSE, var/tee = FALSE)
|
||||
if(tee)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return EAST|NORTH|WEST
|
||||
if(SOUTH)
|
||||
return SOUTH|WEST|EAST
|
||||
if(EAST)
|
||||
return EAST|NORTH|SOUTH
|
||||
if(WEST)
|
||||
return WEST|NORTH|SOUTH
|
||||
else if(mirrored)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return WEST|NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
return SOUTH|EAST|NORTH
|
||||
if(EAST)
|
||||
return EAST|WEST|NORTH
|
||||
if(WEST)
|
||||
return WEST|SOUTH|EAST
|
||||
else
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return EAST|NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
return SOUTH|WEST|NORTH
|
||||
if(EAST)
|
||||
return EAST|WEST|SOUTH
|
||||
if(WEST)
|
||||
return WEST|NORTH|EAST
|
||||
|
||||
// Trinary get_node_connect_dirs() logic in a separate proc so it can be referenced from "trinary-ish" places like T-Valves
|
||||
/proc/get_node_connect_dirs_trinary(var/dir, var/mirrored = FALSE, var/tee = FALSE)
|
||||
var/node1_connect
|
||||
var/node2_connect
|
||||
var/node3_connect
|
||||
|
||||
if(tee)
|
||||
node1_connect = turn(dir, -90)
|
||||
node2_connect = turn(dir, 90)
|
||||
node3_connect = dir
|
||||
else if(mirrored)
|
||||
node1_connect = turn(dir, 180)
|
||||
node2_connect = turn(dir, 90)
|
||||
node3_connect = dir
|
||||
else
|
||||
node1_connect = turn(dir, 180)
|
||||
node2_connect = turn(dir, -90)
|
||||
node3_connect = dir
|
||||
return list(node1_connect, node2_connect, node3_connect)
|
||||
/obj/machinery/atmospherics/trinary
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
use_power = USE_POWER_OFF
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
|
||||
var/mirrored = FALSE
|
||||
var/tee = FALSE
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
var/datum/gas_mixture/air3
|
||||
|
||||
var/obj/machinery/atmospherics/node3
|
||||
|
||||
var/datum/pipe_network/network1
|
||||
var/datum/pipe_network/network2
|
||||
var/datum/pipe_network/network3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
air3 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
air3.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/trinary/init_dir()
|
||||
initialize_directions = get_initialize_directions_trinary(dir, mirrored, tee)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
add_underlay(T, node1, node_connects[1])
|
||||
add_underlay(T, node2, node_connects[2])
|
||||
add_underlay(T, node3, node_connects[3])
|
||||
|
||||
/obj/machinery/atmospherics/trinary/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/power_change()
|
||||
var/old_stat = stat
|
||||
. = ..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!W.has_tool_quality(TOOL_WRENCH))
|
||||
return ..()
|
||||
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 a ratchet.")
|
||||
deconstruct()
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
/obj/machinery/atmospherics/trinary/get_neighbor_nodes_for_init()
|
||||
return list(node1, node2, node3)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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
|
||||
|
||||
else if (reference == node3)
|
||||
network3 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/Destroy()
|
||||
. = ..()
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
qdel(network1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
qdel(network2)
|
||||
if(node3)
|
||||
node3.disconnect(src)
|
||||
qdel(network3)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
node3 = null
|
||||
|
||||
// Get the direction each node is facing to connect.
|
||||
// It now returns as a list so it can be fetched nicely, each entry corresponds to node of same number.
|
||||
/obj/machinery/atmospherics/trinary/get_node_connect_dirs()
|
||||
return get_node_connect_dirs_trinary(dir, mirrored, tee)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmos_init()
|
||||
if(node1 && node2 && node3)
|
||||
return
|
||||
|
||||
var/list/node_connects = get_node_connect_dirs()
|
||||
|
||||
STANDARD_ATMOS_CHOOSE_NODE(1, node_connects[1])
|
||||
STANDARD_ATMOS_CHOOSE_NODE(2, node_connects[2])
|
||||
STANDARD_ATMOS_CHOOSE_NODE(3, node_connects[3])
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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)
|
||||
|
||||
if(!network3 && node3)
|
||||
network3 = new /datum/pipe_network()
|
||||
network3.normal_members += src
|
||||
network3.build_network(node3, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/trinary/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network1
|
||||
|
||||
if(reference==node2)
|
||||
return network2
|
||||
|
||||
if(reference==node3)
|
||||
return network3
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/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
|
||||
if(network3 == old_network)
|
||||
network3 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(network1 == reference)
|
||||
results += air1
|
||||
if(network2 == reference)
|
||||
results += air2
|
||||
if(network3 == reference)
|
||||
results += air3
|
||||
|
||||
return results
|
||||
|
||||
/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
qdel(network1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
qdel(network2)
|
||||
node2 = null
|
||||
|
||||
else if(reference==node3)
|
||||
qdel(network3)
|
||||
node3 = null
|
||||
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
|
||||
// Trinary init_dir() logic in a separate proc so it can be referenced from "trinary-ish" places like T-Valves
|
||||
// TODO - Someday refactor those places under atmospherics/trinary
|
||||
/proc/get_initialize_directions_trinary(var/dir, var/mirrored = FALSE, var/tee = FALSE)
|
||||
if(tee)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return EAST|NORTH|WEST
|
||||
if(SOUTH)
|
||||
return SOUTH|WEST|EAST
|
||||
if(EAST)
|
||||
return EAST|NORTH|SOUTH
|
||||
if(WEST)
|
||||
return WEST|NORTH|SOUTH
|
||||
else if(mirrored)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return WEST|NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
return SOUTH|EAST|NORTH
|
||||
if(EAST)
|
||||
return EAST|WEST|NORTH
|
||||
if(WEST)
|
||||
return WEST|SOUTH|EAST
|
||||
else
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return EAST|NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
return SOUTH|WEST|NORTH
|
||||
if(EAST)
|
||||
return EAST|WEST|SOUTH
|
||||
if(WEST)
|
||||
return WEST|NORTH|EAST
|
||||
|
||||
// Trinary get_node_connect_dirs() logic in a separate proc so it can be referenced from "trinary-ish" places like T-Valves
|
||||
/proc/get_node_connect_dirs_trinary(var/dir, var/mirrored = FALSE, var/tee = FALSE)
|
||||
var/node1_connect
|
||||
var/node2_connect
|
||||
var/node3_connect
|
||||
|
||||
if(tee)
|
||||
node1_connect = turn(dir, -90)
|
||||
node2_connect = turn(dir, 90)
|
||||
node3_connect = dir
|
||||
else if(mirrored)
|
||||
node1_connect = turn(dir, 180)
|
||||
node2_connect = turn(dir, 90)
|
||||
node3_connect = dir
|
||||
else
|
||||
node1_connect = turn(dir, 180)
|
||||
node2_connect = turn(dir, -90)
|
||||
node3_connect = dir
|
||||
return list(node1_connect, node2_connect, node3_connect)
|
||||
|
||||
Reference in New Issue
Block a user