Skip to content

Commit

Permalink
Adds a way to filter BZ gas with scrubbers and air alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
lzimann committed Jun 2, 2016
1 parent 488e152 commit a7c6223
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 19 deletions.
8 changes: 6 additions & 2 deletions code/modules/atmospherics/machinery/airalarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@
"widenet" = info["widenet"],
"filter_co2" = info["filter_co2"],
"filter_toxins" = info["filter_toxins"],
"filter_n2o" = info["filter_n2o"]
"filter_n2o" = info["filter_n2o"],
"filter_bz" = info["filter_bz"]
))
data["mode"] = mode
data["modes"] = list()
Expand Down Expand Up @@ -288,7 +289,7 @@
if(usr.has_unlimited_silicon_privilege && !wires.is_cut(WIRE_IDSCAN))
locked = !locked
. = TRUE
if("power", "co2_scrub", "tox_scrub", "n2o_scrub", "widenet", "scrubbing")
if("power", "co2_scrub", "tox_scrub", "n2o_scrub", "bz_scrub", "widenet", "scrubbing")
send_signal(device_id, list("[action]" = text2num(params["val"])))
. = TRUE
if("excheck")
Expand Down Expand Up @@ -405,6 +406,7 @@
"co2_scrub" = 1,
"tox_scrub" = 0,
"n2o_scrub" = 0,
"bz_scrub" = 0,
"scrubbing" = 1,
"widenet" = 0,
))
Expand All @@ -421,6 +423,7 @@
"co2_scrub" = 1,
"tox_scrub" = 1,
"n2o_scrub" = 1,
"bz_scrub" = 1,
"scrubbing" = 1,
"widenet" = 1,
))
Expand Down Expand Up @@ -450,6 +453,7 @@
"co2_scrub" = 1,
"tox_scrub" = 0,
"n2o_scrub" = 0,
"bz_scrub" = 0,
"scrubbing" = 1,
"widenet" = 0,
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
var/scrub_CO2 = 1
var/scrub_Toxins = 0
var/scrub_N2O = 0
var/scrub_BZ = 0

var/volume_rate = 200
var/widenet = 0 //is this scrubber acting on the 3x3 area around it.
Expand Down Expand Up @@ -60,16 +61,18 @@
var/amount = idle_power_usage

if(scrubbing & SCRUBBING)
if (scrub_CO2)
if(scrub_CO2)
amount += idle_power_usage
if (scrub_Toxins)
if(scrub_Toxins)
amount += idle_power_usage
if (scrub_N2O)
if(scrub_N2O)
amount += idle_power_usage
if(scrub_BZ)
amount += idle_power_usage
else //scrubbing == SIPHONING
amount = active_power_usage

if (widenet)
if(widenet)
amount += amount * (adjacent_turfs.len * (adjacent_turfs.len / 2))
use_power(amount, power_channel)
return 1
Expand Down Expand Up @@ -115,6 +118,7 @@
"filter_co2" = scrub_CO2,
"filter_toxins" = scrub_Toxins,
"filter_n2o" = scrub_N2O,
"filter_bz" = scrub_BZ,
"sigtype" = "status"
)

Expand Down Expand Up @@ -200,6 +204,11 @@
filtered_out.gases["n2o"][MOLES] = removed_gases["n2o"][MOLES]
removed.gases["n2o"][MOLES] = 0

if(scrub_BZ && removed_gases["bz"])
filtered_out.assert_gas("bz")
filtered_out.gases["bz"][MOLES] = removed_gases["bz"][MOLES]
removed.gases["bz"][MOLES] = 0

removed.garbage_collect()

//Remix the resulting gases
Expand Down Expand Up @@ -275,6 +284,11 @@
if("toggle_n2o_scrub" in signal.data)
scrub_N2O = !scrub_N2O

if("bz_scrub" in signal.data)
scrub_BZ = text2num(signal.data["bz_scrub"])
if("toggle_bz_scrub" in signal.data)
scrub_BZ = !scrub_BZ

if("init" in signal.data)
name = signal.data["init"]
return
Expand Down
2 changes: 1 addition & 1 deletion tgui/assets/tgui.css

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions tgui/assets/tgui.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tgui/src/interfaces/airalarm/scrubbers.ract
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
action='n2o_scrub' params='{"id_tag": "{{id_tag}}", "val": {{+!filter_n2o}}}'>N2O</ui-button>
<ui-button icon='{{filter_toxins ? "check-square-o" : "square-o"}}' style='{{filter_toxins ? "selected" : null}}'
action='tox_scrub' params='{"id_tag": "{{id_tag}}", "val": {{+!filter_toxins}}}'>Plasma</ui-button>
<ui-button icon='{{filter_bz ? "check-square-o" : "square-o"}}' style='{{filter_bz ? "selected" : null}}'
action='bz_scrub' params='{"id_tag": "{{id_tag}}", "val": {{+!filter_bz}}}'>BZ</ui-button>
</ui-section>
</ui-subdisplay>
{{else}}
Expand Down

0 comments on commit a7c6223

Please sign in to comment.