WIP air alarms

This commit is contained in:
SkyMarshal
2012-06-09 00:55:09 -07:00
parent 94cd09fe4c
commit f953f78d73
9 changed files with 907 additions and 1140 deletions

View File

@@ -12,6 +12,7 @@
var/on = 0
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/pump_speed = 1 //Used to adjust speed for siphons
var/external_pressure_bound = ONE_ATMOSPHERE
var/internal_pressure_bound = 0
@@ -38,13 +39,13 @@
assign_uid()
id_tag = num2text(uid)
if(ticker && ticker.current_state == 3)//if the game is running
src.initialize()
src.broadcast_status()
initialize()
broadcast_status()
..()
high_volume
name = "Large Air Vent"
power_channel = EQUIP
New()
..()
air_contents.volume = 1000
@@ -69,7 +70,7 @@
return
if (!node)
on = 0
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
if(!on)
return 0
@@ -89,7 +90,7 @@
if(pressure_delta > 0)
if(air_contents.temperature > 0)
var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/transfer_moles = pressure_delta*environment.volume*environment.group_multiplier*pump_speed/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
@@ -107,7 +108,7 @@
if(pressure_delta > 0)
if(environment.temperature > 0)
var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/transfer_moles = pressure_delta*air_contents.volume*air_contents.group_multiplier*pump_speed/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
if (isnull(removed)) //in space
@@ -120,19 +121,11 @@
return 1
//Radio remote control
proc
set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
broadcast_status()
if(!radio_connection)
return 0
proc/broadcast_status()
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
@@ -147,23 +140,21 @@
"internal" = internal_pressure_bound,
"external" = external_pressure_bound,
"timestamp" = world.time,
"sigtype" = "status"
"sigtype" = "status",
"setting" = pump_speed
)
radio_connection.post_signal(src, signal, radio_filter_out)
var/area/alarm_area = get_area(src)
if(alarm_area.master.master_air_alarm && alarm_area.master.master_air_alarm.master_is_operating())
receive_signal(signal)
else
for(var/area/A in alarm_area.related)
for(var/obj/machinery/alarm/AA in A)
receive_signal(signal)
return 1
initialize()
..()
//some vents work his own spesial way
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
return
@@ -195,32 +186,16 @@
pump_direction = text2num(signal.data["direction"])
if("set_internal_pressure" in signal.data)
internal_pressure_bound = between(
0,
text2num(signal.data["set_internal_pressure"]),
ONE_ATMOSPHERE*50
)
internal_pressure_bound = between(0, text2num(signal.data["set_internal_pressure"]), ONE_ATMOSPHERE*50)
if("set_external_pressure" in signal.data)
external_pressure_bound = between(
0,
text2num(signal.data["set_external_pressure"]),
ONE_ATMOSPHERE*50
)
external_pressure_bound = between(0, text2num(signal.data["set_external_pressure"]), ONE_ATMOSPHERE*50)
if("adjust_internal_pressure" in signal.data)
internal_pressure_bound = between(
0,
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
ONE_ATMOSPHERE*50
)
internal_pressure_bound = between(0, text2num(signal.data["adjust_internal_pressure"]), ONE_ATMOSPHERE*50)
if("adjust_external_pressure" in signal.data)
external_pressure_bound = between(
0,
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
ONE_ATMOSPHERE*50
)
external_pressure_bound = between(0, text2num(signal.data["adjust_external_pressure"]), ONE_ATMOSPHERE*50)
if("init" in signal.data)
name = signal.data["init"]
@@ -231,6 +206,9 @@
broadcast_status()
return //do not update_icon
if("setting" in signal.data)
pump_speed = text2num(signal.data["setting"])
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2)
broadcast_status()
@@ -272,6 +250,7 @@
else
user << "\blue You need more welding fuel to complete this task."
return 1
examine()
set src in oview(1)
..()

View File

@@ -16,6 +16,7 @@
var/scrub_CO2 = 1
var/scrub_Toxins = 0
var/scrub_N2O = 0
var/scrub_rate = 1
var/volume_rate = 120
var/panic = 0 //is this scrubber panicked?
@@ -32,8 +33,8 @@
assign_uid()
id_tag = num2text(uid)
if(ticker && ticker.current_state == 3)//if the game is running
src.initialize()
src.broadcast_status()
initialize()
broadcast_status()
..()
update_icon()
@@ -46,16 +47,7 @@
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
return
proc
set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
broadcast_status()
if(!radio_connection)
return 0
proc/broadcast_status()
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
@@ -70,19 +62,19 @@
"filter_co2" = scrub_CO2,
"filter_toxins" = scrub_Toxins,
"filter_n2o" = scrub_N2O,
"sigtype" = "status"
"sigtype" = "status",
"setting" = scrub_rate
)
radio_connection.post_signal(src, signal, radio_filter_out)
var/area/alarm_area = get_area(src)
if(alarm_area.master.master_air_alarm && alarm_area.master.master_air_alarm.master_is_operating())
receive_signal(signal)
else
for(var/area/A in alarm_area.related)
for(var/obj/machinery/alarm/AA in A)
receive_signal(signal)
return 1
initialize()
..()
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
if (frequency)
set_frequency(frequency)
process()
..()
if(stat & (NOPOWER|BROKEN))
@@ -93,12 +85,11 @@
if(!on)
return 0
var/datum/gas_mixture/environment = loc.return_air()
if(scrubbing)
if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles
var/transfer_moles = min(1, volume_rate*scrub_rate/environment.volume)*environment.total_moles
//Take a gas sample
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
@@ -136,7 +127,7 @@
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
return
var/transfer_moles = environment.total_moles*(volume_rate/environment.volume)
var/transfer_moles = environment.total_moles*(volume_rate*scrub_rate/environment.volume)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
@@ -218,6 +209,9 @@
broadcast_status()
return //do not update_icon
if("setting" in signal.data)
scrub_rate = text2num(signal.data["setting"])
// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2)
broadcast_status()

