mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
- Added vent control to air alarms
- Added air filter pressure control and made N2O filtering a separate option - Fixed gas sensor division by zero bug - Some atmos changes - Disease gib-loop debugging - Moved alarms, scrubbers and vents initialization to more suitable place git-svn-id: http://tgstation13.googlecode.com/svn/trunk@352 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -7,6 +7,7 @@ obj/machinery/atmospherics/filter
|
||||
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
req_access = list(access_atmospherics)
|
||||
|
||||
var/on = 0
|
||||
var/temp = null // -- TLE
|
||||
@@ -116,9 +117,6 @@ Filter types:
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
@@ -133,15 +131,19 @@ Filter types:
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
|
||||
if(3) //removing CO2
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(4)//removing N2O
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
if(3) //removing CO2
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
else
|
||||
filtered_out = null
|
||||
|
||||
|
||||
air_out1.merge(filtered_out)
|
||||
@@ -298,10 +300,12 @@ Filter types:
|
||||
|
||||
|
||||
obj/machinery/atmospherics/filter/attack_hand(user as mob) // -- TLE
|
||||
var/dat
|
||||
if(..())
|
||||
return
|
||||
if (1 == 1)
|
||||
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
/*
|
||||
dat += "Autolathe Wires:<BR>"
|
||||
var/wire
|
||||
@@ -312,34 +316,49 @@ obj/machinery/atmospherics/filter/attack_hand(user as mob) // -- TLE
|
||||
dat += text("The green light is [src.shocked ? "off" : "on"].<BR>")
|
||||
dat += text("The blue light is [src.hacked ? "off" : "on"].<BR>")
|
||||
*/
|
||||
var/current_filter_type
|
||||
switch(filter_type)
|
||||
if(0)
|
||||
current_filter_type = "Carbon Molecules"
|
||||
if(1)
|
||||
current_filter_type = "Oxygen"
|
||||
if(2)
|
||||
current_filter_type = "Nitrogen"
|
||||
if(3)
|
||||
current_filter_type = "Carbon Dioxide"
|
||||
else
|
||||
current_filter_type = "ERROR - Report this bug to the admin, please!"
|
||||
var/dat
|
||||
var/current_filter_type
|
||||
switch(filter_type)
|
||||
if(0)
|
||||
current_filter_type = "Carbon Molecules"
|
||||
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!"
|
||||
|
||||
dat += "<b>Filtering: </b>[current_filter_type]<br><br>"
|
||||
dat += "<h3>Set Filter Type:</h3><BR>"
|
||||
dat += "<A href='?src=\ref[src];filterset=0'>Carbon Molecules</A><BR>"
|
||||
dat += "<A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>"
|
||||
dat += "<A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>"
|
||||
dat += "<A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>"
|
||||
|
||||
user << browse("<HEAD><TITLE>Atmospherics Filter</TITLE></HEAD>[dat]","window=atmo_filter")
|
||||
dat += {"<b>Filtering: </b>[current_filter_type]<br><HR>
|
||||
<h4>Set Filter Type:</h4>
|
||||
<A href='?src=\ref[src];filterset=0'>Carbon Molecules</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>Desirible output pressure:</B>
|
||||
<a href='?src=\ref[src];out_press=-10'><b>-</b></a>
|
||||
<a href='?src=\ref[src];out_press=-1'>-</a>
|
||||
[src.target_pressure]
|
||||
<a href='?src=\ref[src];out_press=1'>+</a>
|
||||
<a href='?src=\ref[src];out_press=10'><b>+</b></a>"}
|
||||
/*
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD>[dat]","window=atmo_filter")
|
||||
onclose(user, "atmo_filter")
|
||||
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>Autolathe Control Panel</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_filter")
|
||||
*/
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_filter")
|
||||
onclose(user, "atmo_filter")
|
||||
return
|
||||
|
||||
@@ -349,18 +368,13 @@ obj/machinery/atmospherics/filter/Topic(href, href_list) // -- TLE
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["filterset"])
|
||||
if(href_list["filterset"] == "0")
|
||||
src.filter_type = 0
|
||||
if(href_list["filterset"] == "1")
|
||||
src.filter_type = 1
|
||||
if(href_list["filterset"] == "2")
|
||||
src.filter_type = 2
|
||||
if(href_list["filterset"] == "3")
|
||||
src.filter_type = 3
|
||||
src.filter_type = text2num(href_list["filterset"])
|
||||
if (href_list["temp"])
|
||||
src.temp = null
|
||||
if(href_list["out_press"])
|
||||
src.target_pressure = max(0, min(4000, src.target_pressure + text2num(href_list["out_press"])))
|
||||
|
||||
for(var/mob/M in viewers(1, src))
|
||||
if ((M.client && M.machine == src))
|
||||
src.attack_hand(M)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
process()
|
||||
..()
|
||||
broadcast_status()
|
||||
|
||||
if(!on)
|
||||
return 0
|
||||
if(welded)
|
||||
@@ -143,6 +145,10 @@
|
||||
if("power_toggle")
|
||||
on = !on
|
||||
|
||||
if("toggle_checks")
|
||||
pressure_checks = (pressure_checks?0:3)
|
||||
|
||||
|
||||
if("set_direction")
|
||||
var/number = text2num(signal.data["parameter"])
|
||||
if(number > 0.5)
|
||||
@@ -175,7 +181,10 @@
|
||||
external_pressure_bound = number
|
||||
|
||||
if(signal.data["tag"])
|
||||
spawn(5) broadcast_status()
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(on&&node)
|
||||
@@ -209,4 +218,4 @@
|
||||
set src in oview(1)
|
||||
..()
|
||||
if(welded)
|
||||
usr << "It seems welded shut."
|
||||
usr << "It seems welded shut."
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.data["tag"] = id_tag
|
||||
signal.data["device"] = "AScr"
|
||||
signal.data["timestamp"] = air_master.current_cycle
|
||||
signal.data["on"] = on
|
||||
signal.data["scrubbing"] = scrubbing
|
||||
@@ -55,59 +56,14 @@
|
||||
|
||||
return 1
|
||||
|
||||
//This is probably not a good place for this, since it messes with all scrubbers and alarms in area. Maybe it's better to move this to area code.
|
||||
//It has its issues. Just place additional air alarm closer to the scrubbers, or assign scrubbers manually
|
||||
find_air_alarm()
|
||||
if(src.id_tag) return //id_tag assigned
|
||||
var/area/A = get_area(loc)
|
||||
var/area/M = A.master //we want to search master area, not only L(number) one
|
||||
|
||||
var/uniq_id = md5(M.name)//hash works like a charm
|
||||
var/list/alarms = list()
|
||||
var/list/scrubbers = list()
|
||||
var/i = 0 //used in id_tag and scrubber name generation
|
||||
|
||||
if(M.related && M.related.len)//if has relatives
|
||||
for(var/area/Rel in M.related)//check all relatives
|
||||
if(Rel == M) continue //same parent area.
|
||||
if(Rel.contents && Rel.contents.len)
|
||||
for(var/obj/machinery/alarm/Al in Rel.contents)//find air alarms in area, append to list
|
||||
alarms += Al
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/V in Rel.contents)//find scrubbers in area, append to list
|
||||
if(V.id_tag) continue//already connected to air alarm
|
||||
scrubbers += V
|
||||
|
||||
if(scrubbers.len&&alarms.len) //if scrubbers & alarms found in area
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/Sc in scrubbers)//iterate over found scrubbers
|
||||
var/dist = 127 //max value returned by get_dist
|
||||
var/obj/machinery/alarm/target_alarm = null
|
||||
for(var/obj/machinery/alarm/Al in alarms)//iterate over found alarms
|
||||
var/temp_dist = get_dist(Sc.loc, Al.loc)//if distance between current scrubber and current alarm < previous distance, set this alarm as target to connect to
|
||||
if(temp_dist<dist)
|
||||
target_alarm = Al
|
||||
dist = temp_dist
|
||||
if(target_alarm) //if target(closest) air alarm found,
|
||||
Sc.id_tag = "[uniq_id]_[i++]" //set scrubber id_tag
|
||||
Sc.frequency = target_alarm.frequency //set scrubber frequency (alarm frequency)
|
||||
var/d_name = "[M.name] Air Scrubber #[i]" //displayed name
|
||||
target_alarm.sensors[Sc.id_tag] = d_name //append scrubber to alarm 'sensor' list
|
||||
Sc.name = d_name //set scrubber name
|
||||
//debug
|
||||
//world << "[Sc.name] in [M.name] is set to frequency [Sc.frequency] with ID [Sc.id_tag]"
|
||||
//debug
|
||||
|
||||
initialize()
|
||||
find_air_alarm()
|
||||
set_frequency(frequency)
|
||||
update_icon()
|
||||
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!(stat & (NOPOWER|BROKEN)))
|
||||
broadcast_status()
|
||||
else
|
||||
return 0
|
||||
broadcast_status()
|
||||
|
||||
if(!on)
|
||||
return 0
|
||||
@@ -191,8 +147,8 @@
|
||||
else
|
||||
scrubbing = 1
|
||||
volume_rate = 120
|
||||
|
||||
if(signal.data["tag"])
|
||||
spawn(2) broadcast_status()
|
||||
update_icon()
|
||||
return ..()
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
@@ -28,6 +28,7 @@ obj/machinery/atmospherics/valve
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(EAST || WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
..()
|
||||
|
||||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
|
||||
@@ -213,6 +214,12 @@ obj/machinery/atmospherics/valve
|
||||
attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
//Radio remote control
|
||||
|
||||
proc
|
||||
|
||||
Reference in New Issue
Block a user