[MIRROR] adds logging for all canisters opened, logs all gases in spooky gas cans too (#8182)

* adds logging for all canisters opened, logs all gases in spooky gas cans too (#61289)

admins are now alerted when miasma, freon, and co2 canisters are opened, and are informed of the contents of canisters containing dangerous gases in general, not just the spooky gas on its own.
added overall logging for all canisters opened

* adds logging for all canisters opened, logs all gases in spooky gas cans too

Co-authored-by: Mooshimi <85910816+Mooshimi@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-09-15 03:33:20 +01:00
committed by GitHub
co-authored by Mooshimi
parent 7f528635fb
commit 48c5a18d55
2 changed files with 21 additions and 11 deletions
@@ -72,6 +72,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "co2"
specific_heat = 30
name = "Carbon Dioxide"
dangerous = TRUE
rarity = 700
purchaseable = TRUE
base_value = 0.2
@@ -171,6 +172,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "miasma"
specific_heat = 20
name = "Miasma"
dangerous = TRUE
gas_overlay = "miasma"
moles_visible = MOLES_GAS_VISIBLE * 60
rarity = 250
@@ -180,6 +182,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "freon"
specific_heat = 600
name = "Freon"
dangerous = TRUE
gas_overlay = "freon"
moles_visible = MOLES_GAS_VISIBLE *30
fusion_power = -5
@@ -667,28 +667,35 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
if(.)
release_pressure = clamp(round(pressure), can_min_release_pressure, can_max_release_pressure)
investigate_log("was set to [release_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
if("valve")
if("valve") //logging for openning canisters
var/logmsg
var/admin_msg
var/danger = FALSE
var/n = 0
valve_open = !valve_open
if(valve_open)
SSair.start_processing_machine(src)
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting a transfer into \the [holding || "air"].<br>"
if(!holding)
var/list/danger = list()
var/list/gaseslog = list() //list for logging all gases in canister
for(var/id in air_contents.gases)
var/gas = air_contents.gases[id]
gaseslog[gas[GAS_META][META_GAS_NAME]] = gas[MOLES] //adds gases to gaseslog
if(!gas[GAS_META][META_GAS_DANGER])
continue
if(gas[MOLES] > (gas[GAS_META][META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
danger[gas[GAS_META][META_GAS_NAME]] = gas[MOLES] //ex. "plasma" = 20
if(danger.len)
message_admins("[ADMIN_LOOKUPFLW(usr)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:")
log_admin("[key_name(usr)] opened a canister that contains the following at [AREACOORD(src)]:")
for(var/name in danger)
var/msg = "[name]: [danger[name]] moles."
log_admin(msg)
message_admins(msg)
danger = TRUE //at least 1 danger gas
logmsg = "[key_name(usr)] <b>opened</b> a canister that contains the following:"
admin_msg = "[key_name(usr)] <b>opened</b> a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:"
for(var/name in gaseslog)
n = n + 1
logmsg += "\n[name]: [gaseslog[name]] moles."
if(n <= 5) //the first five gases added
admin_msg += "\n[name]: [gaseslog[name]] moles."
if(n == 5 && gaseslog.len > 5) //message added if more than 5 gases
admin_msg += "\nToo many gases to log. Check investigate log."
if(danger) //sent to admin's chat if contains dangerous gases
message_admins(admin_msg)
else
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into \the [holding || "air"].<br>"
investigate_log(logmsg, INVESTIGATE_ATMOS)