add investigate log for destroyed canisters (#28880)

This commit is contained in:
warriorstar-orion
2025-04-04 15:54:23 +00:00
committed by GitHub
parent 7940b20b0c
commit 9c3dd81dce
3 changed files with 36 additions and 3 deletions
+23 -2
View File
@@ -13,6 +13,27 @@
/// Only contains attacker name/ckey right now but could be expanded.
/datum/attack_info
/// Name of the mob who performed the last attack.
var/last_attacker_name = null
var/last_attacker_name
/// Ckey of the player who performed the last attack.
var/last_attacker_ckey = null
var/last_attacker_ckey
/// Name and type of the weapon that the last attack was performed with.
var/last_attacker_weapon
/datum/attack_info/proc/last_attacker_html()
var/name = "INVALID"
var/ckey = "INVALID"
if(last_attacker_name)
name = last_attacker_name
if(last_attacker_ckey)
var/client/C = get_client_by_ckey(last_attacker_ckey)
if(C)
ckey = "<a href='byond://?priv_msg=[C.ckey];type=;ticket_id='>[C.ckey]</a>"
else
ckey = "[C.ckey] (DC)"
return "[ckey]/([name])"
/datum/attack_info/proc/last_weapon()
if(last_attacker_weapon)
return " ([last_attacker_weapon])"
return ""
+3 -1
View File
@@ -1500,8 +1500,10 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
var/atom/checked_atom = .[++i]
. += checked_atom.contents
/atom/proc/store_last_attacker(mob/living/attacker)
/atom/proc/store_last_attacker(mob/living/attacker, obj/item/weapon)
if(!attack_info)
attack_info = new
attack_info.last_attacker_name = attacker.real_name
attack_info.last_attacker_ckey = attacker.ckey
if(istype(weapon))
attack_info.last_attacker_weapon = "[weapon] ([weapon.type])"
@@ -201,6 +201,8 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
holding_tank = null
T.blind_release_air(expelled_gas)
if(attack_info)
investigate_log("canister destroyed, last attacked by [attack_info.last_attacker_html()][attack_info.last_weapon()]", INVESTIGATE_ATMOS)
/obj/machinery/atmospherics/portable/canister/proc/sync_pressure_appearance()
var/new_pressure_appearance = pressure_to_appearance(air_contents.return_pressure())
@@ -407,6 +409,14 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
. = ..()
update_icon()
/obj/machinery/atmospherics/portable/canister/attacked_by(obj/item/attacker, mob/living/user)
. = ..()
store_last_attacker(user, attacker)
/obj/machinery/atmospherics/portable/canister/attack_animal(mob/living/simple_animal/M)
. = ..()
store_last_attacker(M)
/obj/machinery/atmospherics/portable/canister/toxins
name = "Canister \[Toxin (Plasma)\]"
icon_state = "orange" //See Initialize()