mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-17 18:13:34 +01:00
Nano UI for Air Alarms
This commit is contained in:
@@ -5,16 +5,37 @@
|
||||
/obj/machinery/computer/atmoscontrol
|
||||
name = "\improper Central Atmospherics Computer"
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "computer_generic"
|
||||
icon_state = "tank"
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
circuit = "/obj/item/weapon/circuitboard/atmoscontrol"
|
||||
var/obj/machinery/alarm/current
|
||||
var/list/filter=null
|
||||
var/overridden = 0 //not set yet, can't think of a good way to do it
|
||||
req_access = list(access_ce)
|
||||
req_one_access = list(access_ce)
|
||||
|
||||
/*
|
||||
/obj/machinery/computer/atmoscontrol/xeno
|
||||
name = "\improper Xenobiology Atmospherics Computer"
|
||||
filter=list(
|
||||
/area/toxins/xenobiology/specimen_1,
|
||||
/area/toxins/xenobiology/specimen_2,
|
||||
/area/toxins/xenobiology/specimen_3,
|
||||
/area/toxins/xenobiology/specimen_4,
|
||||
/area/toxins/xenobiology/specimen_5,
|
||||
/area/toxins/xenobiology/specimen_6)
|
||||
req_one_access = list(access_xenobiology,access_ce)
|
||||
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/gas_chamber
|
||||
name = "\improper Gas Chamber Atmospherics Computer"
|
||||
filter=list(
|
||||
/area/security/gas_chamber)
|
||||
req_one_access = list(access_ce,access_hos)
|
||||
*/
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/attack_ai(var/mob/user as mob)
|
||||
src.add_hiddenprint(user)
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/attack_paw(var/mob/user as mob)
|
||||
@@ -35,7 +56,9 @@
|
||||
if(current)
|
||||
dat += specific()
|
||||
else
|
||||
for(var/obj/machinery/alarm/alarm in machines)
|
||||
for(var/obj/machinery/alarm/alarm in sortAtom(machines))
|
||||
if(!is_in_filter(alarm.alarm_area.type))
|
||||
continue // NO ACCESS 4 U
|
||||
dat += "<a href='?src=\ref[src]&alarm=\ref[alarm]'>"
|
||||
switch(max(alarm.danger_level, alarm.alarm_area.atmosalm))
|
||||
if (0)
|
||||
@@ -57,11 +80,16 @@
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/proc/is_in_filter(var/typepath)
|
||||
if(!filter) return 1 // YEP. TOTALLY.
|
||||
return typepath in filter
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/proc/specific()
|
||||
if(!current)
|
||||
return ""
|
||||
var/dat = "<h3>[current.name]</h3><hr>"
|
||||
dat += current.return_status()
|
||||
//dat += current.return_status()
|
||||
if(current.remote_control || overridden)
|
||||
dat += "<hr>[return_controls()]"
|
||||
return dat
|
||||
@@ -84,10 +112,19 @@
|
||||
"co2_scrub",
|
||||
"tox_scrub",
|
||||
"n2o_scrub",
|
||||
"o2_scrub",
|
||||
"panic_siphon",
|
||||
"scrubbing"
|
||||
)
|
||||
current.send_signal(device_id, list (href_list["command"] = text2num(href_list["val"])))
|
||||
var/val
|
||||
if(href_list["val"])
|
||||
val=text2num(href_list["val"])
|
||||
else
|
||||
var/newval = input("Enter new value") as num|null
|
||||
if(isnull(newval))
|
||||
return
|
||||
val = newval
|
||||
current.send_signal(device_id, list (href_list["command"] = val))
|
||||
spawn(3)
|
||||
src.updateUsrDialog()
|
||||
//if("adjust_threshold") //was a good idea but required very wide window
|
||||
@@ -184,6 +221,26 @@
|
||||
spawn(5)
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
if(href_list["preset"])
|
||||
current.preset = text2num(href_list["preset"])
|
||||
current.apply_preset()
|
||||
spawn(5)
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
if(href_list["temperature"])
|
||||
var/list/selected = current.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==null)
|
||||
return
|
||||
if(input_temperature > max_temperature || input_temperature < min_temperature)
|
||||
usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
|
||||
else
|
||||
current.target_temperature = input_temperature + T0C
|
||||
return
|
||||
updateUsrDialog()
|
||||
|
||||
//copypasta from alarm code, changed to work with this without derping hard
|
||||
@@ -192,13 +249,14 @@
|
||||
var/label=replacetext(uppertext(code),"2","<sub>2</sub>")
|
||||
if(code=="tox")
|
||||
label="Plasma"
|
||||
return "<A href='?src=\ref[current];id_tag=[id_tag];command=[code]_scrub;val=[!data["filter_"+code]]' class='scrub[data["filter_"+code]]'>[label]</A>"
|
||||
return "<A href='?src=\ref[src];alarm=\ref[current];id_tag=[id_tag];command=[code]_scrub;val=[!data["filter_"+code]]' class='scrub[data["filter_"+code]]'>[label]</A>"
|
||||
|
||||
/obj/machinery/computer/atmoscontrol/proc/return_controls()
|
||||
var/output = ""//"<B>[alarm_zone] Air [name]</B><HR>"
|
||||
|
||||
switch(current.screen)
|
||||
if (AALARM_SCREEN_MAIN)
|
||||
output += "<table width=\"100%\"><td align=\"center\"><b>Thermostat:</b><br><a href='?src=\ref[src];alarm=\ref[current];temperature=1'>[current.target_temperature - T0C]C</a></td></table>"
|
||||
if(current.alarm_area.atmosalm)
|
||||
output += {"<a href='?src=\ref[src];alarm=\ref[current];atmos_reset=1'>Reset - Atmospheric Alarm</a><hr>"}
|
||||
else
|
||||
@@ -216,7 +274,7 @@
|
||||
else
|
||||
output += "<A href='?src=\ref[src];alarm=\ref[current];mode=[AALARM_MODE_PANIC]'><font color='red'><B>ACTIVATE PANIC SYPHON IN AREA</B></font></A>"
|
||||
|
||||
output += "<br><br>Atmospheric Lockdown: <a href='?src=\ref[src];alarm=\ref[current];atmos_unlock=[current.alarm_area.air_doors_activated]'>[current.alarm_area.air_doors_activated ? "<b>ENABLED</b>" : "Disabled"]</a>"
|
||||
//output += "<br><br>Atmospheric Lockdown: <a href='?src=\ref[src];alarm=\ref[current];atmos_unlock=[current.alarm_area.air_doors_activated]'>[current.alarm_area.air_doors_activated ? "<b>ENABLED</b>" : "Disabled"]</a>"
|
||||
if (AALARM_SCREEN_VENT)
|
||||
var/sensor_data = ""
|
||||
if(current.alarm_area.air_vent_names.len)
|
||||
@@ -314,21 +372,21 @@ siphoning
|
||||
output += {"<li><A href='?src=\ref[src];alarm=\ref[current];mode=[m]'><b>[modes[m]]</b></A> (selected)</li>"}
|
||||
else
|
||||
output += {"<li><A href='?src=\ref[src];alarm=\ref[current];mode=[m]'>[modes[m]]</A></li>"}
|
||||
output += {"</ul>
|
||||
<hr><br><b>Sensor presets:</b><br><i>(Note, this only sets sensors, air supplied to vents must still be changed.)</i><ul>"}
|
||||
var/list/presets = list(
|
||||
AALARM_PRESET_HUMAN = "Human - Checks for Oxygen and Nitrogen",\
|
||||
AALARM_PRESET_VOX = "Vox - Checks for Nitrogen only",\
|
||||
AALARM_PRESET_SERVER = "Coldroom - For server rooms and freezers")
|
||||
for(var/p=1;p<=presets.len;p++)
|
||||
if (current.preset==p)
|
||||
output += "<li><A href='?src=\ref[src];alarm=\ref[current];preset=[p]'><b>[presets[p]]</b></A> (selected)</li>"
|
||||
else
|
||||
output += "<li><A href='?src=\ref[src];alarm=\ref[current];preset=[p]'>[presets[p]]</A></li>"
|
||||
output += "</ul>"
|
||||
if (AALARM_SCREEN_SENSORS)
|
||||
output += {"
|
||||
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_MAIN]'>Main menu</a><br>
|
||||
<hr><br><b>Sensor presets:</b><br><i>(Note, this only sets sensors, air supplied to vents must still be changed.)</i><ul>"}
|
||||
var/list/presets = list(
|
||||
AALARM_PRESET_HUMAN = "Human - Checks for Oxygen and Nitrogen",\
|
||||
AALARM_PRESET_VOX = "Vox - Checks for Nitrogen only",\
|
||||
AALARM_PRESET_SERVER = "Coldroom - For server rooms and freezers")
|
||||
for(var/p=1;p<=presets.len;p++)
|
||||
if (current.preset==p)
|
||||
output += "<li><A href='?src=\ref[current];preset=[p]'><b>[presets[p]]</b></A> (selected)</li>"
|
||||
else
|
||||
output += "<li><A href='?src=\ref[current];preset=[p]'>[presets[p]]</A></li>"
|
||||
output += {"</ul>
|
||||
<b>Alarm thresholds:</b><br>
|
||||
Partial pressure for gases
|
||||
<style>/* some CSS woodoo here. Does not work perfect in ie6 but who cares? */
|
||||
@@ -367,8 +425,11 @@ table tr:first-child th:first-child { border: none;}
|
||||
output += "<TR><th>Temperature</th>"
|
||||
for (var/i = 1, i <= 4, i++)
|
||||
output += "<td><A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=temperature;var=[i]'>[tlv[i]>= 0?tlv[i]:"OFF"]</A></td>"
|
||||
output += "</TR>"
|
||||
output += "</table>"
|
||||
|
||||
// AUTOFIXED BY fix_string_idiocy.py
|
||||
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Mini\atmos_control.dm:357: output += "</TR>"
|
||||
output += {"</TR>
|
||||
</table>"}
|
||||
// END AUTOFIX
|
||||
return output
|
||||
//---END COPYPASTA----
|
||||
|
||||
+214
-41
@@ -87,6 +87,10 @@
|
||||
var/AAlarmwires = 31
|
||||
var/shorted = 0
|
||||
|
||||
// Waiting on a device to respond.
|
||||
// Specifies an id_tag. NULL means we aren't waiting.
|
||||
var/waiting_on_device=null
|
||||
|
||||
var/mode = AALARM_MODE_SCRUBBING
|
||||
var/preset = AALARM_PRESET_HUMAN
|
||||
var/screen = AALARM_SCREEN_MAIN
|
||||
@@ -108,36 +112,39 @@
|
||||
..()
|
||||
req_access = list(access_rd, access_atmospherics, access_engine_equip)
|
||||
preset = AALARM_PRESET_SERVER
|
||||
apply_preset()
|
||||
apply_preset(1)
|
||||
|
||||
|
||||
/obj/machinery/alarm/vox/New()
|
||||
..()
|
||||
req_access = list()
|
||||
preset = AALARM_PRESET_VOX
|
||||
apply_preset()
|
||||
apply_preset(1)
|
||||
|
||||
/obj/machinery/alarm/proc/apply_preset()
|
||||
/obj/machinery/alarm/proc/apply_preset(var/no_cycle_after=0)
|
||||
|
||||
TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
|
||||
TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
|
||||
TLV["nitrogen"] = list(-1, -1, -1, -1) // Partial pressure, kpa
|
||||
TLV["carbon_dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||
TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */
|
||||
TLV["temperature"] = list(T0C-26, T0C, T0C+40, T0C+66) // K
|
||||
TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */
|
||||
TLV["temperature"] = list(T0C-26, T0C, T0C+40, T0C+66) // K
|
||||
target_temperature = T0C+20
|
||||
switch(preset)
|
||||
if(AALARM_PRESET_VOX) // Same as usual, but without oxygen.
|
||||
TLV["oxygen"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["oxygen"] = list(-1.0, -1.0, 1, 5) // Partial pressure, kpa
|
||||
if(AALARM_PRESET_SERVER) // Cold as fuck.
|
||||
TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa
|
||||
TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||
TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
|
||||
TLV["temperature"] = list(20, 40, 140, 160) // K
|
||||
TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa
|
||||
TLV["carbon_dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||
TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
|
||||
TLV["temperature"] = list(20, 40, 140, 160) // K
|
||||
target_temperature = 90
|
||||
mode = AALARM_MODE_CYCLE
|
||||
apply_mode()
|
||||
if(!no_cycle_after)
|
||||
mode = AALARM_MODE_CYCLE
|
||||
apply_mode()
|
||||
|
||||
|
||||
/obj/machinery/alarm/New(var/loc, var/dir, var/building = 0)
|
||||
@@ -172,7 +179,8 @@
|
||||
|
||||
// breathable air according to human/Life()
|
||||
TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
|
||||
TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["nitrogen"] = list(-1, -1, -1, -1) // Partial pressure, kpa
|
||||
TLV["carbon_dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa
|
||||
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||
TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */
|
||||
@@ -233,7 +241,6 @@
|
||||
|
||||
var/old_level = danger_level
|
||||
danger_level = overall_danger_level()
|
||||
|
||||
if(danger_level < old_level)
|
||||
danger_averted_confidence++
|
||||
// Only change danger level if:
|
||||
@@ -260,7 +267,6 @@
|
||||
remote_control = 0
|
||||
if(RCON_YES)
|
||||
remote_control = 1
|
||||
|
||||
if(screen == AALARM_SCREEN_MAIN)
|
||||
updateDialog()
|
||||
return
|
||||
@@ -279,7 +285,8 @@
|
||||
|
||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, TLV["oxygen"])
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, TLV["carbon dioxide"])
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.nitrogen*partial_pressure, TLV["nitrogen"])
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, TLV["carbon_dioxide"])
|
||||
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, TLV["plasma"])
|
||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
|
||||
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
|
||||
@@ -288,6 +295,7 @@
|
||||
pressure_dangerlevel,
|
||||
oxygen_dangerlevel,
|
||||
co2_dangerlevel,
|
||||
nitrogen_dangerlevel,
|
||||
plasma_dangerlevel,
|
||||
other_dangerlevel,
|
||||
temperature_dangerlevel
|
||||
@@ -349,10 +357,16 @@
|
||||
var/dev_type = signal.data["device"]
|
||||
if(!(id_tag in alarm_area.air_scrub_names) && !(id_tag in alarm_area.air_vent_names))
|
||||
register_env_machine(id_tag, dev_type)
|
||||
var/got_update=0
|
||||
if(dev_type == "AScr")
|
||||
alarm_area.air_scrub_info[id_tag] = signal.data
|
||||
got_update=1
|
||||
else if(dev_type == "AVP")
|
||||
alarm_area.air_vent_info[id_tag] = signal.data
|
||||
got_update=1
|
||||
if(got_update && waiting_on_device==id_tag)
|
||||
updateUsrDialog()
|
||||
waiting_on_device=null
|
||||
|
||||
/obj/machinery/alarm/proc/register_env_machine(var/m_id, var/device_type)
|
||||
var/new_name
|
||||
@@ -668,7 +682,14 @@
|
||||
///////////////
|
||||
|
||||
/obj/machinery/alarm/attack_ai(mob/user)
|
||||
return interact(user)
|
||||
src.add_hiddenprint(user)
|
||||
return ui_interact(user)
|
||||
|
||||
/obj/machinery/alarm/attack_robot(mob/user)
|
||||
// if(isMoMMI(user) && wiresexposed)
|
||||
// return interact(user)
|
||||
// else
|
||||
return attack_ai(user)
|
||||
|
||||
/obj/machinery/alarm/attack_hand(mob/user)
|
||||
. = ..()
|
||||
@@ -676,6 +697,140 @@
|
||||
return
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/alarm/proc/ui_air_status()
|
||||
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
|
||||
if(total==0)
|
||||
return null
|
||||
|
||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||
|
||||
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["oxygen"]
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.oxygen / total * 100, 2)
|
||||
|
||||
current_settings = TLV["nitrogen"]
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.nitrogen*partial_pressure, current_settings)
|
||||
var/nitrogen_percent = round(environment.nitrogen / total * 100, 2)
|
||||
|
||||
current_settings = TLV["carbon_dioxide"]
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.carbon_dioxide / total * 100, 2)
|
||||
|
||||
current_settings = TLV["plasma"]
|
||||
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, current_settings)
|
||||
var/plasma_percent = round(environment.toxins / 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)
|
||||
|
||||
|
||||
var/data[0]
|
||||
data["pressure"]=environment_pressure
|
||||
data["temperature"]=environment.temperature
|
||||
data["temperature_c"]=round(environment.temperature - T0C, 0.1)
|
||||
|
||||
var/percentages[0]
|
||||
percentages["oxygen"]=oxygen_percent
|
||||
percentages["nitrogen"]=nitrogen_percent
|
||||
percentages["co2"]=co2_percent
|
||||
percentages["plasma"]=plasma_percent
|
||||
percentages["other"]=other_moles
|
||||
data["contents"]=percentages
|
||||
|
||||
var/danger[0]
|
||||
danger["pressure"]=pressure_dangerlevel
|
||||
danger["temperature"]=temperature_dangerlevel
|
||||
danger["oxygen"]=oxygen_dangerlevel
|
||||
danger["nitrogen"]=nitrogen_dangerlevel
|
||||
danger["co2"]=co2_dangerlevel
|
||||
danger["plasma"]=plasma_dangerlevel
|
||||
danger["other"]=other_dangerlevel
|
||||
danger["overall"]=max(pressure_dangerlevel,oxygen_dangerlevel,nitrogen_dangerlevel,co2_dangerlevel,plasma_dangerlevel,other_dangerlevel,temperature_dangerlevel)
|
||||
data["danger"]=danger
|
||||
return data
|
||||
|
||||
|
||||
/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
if(user.stat)
|
||||
return
|
||||
var/data[0]
|
||||
data["air"]=ui_air_status()
|
||||
data["sensors"]=TLV
|
||||
data["locked"]=(!(istype(user, /mob/living/silicon)) && locked)
|
||||
data["rcon"]=rcon_setting
|
||||
data["target_temp"] = target_temperature - T0C
|
||||
data["atmos_alarm"] = alarm_area.atmosalm
|
||||
data["modes"] = list(
|
||||
AALARM_MODE_SCRUBBING = list("name"="Filtering","desc"="Scrubs out contaminants"),\
|
||||
AALARM_MODE_REPLACEMENT = list("name"="Replace Air","desc"="Siphons out air while replacing"),\
|
||||
AALARM_MODE_PANIC = list("name"="Panic","desc"="Siphons air out of the room"),\
|
||||
AALARM_MODE_CYCLE = list("name"="Cycle","desc"="Siphons air before replacing"),\
|
||||
AALARM_MODE_FILL = list("name"="Fill","desc"="Shuts off scrubbers and opens vents"),\
|
||||
AALARM_MODE_OFF = list("name"="Off","desc"="Shuts off vents and scrubbers"))
|
||||
data["mode"]=mode
|
||||
data["presets"]=list(
|
||||
AALARM_PRESET_HUMAN = list("name"="Human","desc"="Checks for Oxygen and Nitrogen"),\
|
||||
AALARM_PRESET_VOX = list("name"="Vox","desc"="Checks for Nitrogen only"),\
|
||||
AALARM_PRESET_SERVER = list("name"="Coldroom","desc"="For server rooms and freezers"))
|
||||
data["preset"]=preset
|
||||
data["screen"]=screen
|
||||
|
||||
var/list/vents=list()
|
||||
if(alarm_area.air_vent_names.len)
|
||||
for(var/id_tag in alarm_area.air_vent_names)
|
||||
var/vent_info[0]
|
||||
var/long_name = alarm_area.air_vent_names[id_tag]
|
||||
var/list/vent_data = alarm_area.air_vent_info[id_tag]
|
||||
if(!vent_data)
|
||||
continue
|
||||
vent_info["id_tag"]=id_tag
|
||||
vent_info["name"]=long_name
|
||||
vent_info += vent_data
|
||||
vents+=list(vent_info)
|
||||
data["vents"]=vents
|
||||
|
||||
var/list/scrubbers=list()
|
||||
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/scrubber_data = alarm_area.air_scrub_info[id_tag]
|
||||
if(!scrubber_data)
|
||||
continue
|
||||
scrubber_data["id_tag"]=id_tag
|
||||
scrubber_data["name"]=long_name
|
||||
scrubbers+=list(scrubber_data)
|
||||
data["scrubbers"]=scrubbers
|
||||
|
||||
if (!ui) // no ui has been passed, so we'll search for one
|
||||
{
|
||||
ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
}
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new one
|
||||
ui = new(user, src, ui_key, "air_alarm.tmpl", name, 550, 410)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
// Auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
// The UI is already open so push the new data to it
|
||||
ui.push_data(data)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/alarm/interact(mob/user)
|
||||
user.set_machine(src)
|
||||
|
||||
@@ -719,13 +874,11 @@
|
||||
t1 += text("<p><a href='?src=\ref[src];close2=1'>Close</a></p></body></html>")
|
||||
user << browse(t1, "window=AAlarmwires")
|
||||
onclose(user, "AAlarmwires")
|
||||
|
||||
if(!shorted)
|
||||
user << browse(return_text(user),"window=air_alarm")
|
||||
onclose(user, "air_alarm")
|
||||
ui_interact(user)
|
||||
|
||||
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>"
|
||||
@@ -762,7 +915,7 @@
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.oxygen / total * 100, 2)
|
||||
|
||||
current_settings = TLV["carbon dioxide"]
|
||||
current_settings = TLV["carbon_dioxide"]
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.carbon_dioxide / total * 100, 2)
|
||||
|
||||
@@ -950,22 +1103,22 @@ siphoning
|
||||
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><br>
|
||||
output += {"</ul>
|
||||
<hr><br><b>Sensor presets:</b><br><i>(Note, this only sets sensors, air supplied to vents must still be changed.)</i><ul>"}
|
||||
var/list/presets = list(
|
||||
AALARM_PRESET_HUMAN = "Human - Checks for Oxygen and Nitrogen",\
|
||||
AALARM_PRESET_VOX = "Vox - Checks for Nitrogen only",\
|
||||
AALARM_PRESET_SERVER = "Coldroom - For server rooms and freezers")
|
||||
AALARM_PRESET_VOX = "Vox - Checks for Nitrogen only",\
|
||||
AALARM_PRESET_SERVER = "Coldroom - For server rooms and freezers")
|
||||
for(var/p=1;p<=presets.len;p++)
|
||||
if (preset==p)
|
||||
output += "<li><A href='?src=\ref[src];preset=[p]'><b>[presets[p]]</b></A> (selected)</li>"
|
||||
else
|
||||
output += "<li><A href='?src=\ref[src];preset=[p]'>[presets[p]]</A></li>"
|
||||
output += {"</ul>
|
||||
output += "</ul>"
|
||||
|
||||
if (AALARM_SCREEN_SENSORS)
|
||||
output += {"
|
||||
<a href='?src=\ref[src];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? */
|
||||
@@ -981,7 +1134,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
"}
|
||||
var/list/gases = list(
|
||||
"oxygen" = "O<sub>2</sub>",
|
||||
"carbon dioxide" = "CO<sub>2</sub>",
|
||||
"carbon_dioxide" = "CO<sub>2</sub>",
|
||||
"plasma" = "Toxin",
|
||||
"other" = "Other",)
|
||||
|
||||
@@ -1006,6 +1159,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
output += "</TR></table>"
|
||||
|
||||
return output
|
||||
*/
|
||||
|
||||
/obj/machinery/alarm/Topic(href, href_list)
|
||||
var/changed=0
|
||||
@@ -1024,6 +1178,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
add_fingerprint(usr)
|
||||
usr.machine = src
|
||||
|
||||
//testing(href)
|
||||
if(href_list["command"])
|
||||
var/device_id = href_list["id_tag"]
|
||||
switch(href_list["command"])
|
||||
@@ -1037,9 +1192,23 @@ table tr:first-child th:first-child { border: none;}
|
||||
"o2_scrub",
|
||||
"panic_siphon",
|
||||
"scrubbing")
|
||||
var/val
|
||||
if(href_list["val"])
|
||||
val=text2num(href_list["val"])
|
||||
else
|
||||
var/newval = input("Enter new value") as num|null
|
||||
if(isnull(newval))
|
||||
return
|
||||
if(href_list["command"]=="set_external_pressure")
|
||||
if(newval>1000+ONE_ATMOSPHERE)
|
||||
newval = 1000+ONE_ATMOSPHERE
|
||||
if(newval<0)
|
||||
newval = 0
|
||||
val = newval
|
||||
|
||||
send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) )
|
||||
changed=1
|
||||
send_signal(device_id, list(href_list["command"] = val ) )
|
||||
changed=0 // We wait for the device to reply.
|
||||
waiting_on_device=device_id
|
||||
|
||||
if("set_threshold")
|
||||
var/env = href_list["env"]
|
||||
@@ -1096,15 +1265,16 @@ table tr:first-child th:first-child { border: none;}
|
||||
var/prevscreen=screen
|
||||
screen = text2num(href_list["screen"])
|
||||
changed=(prevscreen!=screen)
|
||||
/* Unused
|
||||
|
||||
/* Unused
|
||||
if(href_list["atmos_unlock"])
|
||||
switch(href_list["atmos_unlock"])
|
||||
if("0")
|
||||
air_doors_close(1)
|
||||
if("1")
|
||||
air_doors_open(1)
|
||||
changed=1
|
||||
*/
|
||||
changed=1
|
||||
*/
|
||||
|
||||
if(href_list["atmos_alarm"])
|
||||
if (alarm_area.atmosalert(2))
|
||||
@@ -1133,6 +1303,8 @@ table tr:first-child th:first-child { border: none;}
|
||||
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==null)
|
||||
return
|
||||
if(!input_temperature || input_temperature > max_temperature || input_temperature < min_temperature)
|
||||
usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
|
||||
else
|
||||
@@ -1165,7 +1337,7 @@ table tr:first-child th:first-child { border: none;}
|
||||
return
|
||||
else
|
||||
pulse(t1)
|
||||
changed=1
|
||||
changed=1
|
||||
if(changed)
|
||||
updateUsrDialog()
|
||||
|
||||
@@ -1372,6 +1544,7 @@ FIRE ALARM
|
||||
return
|
||||
|
||||
/obj/machinery/firealarm/attack_ai(mob/user as mob)
|
||||
src.add_hiddenprint(user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/firealarm/bullet_act(BLAH)
|
||||
|
||||
@@ -11,7 +11,7 @@ nanoui is used to open and update nano browser uis
|
||||
#define STATUS_UPDATE 1 // ORANGE Visability
|
||||
#define STATUS_DISABLED 0 // RED Visability
|
||||
|
||||
/datum/nanoui
|
||||
/datum/nanoui
|
||||
// the user who opened this ui
|
||||
var/mob/user
|
||||
// the object this ui "belongs" to
|
||||
@@ -180,7 +180,7 @@ nanoui is used to open and update nano browser uis
|
||||
data["ui"] = list(
|
||||
"status" = status,
|
||||
"user" = list("name" = user.name)
|
||||
)
|
||||
)
|
||||
return data
|
||||
|
||||
/**
|
||||
@@ -348,7 +348,11 @@ nanoui is used to open and update nano browser uis
|
||||
if (width && height)
|
||||
window_size = "size=[width]x[height];"
|
||||
update_status(0)
|
||||
user << browse(get_html(), "window=[window_id];[window_size][window_options]")
|
||||
var/html=get_html()
|
||||
var/f = file("nano/debug.html")
|
||||
fdel(f)
|
||||
f << html
|
||||
user << browse(html, "window=[window_id];[window_size][window_options]")
|
||||
on_close_winset()
|
||||
//onclose(user, window_id)
|
||||
nanomanager.ui_opened(src)
|
||||
|
||||
Reference in New Issue
Block a user