mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Air alarm template still needs a tweak, but it's functional now.
This commit is contained in:
@@ -35,7 +35,7 @@ Pipelines + Other Objects -> Pipe network
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/proc/safe_input(var/title, var/text, var/default_set)
|
||||
var/new_value = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",default_set) as num
|
||||
var/new_value = input(usr,text,title,default_set) as num
|
||||
if(usr.canUseTopic(src))
|
||||
return new_value
|
||||
return default_set
|
||||
|
||||
@@ -89,14 +89,24 @@ Passive gate is similar to the regular pump except:
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
/obj/machinery/atmospherics/binary/passive_gate/ui_interact(mob/user, ui_key = "main")
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
var/data = list()
|
||||
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
ui.push_data(data)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/initialize()
|
||||
..()
|
||||
@@ -145,7 +155,7 @@ Passive gate is similar to the regular pump except:
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
|
||||
@@ -154,7 +164,11 @@ Passive gate is similar to the regular pump except:
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if(href_list["set_press"])
|
||||
target_pressure = max(0, min(4500, safe_input("Pressure control", "Enter new output pressure (0-4500kPa)", target_pressure)))
|
||||
switch(href_list["set_press"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("set")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
|
||||
@@ -97,14 +97,24 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main")
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
var/data = list()
|
||||
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
ui.push_data(data)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/initialize()
|
||||
..()
|
||||
@@ -152,7 +162,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
|
||||
@@ -161,7 +171,11 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if(href_list["set_press"])
|
||||
target_pressure = max(0, min(4500, safe_input("Pressure control", "Enter new output pressure (0-4500kPa)", target_pressure)))
|
||||
switch(href_list["set_press"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("set")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
|
||||
@@ -20,7 +20,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
var/transfer_rate = 200
|
||||
var/transfer_rate = MAX_TRANSFER_RATE
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
@@ -93,16 +93,24 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output flow: </b>
|
||||
[round(transfer_rate,1)]l/s | <a href='?src=\ref[src];set_transfer_rate=1'>Change</a>
|
||||
"}
|
||||
/obj/machinery/atmospherics/binary/volume_pump/ui_interact(mob/user, ui_key = "main")
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
var/data = list()
|
||||
|
||||
data["on"] = on
|
||||
data["transfer_rate"] = round(transfer_rate*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_rate"] = MAX_TRANSFER_RATE
|
||||
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
ui.push_data(data)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/initialize()
|
||||
..()
|
||||
@@ -149,7 +157,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list)
|
||||
@@ -158,7 +166,11 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if(href_list["set_transfer_rate"])
|
||||
transfer_rate = max(0, min(200, safe_input("Pressure control", "Enter new output pressure (0-4500kPa)", transfer_rate)))
|
||||
switch(href_list["set_transfer_rate"])
|
||||
if ("max")
|
||||
transfer_rate = MAX_TRANSFER_RATE
|
||||
if ("set")
|
||||
transfer_rate = max(0, min(MAX_TRANSFER_RATE, safe_input("Pressure control", "Enter new transfer rate (0-[MAX_TRANSFER_RATE] L/s)", transfer_rate)))
|
||||
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#define FILTER_NOTHING -1
|
||||
#define FILTER_PLASMA 0
|
||||
#define FILTER_OXYGEN 1
|
||||
#define FILTER_NITROGEN 2
|
||||
#define FILTER_CARBONDIOXIDE 3
|
||||
#define FILTER_NITROUSOXIDE 4
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter
|
||||
icon_state = "filter_off"
|
||||
density = 1
|
||||
density = 0
|
||||
|
||||
name = "gas filter"
|
||||
|
||||
@@ -92,7 +99,7 @@ Filter types:
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
switch(filter_type)
|
||||
if(0) //removing plasma
|
||||
if(FILTER_PLASMA)
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
|
||||
@@ -102,19 +109,19 @@ Filter types:
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
if(1) //removing O2
|
||||
if(FILTER_OXYGEN)
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
|
||||
if(2) //removing N2
|
||||
if(FILTER_NITROGEN)
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
|
||||
if(3) //removing CO2
|
||||
if(FILTER_CARBONDIOXIDE)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(4)//removing N2O
|
||||
if(FILTER_NITROUSOXIDE)
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
@@ -148,50 +155,27 @@ Filter types:
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
return
|
||||
|
||||
var/dat
|
||||
var/current_filter_type
|
||||
switch(filter_type)
|
||||
if(0)
|
||||
current_filter_type = "Plasma"
|
||||
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!"
|
||||
ui_interact(user)
|
||||
|
||||
dat += {"
|
||||
<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Filtering: </b>[current_filter_type]<br><HR>
|
||||
<h4>Set Filter Type:</h4>
|
||||
<A href='?src=\ref[src];filterset=0'>Plasma</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>Desirable output pressure:</B>
|
||||
[src.target_pressure]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
/*
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD>[dat]","window=atmo_filter")
|
||||
onclose(user, "atmo_filter")
|
||||
/obj/machinery/atmospherics/trinary/filter/ui_interact(mob/user, ui_key = "main")
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
if (src.temp)
|
||||
dat = text("<TT>[]</TT><BR><BR><A href='?src=\ref[];temp=1'>Clear Screen</A>", src.temp, src)
|
||||
//else
|
||||
// src.on != src.on
|
||||
*/
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_filter")
|
||||
onclose(user, "atmo_filter")
|
||||
return
|
||||
var/data = list()
|
||||
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
data["filter_type"] = filter_type
|
||||
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new /datum/nanoui(user, src, ui_key, "atmos_filter.tmpl", name, 400, 320)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
ui.push_data(data)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list)
|
||||
if(..())
|
||||
@@ -200,12 +184,31 @@ Filter types:
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["filterset"])
|
||||
src.filter_type = text2num(href_list["filterset"])
|
||||
var/filtering_name = "nothing"
|
||||
switch(filter_type)
|
||||
if(FILTER_PLASMA)
|
||||
filtering_name = "plasma"
|
||||
if(FILTER_OXYGEN)
|
||||
filtering_name = "oxygen"
|
||||
if(FILTER_NITROGEN)
|
||||
filtering_name = "nitrogen"
|
||||
if(FILTER_CARBONDIOXIDE)
|
||||
filtering_name = "carbon dioxide"
|
||||
if(FILTER_NITROUSOXIDE)
|
||||
filtering_name = "nitrous oxide"
|
||||
investigate_log("was set to filter [filtering_name] by [key_name(usr)]", "atmos")
|
||||
if (href_list["temp"])
|
||||
src.temp = null
|
||||
if(href_list["set_press"])
|
||||
target_pressure = max(0, min(4500, safe_input("Pressure control", "Enter new output pressure (0-4500kPa)", target_pressure)))
|
||||
switch(href_list["set_press"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("set")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if(href_list["power"])
|
||||
on=!on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
/*
|
||||
@@ -213,6 +216,4 @@ Filter types:
|
||||
if ((M.client && M.machine == src))
|
||||
src.attack_hand(M)
|
||||
*/
|
||||
return
|
||||
|
||||
|
||||
return
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/atmospherics/trinary/mixer
|
||||
icon_state = "mixer_off"
|
||||
density = 1
|
||||
density = 0
|
||||
|
||||
name = "gas mixer"
|
||||
|
||||
@@ -101,48 +101,56 @@
|
||||
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
if(!src.allowed(user))
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
return
|
||||
usr.set_machine(src)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[target_pressure]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
<br>
|
||||
<b>Node 1 Concentration:</b>
|
||||
<a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node1_c=-0.01'>-</a>
|
||||
[node1_concentration]([node1_concentration*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 Concentration:</b>
|
||||
<a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node2_c=-0.01'>-</a>
|
||||
[node2_concentration]([node2_concentration*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
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/ui_interact(mob/user, ui_key = "main")
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
var/data = list()
|
||||
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
data["node1_concentration"] = round(node1_concentration*100)
|
||||
data["node2_concentration"] = round(node2_concentration*100)
|
||||
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new /datum/nanoui(user, src, ui_key, "atmos_mixer.tmpl", name, 400, 320)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
ui.push_data(data)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if(href_list["set_press"])
|
||||
target_pressure = max(0, min(4500, safe_input("Pressure control", "Enter new output pressure (0-4500kPa)", target_pressure)))
|
||||
switch(href_list["set_press"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("set")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if(href_list["node1_c"])
|
||||
var/value = text2num(href_list["node1_c"])
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration + value))
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration - value))
|
||||
investigate_log("was set to [node1_concentration] % on node 1 by [key_name(usr)]", "atmos")
|
||||
if(href_list["node2_c"])
|
||||
var/value = text2num(href_list["node2_c"])
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration + value))
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration - value))
|
||||
investigate_log("was set to [node2_concentration] % on node 2 by [key_name(usr)]", "atmos")
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user