From 48c5a18d55dca035aba3525cb69cd08d91f26fd4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 15 Sep 2021 04:33:20 +0200 Subject: [PATCH] [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> --- .../atmospherics/gasmixtures/gas_types.dm | 3 ++ .../machinery/portable/canister.dm | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm index 1542e081897..875fe2caef6 100644 --- a/code/modules/atmospherics/gasmixtures/gas_types.dm +++ b/code/modules/atmospherics/gasmixtures/gas_types.dm @@ -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 diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index beedded4b05..223dcc19af1 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -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 opened by [key_name(usr)], starting a transfer into \the [holding || "air"].
" 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)] opened a canister that contains the following:" + admin_msg = "[key_name(usr)] opened 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 closed by [key_name(usr)], stopping the transfer into \the [holding || "air"].
" investigate_log(logmsg, INVESTIGATE_ATMOS)