Air alarm template still needs a tweak, but it's functional now.

This commit is contained in:
Fayrik
2015-04-25 05:22:00 +01:00
parent 8e8561eb3e
commit 80ff5d45d0
18 changed files with 878 additions and 436 deletions
+1 -1
View File
@@ -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
+5 -1
View File
@@ -106,5 +106,9 @@
#define PRESSURE_DAMAGE_COEFFICIENT 4 //The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
#define MAX_HIGH_PRESSURE_DAMAGE 4 //This used to be 20... I got this much random rage for some retarded decision by polymorph?! Polymorph now lies in a pool of blood with a katana jammed in his spleen. ~Errorage --PS: The katana did less than 20 damage to him :(
#define LOW_PRESSURE_DAMAGE 2 //The amounb of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
#define COLD_SLOWDOWN_FACTOR 20 //Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
#define COLD_SLOWDOWN_FACTOR 20 //Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
// Atmos pipe limits
#define MAX_OUTPUT_PRESSURE 4500 // (kPa) What pressure pumps and powered equipment max out at.
#define MAX_TRANSFER_RATE 200 // (L/s) Maximum speed powered equipment can work at.
+149 -290
View File
@@ -167,8 +167,7 @@
return 0
/obj/machinery/alarm/attack_hand(mob/user)
. = ..()
if (.)
if (..())
return
user.set_machine(src)
@@ -188,17 +187,41 @@
if(!shorted)
//user << browse(return_text(),"window=air_alarm")
//onclose(user, "air_alarm")
var/datum/browser/popup = new(user, "air_alarm", "[alarm_area.name] Air Alarm", 500, 400)
/*var/datum/browser/popup = new(user, "air_alarm", "[alarm_area.name] Air Alarm", 500, 400)
popup.set_content(return_text())
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
refresh_all()
refresh_all()*/
ui_interact(user)
if(panel_open && (!istype(user, /mob/living/silicon/ai)))
wires.Interact(user)
return
/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main")
if(stat & (BROKEN|NOPOWER))
return
var/data = list()
data["locked"] = locked
data["siliconUser"] = user.has_unlimited_silicon_privilege
data["screen"] = screen
data["dangerous"] = emagged
populate_status(data)
if (!locked || user.has_unlimited_silicon_privilege)
populate_controls(data)
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
if (!ui)
ui = new /datum/nanoui(user, src, ui_key, "air_alarm.tmpl", "Air Alarm", 350, 500)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
else
ui.push_data(data)
/obj/machinery/alarm/proc/shock(mob/user, prb)
if((stat & (NOPOWER))) // unpowered, no shock
@@ -247,326 +270,156 @@
return 1
/obj/machinery/alarm/proc/return_text()
var/dat = ""
dat += "<div class='notice icon'>Swipe ID card to [locked ? "unlock" : "lock"] interface.</div>"
if(!usr.has_unlimited_silicon_privilege && locked)
dat += "[return_status()]"
else
dat += "[return_safety()][return_status()]<hr>[return_controls()]"
return dat
/obj/machinery/alarm/proc/return_status()
var/turf/location = src.loc
/obj/machinery/alarm/proc/populate_status(var/list/data)
var/turf/location = get_turf(src)
var/datum/gas_mixture/environment = location.return_air()
var/total = environment.oxygen + environment.carbon_dioxide + environment.toxins + environment.nitrogen
var/output = "<h3>Air Status:</h3>"
if(total == 0)
output +={"<font color='red'><b>Warning: Cannot obtain air sample for analysis.</b></font>"}
return output
var/list/environment_data = list()
data["atmos_alarm"] = alarm_area.atmosalm
data["fire_alarm"] = (alarm_area.fire != null && alarm_area.fire)
data["danger_level"] = danger_level
if(total)
var/datum/tlv/cur_tlv
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
output += {"
<style>
.dl0 { color: green; }
.dl1 { color: orange; }
.dl2 { color: red; font-weght: bold;}
</style>
"}
var/datum/tlv/cur_tlv
var/GET_PP = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
cur_tlv = TLV["pressure"]
var/pressure = environment.return_pressure()
var/pressure_danger = cur_tlv.get_danger_level(pressure)
environment_data += list(list("name" = "Pressure", "value" = pressure, "unit" = "kPa", "danger_level" = pressure_danger))
cur_tlv = TLV["pressure"]
var/environment_pressure = environment.return_pressure()
var/pressure_dangerlevel = cur_tlv.get_danger_level(environment_pressure)
cur_tlv = TLV["oxygen"]
var/oxygen_danger = cur_tlv.get_danger_level(environment.oxygen*partial_pressure)
environment_data += list(list("name" = "Oxygen", "value" = environment.oxygen / total * 100, "unit" = "%", "danger_level" = oxygen_danger))
cur_tlv = TLV["oxygen"]
var/oxygen_dangerlevel = cur_tlv.get_danger_level(environment.oxygen*GET_PP)
var/oxygen_percent = round(environment.oxygen / total * 100, 2)
cur_tlv = TLV["carbon dioxide"]
var/carbon_dioxide_danger = cur_tlv.get_danger_level(environment.carbon_dioxide*partial_pressure)
environment_data += list(list("name" = "Carbon dioxide", "value" = environment.carbon_dioxide / total * 100, "unit" = "%", "danger_level" = carbon_dioxide_danger))
cur_tlv = TLV["carbon dioxide"]
var/co2_dangerlevel = cur_tlv.get_danger_level(environment.carbon_dioxide*GET_PP)
var/co2_percent = round(environment.carbon_dioxide / total * 100, 2)
cur_tlv = TLV["plasma"]
var/plasma_danger = cur_tlv.get_danger_level(environment.toxins*partial_pressure)
environment_data += list(list("name" = "Toxins", "value" = environment.toxins / total * 100, "unit" = "%", "danger_level" = plasma_danger))
cur_tlv = TLV["plasma"]
var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.toxins*GET_PP)
var/plasma_percent = round(environment.toxins / total * 100, 2)
cur_tlv = TLV["other"]
var/other_moles = 0.0
for(var/datum/gas/G in environment.trace_gases)
other_moles+=G.moles
var/other_danger = cur_tlv.get_danger_level(other_moles*partial_pressure)
environment_data += list(list("name" = "Other", "value" = other_moles / total * 100, "unit" = "%", "danger_level" = other_danger))
cur_tlv = TLV["other"]
var/other_moles = 0.0
for(var/datum/gas/G in environment.trace_gases)
other_moles+=G.moles
var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP)
cur_tlv = TLV["temperature"]
var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature)
output += {"
Pressure: <span class='dl[pressure_dangerlevel]'>[environment_pressure]</span>kPa<br />
Oxygen: <span class='dl[oxygen_dangerlevel]'>[oxygen_percent]</span>%<br />
Carbon dioxide: <span class='dl[co2_dangerlevel]'>[co2_percent]</span>%<br />
Toxins: <span class='dl[plasma_dangerlevel]'>[plasma_percent]</span>%<br />
"}
if (other_dangerlevel==2)
output += {"Notice: <span class='dl2'>High Concentration of Unknown Particles Detected</span><br />"}
else if (other_dangerlevel==1)
output += {"Notice: <span class='dl1'>Low Concentration of Unknown Particles Detected</span><br />"}
output += {"
Temperature: <span class='dl[temperature_dangerlevel]'>[environment.temperature]</span>K<br />
"}
var/display_danger_level = max(
pressure_dangerlevel,
oxygen_dangerlevel,
co2_dangerlevel,
plasma_dangerlevel,
other_dangerlevel,
temperature_dangerlevel
)
//Overall status
output += {"Local Status: "}
if(display_danger_level == 2)
output += {"<span class='dl2'>DANGER: Internals Required</span>"}
else if(display_danger_level == 1)
output += {"<span class='dl1'>Caution</span>"}
else if (alarm_area.atmosalm)
output += {"<span class='dl1'>Caution: Atmos alert in area</span>"}
else
output += {"<span class='dl0'>Optimal</span>"}
return output
/obj/machinery/alarm/proc/return_safety()
var/output = ""
if(src.emagged)
output += "<font color='red'>NOTICE: Safety measures nonfunctional. Device may exhibit abnormal behavior.</font><br><br>"
else
output += "Safety measures functioning properly.<br><br>"
return output
/obj/machinery/alarm/proc/return_controls()
var/output = ""//"<B>[alarm_zone] Air [name]</B><HR>"
cur_tlv = TLV["temperature"]
var/temperature_danger = cur_tlv.get_danger_level(environment.temperature)
environment_data += list(list("name" = "Temperature", "value" = environment.temperature, "unit" = "K ([round(environment.temperature - T0C, 0.1)]C)", "danger_level" = temperature_danger))
data["environment_data"] = environment_data
/obj/machinery/alarm/proc/populate_controls(var/list/data)
switch(screen)
if (AALARM_SCREEN_MAIN)
if(alarm_area.atmosalm)
output += {"<a href='?src=\ref[src];atmos_reset=1'>Reset - Atmospheric Alarm</a><hr>"}
else
output += {"<a href='?src=\ref[src];atmos_alarm=1'>Activate - Atmospheric Alarm</a><hr>"}
if(AALARM_SCREEN_MAIN)
data["mode"] = mode
if(AALARM_SCREEN_VENT)
data["vents"] = list()
for(var/id_tag in alarm_area.air_vent_names)
var/long_name = alarm_area.air_vent_names[id_tag]
var/list/info = alarm_area.air_vent_info[id_tag]
if(!info)
continue
data["vents"] += list(list(
"id_tag" = id_tag,
"long_name" = sanitize(long_name),
"power" = info["power"],
"excheck" = info["checks"]&1,
"incheck" = info["checks"]&2,
"direction" = info["direction"],
"external" = info["external"]
))
if(AALARM_SCREEN_SCRUB)
data["scrubbers"] = list()
for(var/id_tag in alarm_area.air_scrub_names)
var/long_name = alarm_area.air_scrub_names[id_tag]
var/list/info = alarm_area.air_scrub_info[id_tag]
if(!info)
continue
data["scrubbers"] += list(list(
"id_tag" = id_tag,
"long_name" = sanitize(long_name),
"power" = info["power"],
"scrubbing" = info["scrubbing"],
"panic" = info["panic"],
"filter_co2" = info["filter_co2"],
"filter_toxins" = info["filter_toxins"],
"filter_n2o" = info["filter_n2o"]
))
if(AALARM_SCREEN_MODE)
data["mode"] = mode
data["modes"] = list()
data["modes"] += list(list("name" = "Filtering - Scrubs out contaminants", "mode" = AALARM_MODE_SCRUBBING, "selected" = mode == AALARM_MODE_SCRUBBING, "danger" = 0))
data["modes"] += list(list("name" = "Draught - Siphons out air while replacing", "mode" = AALARM_MODE_VENTING, "selected" = mode == AALARM_MODE_VENTING, "danger" = 0))
data["modes"] += list(list("name" = "Cycle - Siphons air before replacing", "mode" = AALARM_MODE_REPLACEMENT, "selected" = mode == AALARM_MODE_REPLACEMENT, "danger" = 1))
data["modes"] += list(list("name" = "Panic - Siphons air out of the room", "mode" = AALARM_MODE_PANIC, "selected" = mode == AALARM_MODE_PANIC, "danger" = 1))
data["modes"] += list(list("name" = "Off - Shuts off vents and scrubbers", "mode" = AALARM_MODE_OFF, "selected" = mode == AALARM_MODE_OFF, "danger" = 0))
if (src.emagged)
data["modes"] += list(list("name" = "Flood - Shuts off scrubbers and opens vents", "mode" = AALARM_MODE_FLOOD, "selected" = mode == AALARM_MODE_FLOOD, "danger" = 1))
if(AALARM_SCREEN_SENSORS)
var/list/selected = list()
var/list/thresholds = list()
output += {"
<a href='?src=\ref[src];screen=[AALARM_SCREEN_SCRUB]'>Scrubbers Control</a><br />
<a href='?src=\ref[src];screen=[AALARM_SCREEN_VENT]'>Vents Control</a><br />
<a href='?src=\ref[src];screen=[AALARM_SCREEN_MODE]'>Set Environmentals Mode</a><br />
<a href='?src=\ref[src];screen=[AALARM_SCREEN_SENSORS]'>Sensor Settings</a><br />
<HR>
"}
if (mode==AALARM_MODE_PANIC)
output += "<font color='red'><B>PANIC SYPHON ACTIVE</B></font><br /><A href='?src=\ref[src];mode=[AALARM_MODE_SCRUBBING]'>Turn syphoning off</A>"
else
output += "<A href='?src=\ref[src];mode=[AALARM_MODE_PANIC]'><font color='red'><B>ACTIVATE PANIC SYPHON IN AREA</B></font></A>"
if (AALARM_SCREEN_VENT)
var/sensor_data = ""
if(alarm_area.air_vent_names.len)
for(var/id_tag in alarm_area.air_vent_names)
var/long_name = alarm_area.air_vent_names[id_tag]
var/list/data = alarm_area.air_vent_info[id_tag]
if(!data)
continue;
var/state = ""
sensor_data += {"
<h3>[long_name]</h3>
[state]<br />
<B>Operating:</B>
<A href='?src=\ref[src];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A>
<br />
<B>Pressure checks:</B>
<A href='?src=\ref[src];id_tag=[id_tag];command=checks;val=[data["checks"]^1]' [(data["checks"]&1)?"style='font-weight:bold;'":""]>external</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=checks;val=[data["checks"]^2]' [(data["checks"]&2)?"style='font-weight:bold;'":""]>internal</A>
<br />
<B>External pressure bound:</B>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=-1000'>-</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=-100'>-</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=-10'>-</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=-1'>-</A>
[data["external"]]
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=+1'>+</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=+10'>+</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=+100'>+</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=adjust_external_pressure;val=+1000'>+</A>
<A href='?src=\ref[src];id_tag=[id_tag];command=set_external_pressure;val=[ONE_ATMOSPHERE]'>reset</A>
<br />
"}
if (data["direction"] == "siphon")
sensor_data += {"
<B>Direction:</B>
siphoning
<br />
"}
sensor_data += {"<HR>"}
else
sensor_data = "No vents connected.<br />"
output = {"<a href='?src=\ref[src];screen=[AALARM_SCREEN_MAIN]'><< Main Menu</a><hr><br />[sensor_data]"}
if (AALARM_SCREEN_SCRUB)
var/sensor_data = ""
if(alarm_area.air_scrub_names.len)
for(var/id_tag in alarm_area.air_scrub_names)
var/long_name = alarm_area.air_scrub_names[id_tag]
var/list/data = alarm_area.air_scrub_info[id_tag]
if(!data)
continue;
var/state = ""
sensor_data += {"
<B>[long_name]</B>[state]<br />
<B>Operating:</B>
<A href='?src=\ref[src];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A><br />
<B>Type:</B>
<A href='?src=\ref[src];id_tag=[id_tag];command=scrubbing;val=[!data["scrubbing"]]'>[data["scrubbing"]?"scrubbing":"syphoning"]</A><br />
"}
if(data["scrubbing"])
sensor_data += {"
<B>Filtering:</B>
Carbon Dioxide
<A href='?src=\ref[src];id_tag=[id_tag];command=co2_scrub;val=[!data["filter_co2"]]'>[data["filter_co2"]?"on":"off"]</A>;
Toxins
<A href='?src=\ref[src];id_tag=[id_tag];command=tox_scrub;val=[!data["filter_toxins"]]'>[data["filter_toxins"]?"on":"off"]</A>;
Nitrous Oxide
<A href='?src=\ref[src];id_tag=[id_tag];command=n2o_scrub;val=[!data["filter_n2o"]]'>[data["filter_n2o"]?"on":"off"]</A>
<br />
"}
sensor_data += {"
<B>Panic syphon:</B> [data["panic"]?"<font color='red'><B>PANIC SYPHON ACTIVATED</B></font>":""]
<A href='?src=\ref[src];id_tag=[id_tag];command=panic_siphon;val=[!data["panic"]]'><font color='[(data["panic"]?"blue'>Dea":"red'>A")]ctivate</font></A><br />
<HR>
"}
else
sensor_data = "No scrubbers connected.<br />"
output = {"<a href='?src=\ref[src];screen=[AALARM_SCREEN_MAIN]'><< Main Menu</a><hr><br />[sensor_data]"}
if (AALARM_SCREEN_MODE)
output += {"
<a href='?src=\ref[src];screen=[AALARM_SCREEN_MAIN]'><< Main Menu</a><hr><br />
<b>Air machinery mode for the area:</b><ul>"}
var/list/modes = list()
if(src.emagged)
modes = list(
AALARM_MODE_SCRUBBING = "Filtering",
AALARM_MODE_VENTING = "Draught",
AALARM_MODE_PANIC = "<font color='red'>PANIC</font>",
AALARM_MODE_REPLACEMENT = "<font color='red'>REPLACE AIR</font>",
AALARM_MODE_OFF = "Off",
AALARM_MODE_FLOOD = "<font color='red'>FLOOD</font>", //Below everything else because it shouldn't be there normally
)
else
modes = list(
AALARM_MODE_SCRUBBING = "Filtering",
AALARM_MODE_VENTING = "Draught",
AALARM_MODE_PANIC = "<font color='red'>PANIC</font>",
AALARM_MODE_REPLACEMENT = "<font color='red'>REPLACE AIR</font>",
AALARM_MODE_OFF = "Off",
)
for (var/m=1,m<=modes.len,m++)
if (mode==m)
output += {"<li><A href='?src=\ref[src];mode=[m]'><b>[modes[m]]</b></A> (selected)</li>"}
else
output += {"<li><A href='?src=\ref[src];mode=[m]'>[modes[m]]</A></li>"}
output += "</ul>"
if (AALARM_SCREEN_SENSORS)
output += {"
<a href='?src=\ref[src];screen=[AALARM_SCREEN_MAIN]'><< Main Menu</a><hr><hr><br />
<b>Alarm thresholds:</b><br />
Partial pressure for gases
<style>/* some CSS woodoo here. Does not work perfect in ie6 but who cares? */
table td { border-left: 1px solid black; border-top: 1px solid black;}
table tr:first-child th { border-left: 1px solid black;}
table th:first-child { border-top: 1px solid black; font-weight: normal;}
table tr:first-child th:first-child { border: none;}
.dl0 { color: green; }
.dl1 { color: orange; }
.dl2 { color: red; font-weght: bold;}
</style>
<table cellspacing=0>
<TR><th></th><th class=dl2>min2</th><th class=dl1>min1</th><th class=dl1>max1</th><th class=dl2>max2</th></TR>
"}
var/list/gases = list(
var/list/gas_names = list(
"oxygen" = "O<sub>2</sub>",
"carbon dioxide" = "CO<sub>2</sub>",
"plasma" = "Toxin",
"other" = "Other",
)
var/list/thresholds = list("min2", "min1", "max1", "max2")
var/datum/tlv/tlv
for (var/g in gases)
output += {"
<TR><th>[gases[g]]</th>
"}
tlv = TLV[g]
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];command=set_threshold;env=[g];var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
tlv = TLV["pressure"]
output += {"
<TR><th>Pressure</th>
"}
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];command=set_threshold;env=pressure;var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
tlv = TLV["temperature"]
output += {"
<TR><th>Temperature</th>
"}
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];command=set_threshold;env=temperature;var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
output += {"</table>"}
"other" = "Other")
for (var/g in gas_names)
thresholds[thresholds.len + 1] = list("name" = gas_names[g], "settings" = list())
selected = TLV[g]
for(var/i = 1, i <= 4, i++)
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = i, "selected" = selected[i]))
return output
selected = TLV["pressure"]
thresholds[++thresholds.len] = list("name" = "Pressure", "settings" = list())
for(var/i = 1, i <= 4, i++)
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = i, "selected" = selected[i]))
selected = TLV["temperature"]
thresholds[++thresholds.len] = list("name" = "Temperature", "settings" = list())
for(var/i = 1, i <= 4, i++)
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = i, "selected" = selected[i]))
data["thresholds"] = thresholds
/obj/machinery/alarm/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
if (locked && !usr.has_unlimited_silicon_privilege)
return
if ( (get_dist(src, usr) > 1 ))
if (!istype(usr, /mob/living/silicon))
usr.unset_machine()
usr << browse(null, "window=air_alarm")
return
if(href_list["toggleaccess"])
if(usr.has_unlimited_silicon_privilege && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
locked = !locked
if(href_list["command"])
var/device_id = href_list["id_tag"]
switch(href_list["command"])
if("set_external_pressure")
var/input_pressure = input("What pressure you like the system to mantain?", "Pressure Controls") as num|null
if(isnum(input_pressure))
send_signal(device_id, list(href_list["command"] = input_pressure))
return 1
if("reset_external_pressure")
send_signal(device_id, list(href_list["command"] = ONE_ATMOSPHERE))
return 1
if(
"power",
"adjust_external_pressure",
"set_external_pressure",
"checks",
"co2_scrub",
"tox_scrub",
"n2o_scrub",
@@ -577,12 +430,18 @@ table tr:first-child th:first-child { border: none;}
spawn(3)
src.updateUsrDialog()
if ("excheck")
send_signal(device_id, list ("checks" = text2num(href_list["val"])^1))
if ("incheck")
send_signal(device_id, list ("checks" = text2num(href_list["val"])^2))
//if("adjust_threshold") //was a good idea but required very wide window
if("set_threshold")
var/env = href_list["env"]
var/varname = href_list["var"]
var/datum/tlv/tlv = TLV[env]
var/newval = input("Enter [varname] for env", "Alarm triggers", tlv.vars[varname]) as num|null
var/newval = input("Enter [varname] for [env]", "Alarm triggers", tlv.vars[varname]) as num|null
if (isnull(newval) || ..() || (locked && !(usr.has_unlimited_silicon_privilege)))
return
+23 -21
View File
@@ -257,32 +257,34 @@ update_flag
return src.attack_hand(user)
/obj/machinery/portable_atmospherics/canister/attack_hand(var/mob/user as mob)
return src.interact(user)
return src.ui_interact(user)
/obj/machinery/portable_atmospherics/canister/interact(var/mob/user as mob)
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main")
if (src.destroyed)
return
user.set_machine(src)
var/holding_text
if(holding)
holding_text = {"<BR><B>Tank Pressure</B>: [holding.air_contents.return_pressure()] KPa<BR>
<A href='?src=\ref[src];remove_tank=1'>Remove Tank</A><BR>
"}
var/output_text = {"<TT><B>[name]</B>[can_label?" <A href='?src=\ref[src];relabel=1'><small>relabel</small></a>":""]<BR>
Pressure: [air_contents.return_pressure()] KPa<BR>
Port Status: [(connected_port)?("Connected"):("Disconnected")]
[holding_text]
<BR>
Release Valve: <A href='?src=\ref[src];toggle=1'>[valve_open?("Open"):("Closed")]</A><BR>
Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?src=\ref[src];pressure_adj=-100'>-</A> <A href='?src=\ref[src];pressure_adj=-10'>-</A> <A href='?src=\ref[src];pressure_adj=-1'>-</A> [release_pressure] <A href='?src=\ref[src];pressure_adj=1'>+</A> <A href='?src=\ref[src];pressure_adj=10'>+</A> <A href='?src=\ref[src];pressure_adj=100'>+</A> <A href='?src=\ref[src];pressure_adj=1000'>+</A><BR>
<HR>
<A href='?src=\ref[user];mach_close=canister'>Close</A><BR>
"}
var/data = list()
data["name"] = src.name
data["canLabel"] = src.can_label ? 1 : 0
data["portConnected"] = src.connected_port ? 1 : 0
data["tankPressure"] = round(src.air_contents.return_pressure() ? src.air_contents.return_pressure() : 0)
data["releasePressure"] = round(src.release_pressure ? src.release_pressure : 0)
data["minReleasePressure"] = round(ONE_ATMOSPHERE/10)
data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE)
data["valveOpen"] = src.valve_open ? 1 : 0
user << browse("<html><head><title>[src]</title></head><body>[output_text]</body></html>", "window=canister;size=600x300")
onclose(user, "canister")
return
data["hasHoldingTank"] = src.holding ? 1 : 0
if (holding)
data["holdingTank"] = list("name" = src.holding.name, "tankPressure" = round(src.holding.air_contents.return_pressure()))
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
if (!ui)
ui = new /datum/nanoui(user, src, ui_key, "canister.tmpl", "Canister", 480, 400)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
else
ui.push_data(data)
/obj/machinery/portable_atmospherics/canister/Topic(href, href_list)
+53 -15
View File
@@ -1,3 +1,6 @@
#define TANK_MAX_RELEASE_PRESSURE (3*ONE_ATMOSPHERE)
#define TANK_DEFAULT_RELEASE_PRESSURE (ONE_ATMOSPHERE*O2STANDARD)
/obj/item/weapon/tank
name = "tank"
icon = 'icons/obj/tank.dmi'
@@ -90,24 +93,54 @@
/obj/item/weapon/tank/attack_self(mob/user as mob)
if (!(src.air_contents))
return
user.set_machine(src)
ui_interact(user)
/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main")
var/mob/living/carbon/location = null
if(istype(loc, /mob/living/carbon))
location = loc
else if(istype(loc.loc, /mob/living/carbon))
location = loc.loc
var/using_internal
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(istype(location))
if(location.internal==src)
using_internal = 1
var/message = {"
<b>Tank</b><BR>
<FONT color='blue'><b>Tank Pressure:</b> [air_contents.return_pressure()]</FONT><BR>
<BR>
<b>Mask Release Pressure:</b> <A href='?src=\ref[src];dist_p=-5'>-</A> <A href='?src=\ref[src];dist_p=-1'>-</A> [distribute_pressure] <A href='?src=\ref[src];dist_p=1'>+</A> <A href='?src=\ref[src];dist_p=5'>+</A><BR>
<b>Mask Release Valve:</b> <A href='?src=\ref[src];stat=1'>[using_internal?("Open"):("Closed")]</A>
"}
user << browse(message, "window=tank;size=600x300")
onclose(user, "tank")
return
// this is the data which will be sent to the ui
var/data = list()
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
data["valveOpen"] = using_internal ? 1 : 0
data["maskConnected"] = 0
if(istype(location))
var/mask_check = 0
if(location.internal == src) // if tank is current internal
mask_check = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & MASKINTERNALS))
data["maskConnected"] = 1
var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
if (!ui)
ui = new /datum/nanoui(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
else
ui.push_data(data)
/obj/item/weapon/tank/Topic(href, href_list)
..()
@@ -116,8 +149,13 @@
if (src.loc == usr)
usr.set_machine(src)
if (href_list["dist_p"])
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
if (href_list["dist_p"] == "reset")
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if (href_list["dist_p"] == "max")
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), 3*ONE_ATMOSPHERE)
if (href_list["stat"])
if(istype(loc,/mob/living/carbon))
+2 -1
View File
@@ -141,7 +141,8 @@
return 0 // wasn't open
processing_uis.Remove(ui)
ui.user.open_uis.Remove(ui)
if(ui.user) // Sanity check in case a user has been deleted (say a blown up borg watching the alarm interface)
ui.user.open_uis.Remove(ui)
var/list/uis = open_uis[src_object_key][ui.ui_key]
return uis.Remove(ui)
+25 -3
View File
@@ -29,9 +29,18 @@ a, a:link, a:visited, a:active, .link, .linkOn, .linkOff, .selected, .disabled
.link
{
float: left;
min-width: 40px;
height: 16px;
float: left;
min-width: 15px;
height: 16px;
text-align: center;
color: #ffffff;
text-decoration: none;
background: #40628a;
border: 1px solid #161616;
padding: 0px 4px 4px 4px;
margin: 0 2px 2px 0;
cursor: default;
white-space: nowrap;
}
a:hover, .linkActive:hover
@@ -218,6 +227,10 @@ h4
font-weight: bold;
}
.redButton {
background: #ea0000;
}
.highlight
{
color: #8BA5C4;
@@ -228,6 +241,15 @@ h4
color: #272727;
}
.noticePlaceholder {
position: relative;
font-size: 12px;
font-style: italic;
font-weight: bold;
padding: 3px 4px 3px 4px;
margin: 4px 0 4px 0;
}
.notice
{
background: url(uiNoticeBackground.jpg) 0 0 repeat;
+199
View File
@@ -0,0 +1,199 @@
<!--
Title: Air Alarm
Used In File(s): \code\game\machinery\alarm.dm
#define AALARM_MODE_SCRUBBING 1
#define AALARM_MODE_VENTING 2 //makes draught
#define AALARM_MODE_PANIC 3 //constantly sucks all air
#define AALARM_MODE_REPLACEMENT 4 //sucks off all air, then refill and swithes to scrubbing
#define AALARM_MODE_OFF 5
#define AALARM_MODE_FLOOD 6 //Emagged mode; turns off scrubbers and pressure checks on vents
#define AALARM_SCREEN_MAIN 1
#define AALARM_SCREEN_VENT 2
#define AALARM_SCREEN_SCRUB 3
#define AALARM_SCREEN_MODE 4
#define AALARM_SCREEN_SENSORS 5
-->
<div class='notice'>
{{if siliconUser}}
<div class="itemContentSmall">
Interface Lock:
</div>
<div class="itemContentFull">
{{:~link('Engaged', 'locked', {'toggleaccess' : 1}, locked ? 'selected' : null)}}{{:~link('Disengaged', 'unlocked', {'toggleaccess' : 1}, (locked ? null : 'selected'))}}
</div>
{{else}}
{{if locked}}
Swipe an ID card to unlock this interface.
{{else}}
Swipe an ID card to lock this interface.
{{/if}}
{{/if}}
<div class="clearBoth"></div>
</div>
<H1>Air Status</H1>
{{if environment_data}}
{{for environment_data}}
{{:name}}
{{if danger_level == 2}}
<span class='bad'>
{{else danger_level == 1}}
<span class='average'>
{{else}}
<span class='good'>
{{/if}}
{{:~round(value*100)/100}}
</span>{{:unit}}<br>
{{/for}}
Local Status: {{if danger_level == 2}}
<span class='bad'>DANGER: Internals Required
{{else danger_level == 1}}
<span class='average'>Caution
{{else}}
<span class='good'>Optimal
{{/if}}
</span><br>
Area Status: {{if atmos_alarm}}<span class='bad'>Atmosphere alert in area</span>{{else fire_alarm}}<span class='bad'>Fire alarm in area</span>{{else}}No alerts{{/if}}
{{else}}
<span class='bad'>Warning: Cannot obtain air sample for analysis.</span>
{{/if}}
{{if dangerous}}
<br><span class='bad'>NOTICE: Safety measures nonfunctional. Device may exhibit abnormal behavior.</span>
{{/if}}
<HR>
{{if (!locked || siliconUser)}}
{{if screen != 1}}
<div class="item">{{:~link('Main Menu', null, { 'screen' : 1})}}</div>
{{/if}}
{{if screen == 1}}
<div class="item">
{{if atmos_alarm}}
{{:~link('Reset - Area Atmospheric Alarm', null, { 'atmos_reset' : 1})}}
{{else}}
{{:~link('Activate - Area Atmospheric Alarm', null, { 'atmos_alarm' : 1})}}
{{/if}}
</div>
<hr>
<div class="item">
{{:~link('Scrubbers Control', null, { 'screen' : 3})}}
</div>
<div class="item">
{{:~link('Vents Control', null, { 'screen' : 2})}}
</div>
<div class="item">
{{:~link('Set Environmental Mode', null, { 'screen' : 4})}}
</div>
<div class="item">
{{:~link('Sensor Settings', null, { 'screen' : 5})}}
</div>
<hr>
{{if mode==3}}
{{:~link('PANIC SIPHON ACTIVE - Turn siphoning off', null, { 'mode' : 1}, null, 'redButton')}}
{{else}}
{{:~link('ACTIVATE PANIC SIPHON IN AREA', null, { 'mode' : 3}, null, 'yellowButton')}}
{{/if}}
{{else screen == 2}}
{{for vents}}
<div class="item">{{:long_name}}</div>
<div class="item">
<div class="itemLabel">
Operating:
</div>
<div class="itemContent">
{{:~link(power ? 'On' : 'Off', null, { 'id_tag' : id_tag, 'command' : 'power', 'val' : power ? 0 : 1}, null, power ? null : 'redButton')}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Mode:
</div>
<div class="itemContent">
{{:direction == "siphon" ? 'Siphoning' : 'Pressurizing'}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Pressure Checks:
</div>
<div class="itemContent">
{{:~link('External', null, { 'id_tag' : id_tag, 'command' : 'excheck', 'val' : excheck}, null, excheck ? 'selected' : null)}}
{{:~link('Internal', null, { 'id_tag' : id_tag, 'command' : 'incheck', 'val' : incheck}, null, incheck ? 'selected' : null)}}
</div>
</div>
<div class="item">
<div class="itemLabel">
External Pressure Bound:
</div>
<div class="itemContent">
{{:~link(~round(external*100)/100, null, { 'id_tag' : id_tag, 'command' : 'set_external_pressure'})}}
{{:~link('Reset', null, { 'id_tag' : id_tag, 'command' : 'reset_external_pressure'})}}
</div>
</div>
<HR>
{{/for}}
{{if !vents.length}}
No vents connected.
{{/if}}
{{else screen == 3}}
{{for scrubbers}}
<div class="item">{{:long_name}}</div>
<div class="item">
<div class="itemLabel">
Operating:
</div>
<div class="itemContent">
{{:~link(power ? 'On' : 'Off', null, { 'id_tag' : id_tag, 'command' : 'power', 'val' : power ? 0 : 1}, null, power ? null : 'redButton')}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Mode:
</div>
<div class="itemContent">
{{:~link(scrubbing ? 'Scrubbing' : 'Siphoning', null, { 'id_tag' : id_tag, 'command' : 'scrubbing', 'val' : scrubbing ? 0 : 1}, null, scrubbing ? null : 'redButton')}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Filters:
</div>
<div class="itemContent">
{{:~link("Carbon Dioxide", null, { 'id_tag' : id_tag, 'command' : "co2_scrub", 'val' : filter_co2 ? 0 : 1}, null, filter_co2 ? 'selected' : null)}}<br class="clearBoth">
{{:~link("Plasma", null, { 'id_tag' : id_tag, 'command' : "tox_scrub", 'val' : filter_toxins ? 0 : 1}, null, filter_toxins ? 'selected' : null)}}<br class="clearBoth">
{{:~link("Nitrous Oxide", null, { 'id_tag' : id_tag, 'command' : "n2o_scrub", 'val' : filter_n2o ? 0 : 1}, null, filter_n2o ? 'selected' : null)}}<br class="clearBoth">
</div>
</div>
<HR>
{{/for}}
{{if !scrubbers.length}}
No scrubbers connected.
{{/if}}
{{else screen == 4}}
<H3>Environmental Modes</H3>
{{for modes}}
<div class="item">
{{:~link(name, null, { 'mode' : mode }, null, selected ? (danger ? 'redButton' : 'selected') : null)}}
</div>
{{/for}}
{{else screen == 5}}
<H3>Alarm Threshold</H3>
Partial pressure for gases.
<table class='fixed'>
<tr>
<td></td><td><span class='bad'>min2</span></td><td><span class='average'>min1</span></td><td><span class='average'>max1</span></td><td><span class='bad'>max2</span></td>
</tr>
{{for thresholds}}
<tr>
<td>{{:name}}</td>
{{for settings.settingsValue.settingsIndex}}
<td>
{{:~link(settingsValue.selected >= 0 ? fixed(settingsValue.selected, 2) : "Off", null, { 'command' : 'set_threshold', 'env' : settingsValue.env, 'var' : settingsValue.val })}}
</td>
{{/for}}
</tr>
{{/for}}
<table>
{{/if}}
{{/if}}
+51
View File
@@ -0,0 +1,51 @@
<div class="item">
<div class="itemLabel">
Power:
</div>
<div class="itemContent">
{{:~link(on? 'On' : 'Off', null, {'power' : 1})}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Output pressure:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('MAX', null, {'set_press' : 'max'}, null)}}
{{:~link('SET', null, {'set_press' : 'set'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:(pressure_set/100)}} kPa&nbsp;</div>
</div>
</div>
</div>
<h4>Filter Type</h4>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Plasma', null, {'filterset' : 0}, (filter_type == 0)? 'selected' : null)}}
</div>
</div>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Oxygen', null, {'filterset' : 1}, (filter_type == 1)? 'selected' : null)}}
</div>
</div>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Nitrogen', null, {'filterset' : 2}, (filter_type == 2)? 'selected' : null)}}
</div>
</div>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Carbon Dioxide', null, {'filterset' : 3}, (filter_type == 3)? 'selected' : null)}}
</div>
</div>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Nitrous Oxide', null, {'filterset' : 4}, (filter_type == 4)? 'selected' : null)}}
</div>
</div>
<div class="item">
<div style="clear: both; padding-top: 4px;">
{{:~link('Nothing', null, {'filterset' : -1}, (filter_type == -1)? 'selected' : null)}}
</div>
</div>
+36
View File
@@ -0,0 +1,36 @@
<div class="item">
<div class="itemLabel">
Power:
</div>
<div class="itemContent">
{{:~link(on? 'On' : 'Off', null, {'power' : 1})}}
</div>
</div>
{{if max_rate}}
<div class="item">
<div class="itemLabel">
Transfer rate:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('MAX', null, {'set_transfer_rate' : 'max'}, null)}}
{{:~link('SET', null, {'set_transfer_rate' : 'set'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:(transfer_rate/100)}} L/s&nbsp;</div>
</div>
</div>
</div>
{{else}}
<div class="item">
<div class="itemLabel">
Output pressure:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('MAX', null, {'set_press' : 'max'}, null)}}
{{:~link('SET', null, {'set_press' : 'set'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:(pressure_set/100)}} kPa&nbsp;</div>
</div>
</div>
</div>
{{/if}}
+51
View File
@@ -0,0 +1,51 @@
<div class="item">
<div class="itemLabel">
Power:
</div>
<div class="itemContent">
{{:~link(on? 'On' : 'Off', null, {'power' : 1})}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Output pressure:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('MAX', null, {'set_press' : 'max'}, null)}}
{{:~link('SET', null, {'set_press' : 'set'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:(pressure_set/100)}} kPa&nbsp;</div>
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Node 1 Concentration:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('-', null, {'node1_c' : '-0.1'}, null)}}
{{:~link('-', null, {'node1_c' : '-0.01'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:node1_concentration}} %&nbsp;</div>
{{:~link('+', null, {'node1_c' : '0.01'}, null)}}
{{:~link('+', null, {'node1_c' : '0.1'}, null)}}
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Node 2 Concentration:
</div>
<div class="itemContent">
<div style="clear: both; padding-top: 4px;">
{{:~link('-', null, {'node2_c' : '-0.1'}, null)}}
{{:~link('-', null, {'node2_c' : '-0.01'}, null)}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:node2_concentration}} %&nbsp;</div>
{{:~link('+', null, {'node2_c' : '0.01'}, null)}}
{{:~link('+', null, {'node2_c' : '0.1'}, null)}}
</div>
</div>
</div>
+83
View File
@@ -0,0 +1,83 @@
<h3>Tank Status</h3>
<div class="item">
<div class="itemLabel">
Tank Label:
</div>
<div class="itemContent">
<div style="float: left; width: 180px;">{{:name}}</div> {{:~link('Relabel', 'pencil', {'relabel' : 1}, canLabel ? null : 'disabled')}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Tank Pressure:
</div>
<div class="itemContent">
{{:tankPressure}} kPa
</div>
</div>
<div class="item">
<div class="itemLabel">
Port Status:
</div>
<div class="itemContent">
{{:portConnected ? '<span class="good">Connected</span>' : '<span class="average">Disconnected</span>'}}
</div>
</div>
<h3>Holding Tank Status</h3>
{{if hasHoldingTank}}
<div class="item">
<div class="itemLabel">
Tank Label:
</div>
<div class="itemContent">
<div style="float: left; width: 180px;">{{:holdingTank.name}}</div> {{:~link('Eject', 'eject', {'remove_tank' : 1})}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Tank Pressure:
</div>
<div class="itemContent">
{{:holdingTank.tankPressure}} kPa
</div>
</div>
{{else}}
<div class="item"><span class="average"><i>No holding tank inserted.</i></span></div>
<div class="item">&nbsp;</div>
{{/if}}
<h3>Release Valve Status</h3>
<div class="item">
<div class="itemLabel">
Release Pressure:
</div>
<div class="itemContent">
{{:~displayBar(releasePressure, minReleasePressure, maxReleasePressure)}}
<div style="clear: both; padding-top: 4px;">
{{:~link('-', null, {'pressure_adj' : -1000}, (releasePressure > minReleasePressure) ? null : 'disabled')}}
{{:~link('-', null, {'pressure_adj' : -100}, (releasePressure > minReleasePressure) ? null : 'disabled')}}
{{:~link('-', null, {'pressure_adj' : -10}, (releasePressure > minReleasePressure) ? null : 'disabled')}}
{{:~link('-', null, {'pressure_adj' : -1}, (releasePressure > minReleasePressure) ? null : 'disabled')}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:releasePressure}} kPa&nbsp;</div>
{{:~link('+', null, {'pressure_adj' : 1}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('+', null, {'pressure_adj' : 10}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('+', null, {'pressure_adj' : 100}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('+', null, {'pressure_adj' : 1000}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Release Valve:
</div>
<div class="itemContent">
{{:~link('Open', 'unlocked', {'toggle' : 1}, valveOpen ? 'selected' : null)}}{{:~link('Close', 'locked', {'toggle' : 1}, valveOpen ? null : 'selected')}}
</div>
</div>
+47
View File
@@ -0,0 +1,47 @@
{{if maskConnected}}
<div class="noticePlaceholder">This tank is connected to a mask.</div>
{{else}}
<div class="notice">This tank is NOT connected to a mask.</div>
{{/if}}
<div class="item">
<div class="itemLabel">
Tank Pressure:
</div>
<div class="itemContent">
{{:~displayBar(tankPressure, 0, 1013, (tankPressure > 200) ? 'good' : ((tankPressure > 100) ? 'average' : 'bad'))}}
<div class="statusValue">
{{:tankPressure}} kPa
</div>
</div>
</div>
<div class="item">&nbsp;</div>
<div class="item">
<div class="itemLabel">
Mask Release Pressure:
</div>
<div class="itemContent">
{{:~displayBar(releasePressure, 0, maxReleasePressure, (releasePressure >= 23) ? null : ((releasePressure >= 17) ? 'average' : 'bad'))}}
<div style="clear: both; padding-top: 4px;">
{{:~link('-', null, {'dist_p' : -5}, (releasePressure > 0) ? null : 'disabled')}}
{{:~link('-', null, {'dist_p' : -1}, (releasePressure > 0) ? null : 'disabled')}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:releasePressure}} kPa&nbsp;</div>
{{:~link('+', null, {'dist_p' : 1}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('+', null, {'dist_p' : 5}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('Max', null, {'dist_p' : 'max'}, (releasePressure < maxReleasePressure) ? null : 'disabled')}}
{{:~link('Reset', null, {'dist_p' : 'reset'}, (releasePressure != defaultReleasePressure) ? null : 'disabled')}}
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Mask Release Valve:
</div>
<div class="itemContent">
{{:~link('Open', 'unlocked', {'stat' : 1}, (!maskConnected) ? 'disabled' : (valveOpen ? 'selected' : null))}}{{:~link('Close', 'locked', {'stat' : 1}, valveOpen ? null : 'selected')}}
</div>
</div>