/obj/item/weapon/circuitboard/atmoscontrol
name = "\improper Central Atmospherics Computer Circuitboard"
build_path = /obj/machinery/computer/atmoscontrol
/obj/machinery/computer/atmoscontrol
name = "\improper Central Atmospherics Computer"
icon = 'icons/obj/computer.dmi'
icon_state = "computer_generic"
density = 1
anchored = 1.0
circuit = "/obj/item/weapon/circuitboard/atmoscontrol"
var/obj/machinery/alarm/current
var/overridden = 0 //not set yet, can't think of a good way to do it
req_access = list(access_ce)
/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)
return interact(user)
/obj/machinery/computer/atmoscontrol/attack_hand(mob/user)
if(..())
return
return interact(user)
/obj/machinery/computer/atmoscontrol/interact(mob/user)
user.set_machine(src)
if(allowed(user))
overridden = 1
else if(!emagged)
overridden = 0
var/dat = "Main Menu
"
if(current)
dat += specific()
else
for(var/obj/machinery/alarm/alarm in machines)
dat += ""
switch(max(alarm.danger_level, alarm.alarm_area.atmosalm))
if (0)
dat += ""
if (1)
dat += ""
if (2)
dat += ""
dat += "[alarm]
"
user << browse(dat, "window=atmoscontrol")
/obj/machinery/computer/atmoscontrol/attackby(var/obj/item/I as obj, var/mob/user as mob)
if(istype(I, /obj/item/weapon/card/emag) && !emagged)
user.visible_message("\red \The [user] swipes \a [I] through \the [src], causing the screen to flash!",\
"\red You swipe your [I] through \the [src], the screen flashing as you gain full control.",\
"You hear the swipe of a card through a reader, and an electronic warble.")
emagged = 1
overridden = 1
return
return ..()
/obj/machinery/computer/atmoscontrol/proc/specific()
if(!current)
return ""
var/dat = "[current.name]
"
dat += current.return_status()
if(current.remote_control || overridden)
dat += "
[return_controls()]"
return dat
//a bunch of this is copied from atmos alarms
/obj/machinery/computer/atmoscontrol/Topic(href, href_list)
if(..())
return
if(href_list["reset"])
current = null
if(href_list["alarm"])
current = locate(href_list["alarm"])
if(href_list["command"])
var/device_id = href_list["id_tag"]
switch(href_list["command"])
if(
"power",
"adjust_external_pressure",
"checks",
"co2_scrub",
"tox_scrub",
"n2o_scrub",
"panic_siphon",
"scrubbing"
)
current.send_signal(device_id, list (href_list["command"] = text2num(href_list["val"])))
spawn(3)
src.updateUsrDialog()
//if("adjust_threshold") //was a good idea but required very wide window
if("set_threshold")
var/env = href_list["env"]
var/threshold = text2num(href_list["var"])
var/list/selected = current.TLV[env]
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 num|null
if (isnull(newval) || ..() || (current.locked && issilicon(usr)))
return
if (newval<0)
selected[threshold] = -1.0
else if (env=="temperature" && newval>5000)
selected[threshold] = 5000
else if (env=="pressure" && newval>50*ONE_ATMOSPHERE)
selected[threshold] = 50*ONE_ATMOSPHERE
else if (env!="temperature" && env!="pressure" && newval>200)
selected[threshold] = 200
else
newval = round(newval,0.01)
selected[threshold] = newval
if(threshold == 1)
if(selected[1] > selected[2])
selected[2] = selected[1]
if(selected[1] > selected[3])
selected[3] = selected[1]
if(selected[1] > selected[4])
selected[4] = selected[1]
if(threshold == 2)
if(selected[1] > selected[2])
selected[1] = selected[2]
if(selected[2] > selected[3])
selected[3] = selected[2]
if(selected[2] > selected[4])
selected[4] = selected[2]
if(threshold == 3)
if(selected[1] > selected[3])
selected[1] = selected[3]
if(selected[2] > selected[3])
selected[2] = selected[3]
if(selected[3] > selected[4])
selected[4] = selected[3]
if(threshold == 4)
if(selected[1] > selected[4])
selected[1] = selected[4]
if(selected[2] > selected[4])
selected[2] = selected[4]
if(selected[3] > selected[4])
selected[3] = selected[4]
//Sets the temperature the built-in heater/cooler tries to maintain.
if(env == "temperature")
if(current.target_temperature < selected[2])
current.target_temperature = selected[2]
if(current.target_temperature > selected[3])
current.target_temperature = selected[3]
spawn(1)
updateUsrDialog()
return
if(href_list["screen"])
current.screen = text2num(href_list["screen"])
spawn(1)
src.updateUsrDialog()
return
if(href_list["atmos_unlock"])
switch(href_list["atmos_unlock"])
if("0")
current.air_doors_close(1)
if("1")
current.air_doors_open(1)
if(href_list["atmos_alarm"])
if (current.alarm_area.atmosalert(2))
current.apply_danger_level(2)
spawn(1)
src.updateUsrDialog()
current.update_icon()
return
if(href_list["atmos_reset"])
if (current.alarm_area.atmosalert(0))
current.apply_danger_level(0)
spawn(1)
src.updateUsrDialog()
current.update_icon()
return
if(href_list["mode"])
current.mode = text2num(href_list["mode"])
current.apply_mode()
spawn(5)
src.updateUsrDialog()
return
updateUsrDialog()
//copypasta from alarm code, changed to work with this without derping hard
//---START COPYPASTA----
/obj/machinery/computer/atmoscontrol/proc/return_controls()
var/output = ""//"[alarm_zone] Air [name]
"
switch(current.screen)
if (AALARM_SCREEN_MAIN)
if(current.alarm_area.atmosalm)
output += {"Reset - Atmospheric Alarm
"}
else
output += {"Activate - Atmospheric Alarm
"}
output += {"
Scrubbers Control
Vents Control
Set environmental mode
Sensor Control
"}
if (current.mode==AALARM_MODE_PANIC)
output += "PANIC SYPHON ACTIVE
turn syphoning off"
else
output += "ACTIVATE PANIC SYPHON IN AREA"
output += "
Atmospheric Lockdown: [current.alarm_area.air_doors_activated ? "ENABLED" : "Disabled"]"
if (AALARM_SCREEN_VENT)
var/sensor_data = ""
if(current.alarm_area.air_vent_names.len)
for(var/id_tag in current.alarm_area.air_vent_names)
var/long_name = current.alarm_area.air_vent_names[id_tag]
var/list/data = current.alarm_area.air_vent_info[id_tag]
var/state = ""
if(!data)
state = " can not be found!"
data = list("external" = 0) //for "0" instead of empty string
else if (data["timestamp"]+AALARM_REPORT_TIMEOUT < world.time)
state = " not responding!"
sensor_data += {"
[long_name][state]
Operating:
[data["power"]?"on":"off"]
Pressure checks:
external
internal
External pressure bound:
-
-
-
-
[data["external"]]
+
+
+
+
"}
if (data["direction"] == "siphon")
sensor_data += {"
Direction:
siphoning
"}
sensor_data += {"
"}
else
sensor_data = "No vents connected.
"
output = {"Main menu
[sensor_data]"}
if (AALARM_SCREEN_SCRUB)
var/sensor_data = ""
if(current.alarm_area.air_scrub_names.len)
for(var/id_tag in current.alarm_area.air_scrub_names)
var/long_name = current.alarm_area.air_scrub_names[id_tag]
var/list/data = current.alarm_area.air_scrub_info[id_tag]
var/state = ""
if(!data)
state = " can not be found!"
data = list("external" = 0) //for "0" instead of empty string
else if (data["timestamp"]+AALARM_REPORT_TIMEOUT < world.time)
state = " not responding!"
sensor_data += {"
[long_name][state]
Operating:
[data["power"]?"on":"off"]
Type:
[data["scrubbing"]?"scrubbing":"syphoning"]
"}
if(data["scrubbing"])
sensor_data += {"
Filtering:
Carbon Dioxide
[data["filter_co2"]?"on":"off"];
Toxins
[data["filter_toxins"]?"on":"off"];
Nitrous Oxide
[data["filter_n2o"]?"on":"off"]
"}
sensor_data += {"
Panic syphon: [data["panic"]?"PANIC SYPHON ACTIVATED":""]
Dea":"red'>A")]ctivate
"}
else
sensor_data = "No scrubbers connected.
"
output = {"Main menu
[sensor_data]"}
if (AALARM_SCREEN_MODE)
output += {"
Main menu
Air machinery mode for the area:"}
var/list/modes = list(AALARM_MODE_SCRUBBING = "Filtering - Scrubs out contaminants",\
AALARM_MODE_REPLACEMENT = "Replace Air - Siphons out air while replacing",\
AALARM_MODE_PANIC = "Panic - Siphons air out of the room",\
AALARM_MODE_CYCLE = "Cycle - Siphons air before replacing",\
AALARM_MODE_FILL = "Fill - Shuts off scrubbers and opens vents",\
AALARM_MODE_OFF = "Off - Shuts off vents and scrubbers",)
for (var/m=1,m<=modes.len,m++)
if (current.mode==m)
output += {"- [modes[m]] (selected)
"}
else
output += {"- [modes[m]]
"}
output += "
"
if (AALARM_SCREEN_SENSORS)
output += {"
Main menu
Alarm thresholds:
Partial pressure for gases
| min2 | min1 | max1 | max2 |
"}
var/list/gases = list(
"oxygen" = "O2",
"carbon dioxide" = "CO2",
"plasma" = "Toxin",
"other" = "Other",
)
var/list/tlv
for (var/g in gases)
output += "| [gases[g]] | "
tlv = current.TLV[g]
for (var/i = 1, i <= 4, i++)
output += "[tlv[i] >= 0?tlv[i]:"OFF"] | "
output += "
"
tlv = current.TLV["pressure"]
output += "| Pressure | "
for (var/i = 1, i <= 4, i++)
output += "[tlv[i]>= 0?tlv[i]:"OFF"] | "
output += "
"
tlv = current.TLV["temperature"]
output += "| Temperature | "
for (var/i = 1, i <= 4, i++)
output += "[tlv[i]>= 0?tlv[i]:"OFF"] | "
output += "
"
output += "
"
return output
//---END COPYPASTA----