mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-01-29 18:31:03 +00:00
NanoUI air alarm interface. Remote support lost.
This commit is contained in:
@@ -173,7 +173,7 @@
|
||||
use_power = !use_power
|
||||
|
||||
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
|
||||
panic = text2num(signal.data["panic_siphon"] != null)
|
||||
panic = text2num(signal.data["panic_siphon"])
|
||||
if(panic)
|
||||
use_power = 1
|
||||
scrubbing = 0
|
||||
@@ -189,8 +189,12 @@
|
||||
|
||||
if(signal.data["scrubbing"] != null)
|
||||
scrubbing = text2num(signal.data["scrubbing"])
|
||||
if(scrubbing)
|
||||
panic = 0
|
||||
if(signal.data["toggle_scrubbing"])
|
||||
scrubbing = !scrubbing
|
||||
if(scrubbing)
|
||||
panic = 0
|
||||
|
||||
var/list/toggle = list()
|
||||
|
||||
|
||||
@@ -195,7 +195,6 @@
|
||||
if(RCON_YES)
|
||||
remote_control = 1
|
||||
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/alarm/proc/handle_heating_cooling(var/datum/gas_mixture/environment)
|
||||
@@ -468,7 +467,7 @@
|
||||
frequency.post_signal(src, alert_signal)
|
||||
|
||||
/obj/machinery/alarm/attack_ai(mob/user)
|
||||
return interact(user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/alarm/attack_hand(mob/user)
|
||||
. = ..()
|
||||
@@ -477,315 +476,164 @@
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/alarm/interact(mob/user)
|
||||
user.set_machine(src)
|
||||
ui_interact(user)
|
||||
wires.Interact(user)
|
||||
|
||||
if(buildstage!=2)
|
||||
return
|
||||
/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, remote = 0)
|
||||
var/data[0]
|
||||
var/is_locked = locked && !user.isAI()
|
||||
|
||||
if((get_dist(src, user) > 1 ))
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=air_alarm")
|
||||
user << browse(null, "window=AAlarmwires")
|
||||
return
|
||||
data["locked"] = is_locked
|
||||
data["rcon"] = rcon_setting
|
||||
data["screen"] = screen
|
||||
|
||||
populate_status(data)
|
||||
|
||||
else if (istype(user, /mob/living/silicon) && aidisabled)
|
||||
user << "AI control for this Air Alarm interface has been disabled."
|
||||
user << browse(null, "window=air_alarm")
|
||||
return
|
||||
if(!is_locked)
|
||||
populate_controls(data)
|
||||
|
||||
if(wiresexposed && (!istype(user, /mob/living/silicon/ai)))
|
||||
wires.Interact(user)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "air_alarm.tmpl", src.name, 625, 625)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
if(!shorted)
|
||||
user << browse(return_text(user),"window=air_alarm")
|
||||
onclose(user, "air_alarm")
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/alarm/proc/return_text(mob/user)
|
||||
if(!(istype(user, /mob/living/silicon)) && locked)
|
||||
return "<html><head><title>\The [src]</title></head><body>[return_status()]<hr>[rcon_text()]<hr><i>(Swipe ID card to unlock interface)</i></body></html>"
|
||||
else
|
||||
return "<html><head><title>\The [src]</title></head><body>[return_status()]<hr>[rcon_text()]<hr>[return_controls()]</body></html>"
|
||||
|
||||
/obj/machinery/alarm/proc/return_status()
|
||||
/obj/machinery/alarm/proc/populate_status(var/data)
|
||||
var/turf/location = get_turf(src)
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
var/total = environment.total_moles
|
||||
var/output = "<b>Air Status:</b><br>"
|
||||
|
||||
if(total == 0)
|
||||
output += "<font color='red'><b>Warning: Cannot obtain air sample for analysis.</b></font>"
|
||||
return output
|
||||
var/list/environment_data = new
|
||||
data["has_environment"] = total
|
||||
if(total)
|
||||
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/list/current_settings = TLV["pressure"]
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure_danger = get_danger_level(pressure, current_settings)
|
||||
environment_data[++environment_data.len] = list("name" = "Pressure", "value" = pressure, "unit" = "kPa", "danger_level" = pressure_danger)
|
||||
data["total_danger"] = pressure_danger
|
||||
|
||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||
current_settings = TLV["oxygen"]
|
||||
var/oxygen_danger = get_danger_level(environment.gas["oxygen"]*partial_pressure, current_settings)
|
||||
environment_data[++environment_data.len] = list("name" = "Oxygen", "value" = environment.gas["oxygen"] / total * 100, "unit" = "%", "danger_level" = oxygen_danger)
|
||||
data["total_danger"] = max(oxygen_danger, data["total_danger"])
|
||||
|
||||
var/list/current_settings = TLV["pressure"]
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
|
||||
current_settings = TLV["carbon dioxide"]
|
||||
var/carbon_dioxide_danger = get_danger_level(environment.gas["carbon dioxide"]*partial_pressure, current_settings)
|
||||
environment_data[++environment_data.len] = list("name" = "Carbon dioxide", "value" = environment.gas["carbon dioxide"] / total * 100, "unit" = "%", "danger_level" = carbon_dioxide_danger)
|
||||
data["total_danger"] = max(carbon_dioxide_danger, data["total_danger"])
|
||||
|
||||
current_settings = TLV["oxygen"]
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.gas["oxygen"]*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.gas["oxygen"] / total * 100, 2)
|
||||
current_settings = TLV["phoron"]
|
||||
var/phoron_danger = get_danger_level(environment.gas["phoron"]*partial_pressure, current_settings)
|
||||
environment_data[++environment_data.len] = list("name" = "Toxins", "value" = environment.gas["phoron"] / total * 100, "unit" = "%", "danger_level" = phoron_danger)
|
||||
data["total_danger"] = max(phoron_danger, data["total_danger"])
|
||||
|
||||
current_settings = TLV["carbon dioxide"]
|
||||
var/co2_dangerlevel = get_danger_level(environment.gas["carbon_dioxide"]*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.gas["carbon_dioxide"] / total * 100, 2)
|
||||
current_settings = TLV["temperature"]
|
||||
var/temperature_danger = get_danger_level(environment.temperature, current_settings)
|
||||
environment_data[++environment_data.len] = list("name" = "Temperature", "value" = environment.temperature, "unit" = "K ([round(environment.temperature - T0C, 0.1)]C)", "danger_level" = temperature_danger)
|
||||
data["total_danger"] = max(temperature_danger, data["total_danger"])
|
||||
|
||||
current_settings = TLV["phoron"]
|
||||
var/phoron_dangerlevel = get_danger_level(environment.gas["phoron"]*partial_pressure, current_settings)
|
||||
var/phoron_percent = round(environment.gas["phoron"] / total * 100, 2)
|
||||
|
||||
//current_settings = TLV["other"]
|
||||
//var/other_moles = 0.0
|
||||
//for(var/datum/gas/G in environment.trace_gases)
|
||||
// other_moles+=G.moles
|
||||
//var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
||||
|
||||
current_settings = TLV["temperature"]
|
||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
|
||||
|
||||
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[phoron_dangerlevel]'>[phoron_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 ([round(environment.temperature - T0C, 0.1)]C)<br>"
|
||||
|
||||
//'Local Status' should report the LOCAL status, damnit.
|
||||
output += "Local Status: "
|
||||
switch(max(pressure_dangerlevel,oxygen_dangerlevel,co2_dangerlevel,phoron_dangerlevel,other_dangerlevel,temperature_dangerlevel))
|
||||
if(2)
|
||||
output += "<span class='dl2'>DANGER: Internals Required</span><br>"
|
||||
if(1)
|
||||
output += "<span class='dl1'>Caution</span><br>"
|
||||
if(0)
|
||||
output += "<span class='dl0'>Optimal</span><br>"
|
||||
|
||||
output += "Area Status: "
|
||||
if(alarm_area.atmosalm)
|
||||
output += "<span class='dl1'>Atmos alert in area</span>"
|
||||
else if (alarm_area.fire)
|
||||
output += "<span class='dl1'>Fire alarm in area</span>"
|
||||
else
|
||||
output += "No alerts"
|
||||
|
||||
return output
|
||||
|
||||
/obj/machinery/alarm/proc/rcon_text()
|
||||
var/dat = "<table width=\"100%\"><td align=\"center\"><b>Remote Control:</b><br>"
|
||||
if(rcon_setting == RCON_NO)
|
||||
dat += "<b>Off</b>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];rcon=[RCON_NO]'>Off</a>"
|
||||
dat += " | "
|
||||
if(rcon_setting == RCON_AUTO)
|
||||
dat += "<b>Auto</b>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];rcon=[RCON_AUTO]'>Auto</a>"
|
||||
dat += " | "
|
||||
if(rcon_setting == RCON_YES)
|
||||
dat += "<b>On</b>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];rcon=[RCON_YES]'>On</a></td>"
|
||||
|
||||
//Hackish, I know. I didn't feel like bothering to rework all of this.
|
||||
dat += "<td align=\"center\"><b>Thermostat:</b><br><a href='?src=\ref[src];temperature=1'>[target_temperature - T0C]C</a></td></table>"
|
||||
|
||||
return dat
|
||||
|
||||
/obj/machinery/alarm/proc/return_controls(var/source = src)
|
||||
var/output = ""//"<B>[alarm_zone] Air [name]</B><HR>"
|
||||
data["environment"] = environment_data
|
||||
data["atmos_alarm"] = alarm_area.atmosalm
|
||||
data["fire_alarm"] = alarm_area.fire != null
|
||||
data["target_temperature"] = "[target_temperature - T0C]C"
|
||||
|
||||
/obj/machinery/alarm/proc/populate_controls(var/list/data)
|
||||
switch(screen)
|
||||
if (AALARM_SCREEN_MAIN)
|
||||
if(alarm_area.atmosalm)
|
||||
output += "<a href='?src=\ref[source];atmos_reset=1'>Reset - Area Atmospheric Alarm</a><hr>"
|
||||
else
|
||||
output += "<a href='?src=\ref[source];atmos_alarm=1'>Activate - Area Atmospheric Alarm</a><hr>"
|
||||
if(AALARM_SCREEN_MAIN)
|
||||
data["mode"] = mode
|
||||
if(AALARM_SCREEN_VENT)
|
||||
var/vents[0]
|
||||
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
|
||||
vents[++vents.len] = list(
|
||||
"id_tag" = id_tag,
|
||||
"long_name" = sanitize(long_name),
|
||||
"power" = info["power"],
|
||||
"checks" = info["checks"],
|
||||
"direction" = info["direction"],
|
||||
"external" = info["external"]
|
||||
)
|
||||
data["vents"] = vents
|
||||
if(AALARM_SCREEN_SCRUB)
|
||||
var/scrubbers[0]
|
||||
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
|
||||
scrubbers[++scrubbers.len] = list(
|
||||
"id_tag" = id_tag,
|
||||
"long_name" = sanitize(long_name),
|
||||
"power" = info["power"],
|
||||
"scrubbing" = info["scrubbing"],
|
||||
"panic" = info["panic"],
|
||||
"filters" = list()
|
||||
)
|
||||
scrubbers[scrubbers.len]["filters"] += list(list("name" = "Oxygen", "command" = "o2_scrub", "val" = info["filter_o2"]))
|
||||
scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrogen", "command" = "n2_scrub", "val" = info["filter_n2"]))
|
||||
scrubbers[scrubbers.len]["filters"] += list(list("name" = "Carbon Dioxide", "command" = "co2_scrub","val" = info["filter_co2"]))
|
||||
scrubbers[scrubbers.len]["filters"] += list(list("name" = "Toxin" , "command" = "tox_scrub","val" = info["filter_phoron"]))
|
||||
scrubbers[scrubbers.len]["filters"] += list(list("name" = "Nitrous Oxide", "command" = "n2o_scrub","val" = info["filter_n2o"]))
|
||||
data["scrubbers"] = scrubbers
|
||||
if(AALARM_SCREEN_MODE)
|
||||
var/modes[0]
|
||||
modes[++modes.len] = list("name" = "Filtering - Scrubs out contaminants", "mode" = AALARM_MODE_SCRUBBING, "selected" = mode == AALARM_MODE_SCRUBBING, "danger" = 0)
|
||||
modes[++modes.len] = list("name" = "Replace Air - Siphons out air while replacing", "mode" = AALARM_MODE_REPLACEMENT, "selected" = mode == AALARM_MODE_REPLACEMENT, "danger" = 0)
|
||||
modes[++modes.len] = list("name" = "Panic - Siphons air out of the room", "mode" = AALARM_MODE_PANIC, "selected" = mode == AALARM_MODE_PANIC, "danger" = 1)
|
||||
modes[++modes.len] = list("name" = "Cycle - Siphons air before replacing", "mode" = AALARM_MODE_CYCLE, "selected" = mode == AALARM_MODE_CYCLE, "danger" = 1)
|
||||
modes[++modes.len] = list("name" = "Fill - Shuts off scrubbers and opens vents", "mode" = AALARM_MODE_FILL, "selected" = mode == AALARM_MODE_FILL, "danger" = 0)
|
||||
modes[++modes.len] = list("name" = "Off - Shuts off vents and scrubbers", "mode" = AALARM_MODE_OFF, "selected" = mode == AALARM_MODE_OFF, "danger" = 0)
|
||||
data["modes"] = modes
|
||||
data["mode"] = mode
|
||||
if(AALARM_SCREEN_SENSORS)
|
||||
var/list/selected
|
||||
var/thresholds[0]
|
||||
|
||||
output += {"
|
||||
<a href='?src=\ref[source];screen=[AALARM_SCREEN_SCRUB]'>Scrubbers Control</a><br>
|
||||
<a href='?src=\ref[source];screen=[AALARM_SCREEN_VENT]'>Vents Control</a><br>
|
||||
<a href='?src=\ref[source];screen=[AALARM_SCREEN_MODE]'>Set environmentals mode</a><br>
|
||||
<a href='?src=\ref[source];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[source];mode=[AALARM_MODE_SCRUBBING]'>Turn syphoning off</A>"
|
||||
else
|
||||
output += "<A href='?src=\ref[source];mode=[AALARM_MODE_PANIC]'><font color='red'>ACTIVATE PANIC SYPHON IN AREA</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 += {"
|
||||
<B>[long_name]</B>[state]<BR>
|
||||
<B>Operating:</B>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A>
|
||||
<BR>
|
||||
<B>Pressure checks:</B>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=checks;val=[data["checks"]^1]' [(data["checks"]&1)?"style='font-weight:bold;'":""]>external</A>
|
||||
<A href='?src=\ref[source];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[source];id_tag=[id_tag];command=adjust_external_pressure;val=-1000'>-</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=-100'>-</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=-10'>-</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=-1'>-</A>
|
||||
[data["external"]]
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=+1'>+</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=+10'>+</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=+100'>+</A>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=adjust_external_pressure;val=+1000'>+</A>
|
||||
<A href='?src=\ref[source];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[source];screen=[AALARM_SCREEN_MAIN]'>Main menu</a><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[source];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A><BR>
|
||||
<B>Type:</B>
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=scrubbing;val=[!data["scrubbing"]]'>[data["scrubbing"]?"scrubbing":"syphoning"]</A><BR>
|
||||
"}
|
||||
|
||||
if(data["scrubbing"])
|
||||
sensor_data += {"
|
||||
<B>Filtering:</B>
|
||||
Oxygen
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=o2_scrub;val=[!data["filter_o2"]]'>[data["filter_o2"]?"on":"off"]</A>;
|
||||
Nitrogen
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=n2_scrub;val=[!data["filter_n2"]]'>[data["filter_n2"]?"on":"off"]</A>;
|
||||
Carbon Dioxide
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=co2_scrub;val=[!data["filter_co2"]]'>[data["filter_co2"]?"on":"off"]</A>;
|
||||
Toxins
|
||||
<A href='?src=\ref[source];id_tag=[id_tag];command=tox_scrub;val=[!data["filter_phoron"]]'>[data["filter_phoron"]?"on":"off"]</A>;
|
||||
Nitrous Oxide
|
||||
<A href='?src=\ref[source];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[source];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[source];screen=[AALARM_SCREEN_MAIN]'>Main menu</a><br>[sensor_data]"}
|
||||
|
||||
if (AALARM_SCREEN_MODE)
|
||||
output += "<a href='?src=\ref[source];screen=[AALARM_SCREEN_MAIN]'>Main menu</a><br><b>Air machinery mode for the area:</b><ul>"
|
||||
var/list/modes = list(AALARM_MODE_SCRUBBING = "Filtering - Scrubs out contaminants",\
|
||||
AALARM_MODE_REPLACEMENT = "<font color='blue'>Replace Air - Siphons out air while replacing</font>",\
|
||||
AALARM_MODE_PANIC = "<font color='red'>Panic - Siphons air out of the room</font>",\
|
||||
AALARM_MODE_CYCLE = "<font color='red'>Cycle - Siphons air before replacing</font>",\
|
||||
AALARM_MODE_FILL = "<font color='green'>Fill - Shuts off scrubbers and opens vents</font>",\
|
||||
AALARM_MODE_OFF = "<font color='blue'>Off - Shuts off vents and scrubbers</font>",)
|
||||
for (var/m=1,m<=modes.len,m++)
|
||||
if (mode==m)
|
||||
output += "<li><A href='?src=\ref[source];mode=[m]'><b>[modes[m]]</b></A> (selected)</li>"
|
||||
else
|
||||
output += "<li><A href='?src=\ref[source];mode=[m]'>[modes[m]]</A></li>"
|
||||
output += "</ul>"
|
||||
|
||||
if (AALARM_SCREEN_SENSORS)
|
||||
output += {"
|
||||
<a href='?src=\ref[source];screen=[AALARM_SCREEN_MAIN]'>Main menu</a><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>",
|
||||
"phoron" = "Toxin",
|
||||
"other" = "Other",)
|
||||
|
||||
var/list/selected
|
||||
for (var/g in gases)
|
||||
output += "<TR><th>[gases[g]]</th>"
|
||||
"other" = "Other")
|
||||
for (var/g in gas_names)
|
||||
thresholds[++thresholds.len] = list("name" = gas_names[g], "settings" = list())
|
||||
selected = TLV[g]
|
||||
for(var/i = 1, i <= 4, i++)
|
||||
output += "<td><A href='?src=\ref[source];command=set_threshold;env=[g];var=[i]'>[selected[i] >= 0 ? selected[i] :"OFF"]</A></td>"
|
||||
output += "</TR>"
|
||||
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = i, "selected" = selected[i]))
|
||||
|
||||
selected = TLV["pressure"]
|
||||
output += " <TR><th>Pressure</th>"
|
||||
thresholds[++thresholds.len] = list("name" = "Pressure", "settings" = list())
|
||||
for(var/i = 1, i <= 4, i++)
|
||||
output += "<td><A href='?src=\ref[source];command=set_threshold;env=pressure;var=[i]'>[selected[i] >= 0 ? selected[i] :"OFF"]</A></td>"
|
||||
output += "</TR>"
|
||||
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = i, "selected" = selected[i]))
|
||||
|
||||
selected = TLV["temperature"]
|
||||
output += "<TR><th>Temperature</th>"
|
||||
thresholds[++thresholds.len] = list("name" = "Temperature", "settings" = list())
|
||||
for(var/i = 1, i <= 4, i++)
|
||||
output += "<td><A href='?src=\ref[source];command=set_threshold;env=temperature;var=[i]'>[selected[i] >= 0 ? selected[i] :"OFF"]</A></td>"
|
||||
output += "</TR></table>"
|
||||
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = i, "selected" = selected[i]))
|
||||
|
||||
return output
|
||||
|
||||
data["thresholds"] = thresholds
|
||||
|
||||
/obj/machinery/alarm/CanUseTopic(var/mob/user)
|
||||
if(buildstage != 2)
|
||||
return STATUS_CLOSE
|
||||
|
||||
if(aidisabled && user.isAI())
|
||||
user << "<span class='warning'>AI control for \the [src] interface has been disabled.</span>"
|
||||
return STATUS_CLOSE
|
||||
|
||||
. = shorted ? STATUS_DISABLED : STATUS_INTERACTIVE
|
||||
|
||||
return min(..(), .)
|
||||
|
||||
/obj/machinery/alarm/Topic(href, href_list, var/nowindow = 0, var/remote = 0)
|
||||
if(..(href, href_list, nowindow, !remote) || !( Adjacent(usr) || nowindow || istype(usr, /mob/living/silicon)) ) // dont forget calling super in machine Topics -walter0o
|
||||
usr.machine = null
|
||||
usr << browse(null, "window=air_alarm")
|
||||
usr << browse(null, "window=AAlarmwires")
|
||||
return
|
||||
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
if(..(href, href_list, nowindow, !remote))
|
||||
return 1
|
||||
|
||||
// hrefs that can always be called -walter0o
|
||||
if(href_list["rcon"])
|
||||
@@ -798,18 +646,19 @@ table tr:first-child th:first-child { border: none;}
|
||||
rcon_setting = RCON_AUTO
|
||||
if(RCON_YES)
|
||||
rcon_setting = RCON_YES
|
||||
else
|
||||
return
|
||||
return 1
|
||||
|
||||
if(href_list["temperature"])
|
||||
var/list/selected = TLV["temperature"]
|
||||
var/max_temperature = min(selected[3] - T0C, MAX_TEMPERATURE)
|
||||
var/min_temperature = max(selected[2] - T0C, MIN_TEMPERATURE)
|
||||
var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature]C and [max_temperature]C)", "Thermostat Controls") as num|null
|
||||
if(!input_temperature || input_temperature > max_temperature || input_temperature < min_temperature)
|
||||
usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
|
||||
else
|
||||
target_temperature = input_temperature + T0C
|
||||
var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature] and [max_temperature]C)", "Thermostat Controls", target_temperature - T0C) as num|null
|
||||
if(isnum(input_temperature))
|
||||
if(input_temperature > max_temperature || input_temperature < min_temperature)
|
||||
usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
|
||||
else
|
||||
target_temperature = input_temperature + T0C
|
||||
return 1
|
||||
|
||||
// hrefs that need the AA unlocked -walter0o
|
||||
if(!locked || remote || istype(usr, /mob/living/silicon))
|
||||
@@ -817,9 +666,18 @@ table tr:first-child th:first-child { border: none;}
|
||||
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",
|
||||
"o2_scrub",
|
||||
"n2_scrub",
|
||||
@@ -830,6 +688,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
"scrubbing")
|
||||
|
||||
send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) )
|
||||
return 1
|
||||
|
||||
if("set_threshold")
|
||||
var/env = href_list["env"]
|
||||
@@ -838,7 +697,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
var/list/thresholds = list("lower bound", "low warning", "high warning", "upper bound")
|
||||
var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null|num
|
||||
if (isnull(newval))
|
||||
return
|
||||
return 1
|
||||
if (newval<0)
|
||||
selected[threshold] = -1.0
|
||||
else if (env=="temperature" && newval>5000)
|
||||
@@ -880,9 +739,11 @@ table tr:first-child th:first-child { border: none;}
|
||||
selected[3] = selected[4]
|
||||
|
||||
apply_mode()
|
||||
return 1
|
||||
|
||||
if(href_list["screen"])
|
||||
screen = text2num(href_list["screen"])
|
||||
return 1
|
||||
|
||||
if(href_list["atmos_unlock"])
|
||||
switch(href_list["atmos_unlock"])
|
||||
@@ -890,24 +751,24 @@ table tr:first-child th:first-child { border: none;}
|
||||
alarm_area.air_doors_close()
|
||||
if("1")
|
||||
alarm_area.air_doors_open()
|
||||
return 1
|
||||
|
||||
if(href_list["atmos_alarm"])
|
||||
if (alarm_area.atmosalert(2))
|
||||
apply_danger_level(2)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
if(href_list["atmos_reset"])
|
||||
if (alarm_area.atmosalert(0))
|
||||
apply_danger_level(0)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
if(href_list["mode"])
|
||||
mode = text2num(href_list["mode"])
|
||||
apply_mode()
|
||||
|
||||
if(!nowindow)
|
||||
updateUsrDialog()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/alarm/attackby(obj/item/W as obj, mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
@@ -937,7 +798,6 @@ table tr:first-child th:first-child { border: none;}
|
||||
if(allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
|
||||
locked = !locked
|
||||
user << "\blue You [ locked ? "lock" : "unlock"] the Air Alarm interface."
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
|
||||
213
nano/templates/air_alarm.tmpl
Normal file
213
nano/templates/air_alarm.tmpl
Normal file
@@ -0,0 +1,213 @@
|
||||
<!--
|
||||
Title: Air Alarm
|
||||
Used In File(s): \code\game\machinery\alarm.dm
|
||||
|
||||
#define AALARM_MODE_SCRUBBING 1
|
||||
#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster.
|
||||
#define AALARM_MODE_PANIC 3 //constantly sucks all air
|
||||
#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and switches to scrubbing
|
||||
#define AALARM_MODE_FILL 5 //emergency fill
|
||||
#define AALARM_MODE_OFF 6 //Shuts it all down.
|
||||
|
||||
#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
|
||||
|
||||
-->
|
||||
<H1>Air Status</H1>
|
||||
{{if data.has_environment}}
|
||||
{{for data.environment}}
|
||||
{{:value.name}}:
|
||||
{{if value.danger_level == 2}}
|
||||
<span class='bad'>
|
||||
{{else value.danger_level == 1}}
|
||||
<span class='average'>
|
||||
{{else}}
|
||||
<span class='good'>
|
||||
{{/if}}
|
||||
{{:helper.fixed(value.value, 1)}}
|
||||
</span>{{:value.unit}}<br>
|
||||
{{/for}}
|
||||
Local Status: {{if value.danger_level == 2}}
|
||||
<span class='bad'>DANGER: Internals Required
|
||||
{{else value.danger_level == 1}}
|
||||
<span class='average'>Caution
|
||||
{{else}}
|
||||
<span class='good'>Optimal
|
||||
{{/if}}
|
||||
</span><br>
|
||||
Area Status: {{if data.atmos_alarm}}<span class='bad'>Atmosphere alert in area</span>{{else data.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}}
|
||||
<HR>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<tr>
|
||||
<td>
|
||||
<H3>Remote Control</H3>
|
||||
</td>
|
||||
<td>
|
||||
<H3>Thermostat</H3>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="item">
|
||||
<div class="itemContent" style="width: 100%;">
|
||||
{{:helper.link('Off', null, { 'rcon' : 1}, null, data.rcon == 1 ? 'selected' : null)}}
|
||||
{{:helper.link('Auto', null, { 'rcon' : 2}, null, data.rcon == 2 ? 'selected' : null)}}
|
||||
{{:helper.link('On', null, { 'rcon' : 3}, null, data.rcon == 3 ? 'selected' : null)}}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{:helper.link(data.target_temperature, null, { 'temperature' : 1})}}
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<HR>
|
||||
{{if data.locked}}
|
||||
<span class='noticePlaceholder'>(Swipe ID card to unlock interface)</span>
|
||||
{{else}}
|
||||
{{if data.screen != 1}}
|
||||
<div class="item">{{:helper.link('Main Menu', null, { 'screen' : 1})}}</div>
|
||||
{{/if}}
|
||||
{{if data.screen == 1}}
|
||||
<div class="item">
|
||||
{{if data.atmos_alarm}}
|
||||
{{:helper.link('Reset - Area Atmospheric Alarm', null, { 'atmos_reset' : 1})}}
|
||||
{{else}}
|
||||
{{:helper.link('Activate - Area Atmospheric Alarm', null, { 'atmos_alarm' : 1})}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<hr>
|
||||
<div class="item">
|
||||
{{:helper.link('Scrubbers Control', null, { 'screen' : 3})}}
|
||||
</div>
|
||||
<div class="item">
|
||||
{{:helper.link('Vents Control', null, { 'screen' : 2})}}
|
||||
</div>
|
||||
<div class="item">
|
||||
{{:helper.link('Set Environmental Mode', null, { 'screen' : 4})}}
|
||||
</div>
|
||||
<div class="item">
|
||||
{{:helper.link('Sensor Settings', null, { 'screen' : 5})}}
|
||||
</div>
|
||||
<hr>
|
||||
{{if data.mode==3}}
|
||||
{{:helper.link('PANIC SIPHON ACTIVE - Turn siphoning off', null, { 'mode' : 1}, null, 'redButton')}}
|
||||
{{else}}
|
||||
{{:helper.link('ACTIVATE PANIC SIPHON IN AREA', null, { 'mode' : 3}, null, 'yellowButton')}}
|
||||
{{/if}}
|
||||
{{else data.screen == 2}}
|
||||
{{for data.vents}}
|
||||
<div class="item">
|
||||
{{:value.long_name}}</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Operating:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:helper.link(value.power ? 'On' : 'Off', null, { 'id_tag' : value.id_tag, 'command' : 'power', 'val' : value.power ? 0 : 1}, null, value.power ? null : 'redButton')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Operation Mode:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:value.direction == "siphon" ? 'Siphoning' : 'Pressurizing'}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Pressure Checks:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:helper.link('External', null, { 'id_tag' : value.id_tag, 'command' : 'checks', 'val' : value.checks^1}, null, value.checks&1 ? 'selected' : null)}}
|
||||
{{:helper.link('Internal', null, { 'id_tag' : value.id_tag, 'command' : 'checks', 'val' : value.checks^2}, null, value.checks&2 ? 'selected' : null)}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
External Pressure Bound:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:helper.link(helper.fixed(value.external,2), null, { 'id_tag' : value.id_tag, 'command' : 'set_external_pressure'})}}
|
||||
{{:helper.link('Reset', null, { 'id_tag' : value.id_tag, 'command' : 'reset_external_pressure'})}}
|
||||
</div>
|
||||
</div>
|
||||
<HR>
|
||||
{{empty}}
|
||||
No vents connected.
|
||||
{{/for}}
|
||||
{{else data.screen == 3}}
|
||||
{{for data.scrubbers}}
|
||||
<div class="item">
|
||||
{{:value.long_name}}</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Operating:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:helper.link(value.power ? 'On' : 'Off', null, { 'id_tag' : value.id_tag, 'command' : 'power', 'val' : value.power ? 0 : 1}, null, value.power ? null : 'redButton')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Operation Mode:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{:helper.link(value.scrubbing ? 'Scrubbing' : 'Siphoning', null, { 'id_tag' : value.id_tag, 'command' : 'scrubbing', 'val' : value.scrubbing ? 0 : 1}, null, value.scrubbing ? null : 'redButton')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Filters:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{for value.filters :filterValue:filterIndex}}
|
||||
{{:helper.link(filterValue.name, null, { 'id_tag' : value.id_tag, 'command' : filterValue.command, 'val' : filterValue.val ? 0 : 1}, null, filterValue.val ? 'selected' : null)}}
|
||||
{{/for}}
|
||||
</div>
|
||||
</div>
|
||||
<HR>
|
||||
{{empty}}
|
||||
No scrubbers connected.
|
||||
{{/for}}
|
||||
{{else data.screen == 4}}
|
||||
<H3>Environmental Modes</H3>
|
||||
{{for data.modes}}
|
||||
<div class="item">
|
||||
{{:helper.link(value.name, null, { 'mode' : value.mode }, null, value.selected ? (value.danger ? 'redButton' : 'selected') : null)}}
|
||||
</div>
|
||||
{{/for}}
|
||||
{{else data.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 data.thresholds}}
|
||||
<tr>
|
||||
<td>{{:value.name}}</td>
|
||||
{{for value.settings :settingsValue:settingsIndex}}
|
||||
<td>
|
||||
{{:helper.link(settingsValue.selected >= 0 ? helper.fixed(settingsValue.selected, 2) : "Off", null, { 'command' : 'set_threshold', 'env' : settingsValue.env, 'var' : settingsValue.val })}}
|
||||
</td>
|
||||
{{/for}}
|
||||
</tr>
|
||||
{{/for}}
|
||||
<table>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user