View File

@@ -1,9 +1,9 @@
/obj/item/weapon/circuitboard/atmoscontrol
name = "Central Atmospherics Computer Circuitboard"
name = "\improper Central Atmospherics Computer Circuitboard"
build_path = "/obj/machinery/computer/security/atmoscontrol"
/obj/machinery/computer/atmoscontrol
name = "Central Atmospherics Computer"
name = "\improper Central Atmospherics Computer"
icon = 'computer.dmi'
icon_state = "computer_generic"
density = 1
@@ -18,7 +18,7 @@
user.machine = src
var/dat = "<a href='?src=\ref[src]&reset=1'>Main Menu</a><hr>"
if(current)
dat += src.specific()
dat += specific()
else
for(var/obj/machinery/alarm/alarm in world)
dat += "<a href='?src=\ref[src]&alarm=\ref[alarm]'>"
@@ -37,8 +37,8 @@
return ""
var/dat = "<h3>[current.name]</h3><hr>"
dat += current.return_status()
if(current.remote_control || overridden && current.rcon_setting)
dat += "<hr>[src.return_controls()]"
if(current.remote_control || (overridden && current.rcon_setting) )
dat += "<hr>[return_controls()]"
return dat
//a bunch of this is copied from atmos alarms
@@ -69,24 +69,25 @@
//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 = current.TLV[env]
var/newval = input("Enter [varname] for env", "Alarm triggers", tlv.vars[varname]) as num|null
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)
tlv.vars[varname] = -1.0
selected[threshold] = -1.0
else if (env=="temperature" && newval>5000)
tlv.vars[varname] = 5000
selected[threshold] = 5000
else if (env=="pressure" && newval>50*ONE_ATMOSPHERE)
tlv.vars[varname] = 50*ONE_ATMOSPHERE
selected[threshold] = 50*ONE_ATMOSPHERE
else if (env!="temperature" && env!="pressure" && newval>200)
tlv.vars[varname] = 200
selected[threshold] = 200
else
newval = round(newval,0.01)
tlv.vars[varname] = newval
selected[threshold] = newval
spawn(1)
src.updateUsrDialog()
updateUsrDialog()
return
if(href_list["screen"])
@@ -98,14 +99,14 @@
if(href_list["atmos_alarm"])
if (current.alarm_area.atmosalert(2))
current.post_alert(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.post_alert(0)
current.apply_danger_level(0)
spawn(1)
src.updateUsrDialog()
current.update_icon()
@@ -122,10 +123,9 @@
//copypasta from alarm code, changed to work with this without derping hard
//---START COPYPASTA----
#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_PANIC 2 //constantly sucks all air
#define AALARM_MODE_REPLACEMENT 3 //sucks off all air, then refill and swithes to scrubbing
#define AALARM_MODE_FILL 4 //emergency fill
#define AALARM_SCREEN_MAIN 1
#define AALARM_SCREEN_VENT 2
@@ -151,7 +151,7 @@
<HR>
"}
if (current.mode==AALARM_MODE_PANIC)
output += "<font color='red'><B>PANIC SYPHON ACTIVE</B></font><br><A href='?src=\ref[src];alarm=\ref[current];mode=[AALARM_MODE_OFF]'>turn syphoning off</A>"
output += "<font color='red'><B>PANIC SYPHON ACTIVE</B></font><br><A href='?src=\ref[src];alarm=\ref[current];mode=[AALARM_MODE_SCRUBBING]'>turn syphoning off</A>"
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>"
if (AALARM_SCREEN_VENT)
@@ -160,14 +160,8 @@
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 = "<font color='red'> can not be found!</font>"
data = list("external" = 0) //for "0" instead of empty string
else if (data["timestamp"]+AALARM_REPORT_TIMEOUT < world.time)
state = "<font color='red'> not responding!</font>"
sensor_data += {"
<B>[long_name]</B>[state]<BR>
<B>[long_name]</B><BR>
<B>Operating:</B>
<A href='?src=\ref[src];alarm=\ref[current];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A>
<BR>
@@ -203,15 +197,9 @@ siphoning
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 = "<font color='red'> can not be found!</font>"
data = list("external" = 0) //for "0" instead of empty string
else if (data["timestamp"]+AALARM_REPORT_TIMEOUT < world.time)
state = "<font color='red'> not responding!</font>"
sensor_data += {"
<B>[long_name]</B>[state]<BR>
<B>[long_name]</B><BR>
<B>Operating:</B>
<A href='?src=\ref[src];alarm=\ref[current];id_tag=[id_tag];command=power;val=[!data["power"]]'>[data["power"]?"on":"off"]</A><BR>
<B>Type:</B>
@@ -244,10 +232,9 @@ Nitrous Oxide
<b>Air machinery mode for the area:</b><ul>"}
var/list/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_FILL = "<font color='red'>FILL</font>"
)
for (var/m=1,m<=modes.len,m++)
if (current.mode==m)
@@ -278,49 +265,26 @@ table tr:first-child th:first-child { border: none;}
"plasma" = "Toxin",
"other" = "Other",
)
var/list/thresholds = list("min2", "min1", "max1", "max2")
var/datum/tlv/tlv
var/list/tlv
for (var/g in gases)
output += {"
<TR><th>[gases[g]]</th>
"}
output += "<TR><th>[gases[g]]</th>"
tlv = current.TLV[g]
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=[g];var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
for (var/i = 1, i <= 4, i++)
output += "<td><A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=[g];var=[i]'>[tlv[i]?tlv[i]:"OFF"]</A></td>"
output += "</TR>"
tlv = current.TLV["pressure"]
output += {"
<TR><th>Pressure</th>
"}
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=pressure;var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
output += "<TR><th>Pressure</th>"
for (var/i = 1, i <= 4, i++)
output += "<td><A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=pressure;var=[i]'>[tlv[i]?tlv[i]:"OFF"]</A></td>"
output += "</TR>"
tlv = current.TLV["temperature"]
output += {"
<TR><th>Temperature</th>
"}
for (var/v in thresholds)
output += {"
<td>
<A href='?src=\ref[src];alarm=\ref[current];command=set_threshold;env=temperature;var=[v]'>[tlv.vars[v]>=0?tlv.vars[v]:"OFF"]</A>
</td>
"}
output += {"
</TR>
"}
output += {"</table>"}
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]?tlv[i]:"OFF"]</A></td>"
output += "</TR>"
output += "</table>"
return output
//---END COPYPASTA----

View File

@@ -197,6 +197,8 @@ connection
del src
if(A.HasDoor(B) || B.HasDoor(A))
indirect = 1
else
indirect = 0
proc/Sanitize()
//If the zones change on connected turfs, update it.

View File

@@ -123,16 +123,14 @@ var/NUKE_FREQ = 1200 //Randomised on nuke rounds.
#define TRANSMISSION_RADIO 1
/* filters */
var/const/RADIO_TO_AIRALARM = "1"
var/const/RADIO_FROM_AIRALARM = "2"
var/const/RADIO_CHAT = "3"
var/const/RADIO_ATMOSIA = "4"
var/const/RADIO_NAVBEACONS = "5"
var/const/RADIO_AIRLOCK = "6"
var/const/RADIO_SECBOT = "7"
var/const/RADIO_MULEBOT = "8"
var/const/RADIO_MAGNETS = "9"
var/const/RADIO_POWER = "10"
var/const/RADIO_CHAT = "1"
var/const/RADIO_ATMOSIA = "2"
var/const/RADIO_NAVBEACONS = "3"
var/const/RADIO_AIRLOCK = "4"
var/const/RADIO_SECBOT = "5"
var/const/RADIO_MULEBOT = "6"
var/const/RADIO_MAGNETS = "7"
var/const/RADIO_POWER = "8"
var/global/datum/controller/radio/radio_controller

File diff suppressed because it is too large Load Diff

View File

@@ -204,7 +204,7 @@
network = newnet
screen = 0
machines = list()
servers = list()
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"
updateUsrDialog()

View File

@@ -12,7 +12,7 @@
icon_state = "comm_monitor"
var/screen = 0 // the screen number:
var/list/machines = list() // the machines located by the computer
var/list/t_machines = list() // the machines located by the computer
var/obj/machinery/telecomms/SelectedMachine
var/network = "NULL" // the network to probe
@@ -83,7 +83,7 @@
switch(href_list["operation"])
if("release")
machines = list()
t_machines = list()
screen = 0
if("mainmenu")
@@ -116,7 +116,7 @@
else
network = newnet
screen = 0
machines = list()
t_machines = list()
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"
updateUsrDialog()

View File

@@ -200,7 +200,7 @@
network = newnet
screen = 0
machines = list()
servers = list()
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"
updateUsrDialog()