diff --git a/code/__HELPERS/atom_helpers.dm b/code/__HELPERS/atom_helpers.dm index 30e7f6babd2..309eee321f8 100644 --- a/code/__HELPERS/atom_helpers.dm +++ b/code/__HELPERS/atom_helpers.dm @@ -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 = "[C.ckey]" + else + ckey = "[C.ckey] (DC)" + + return "[ckey]/([name])" + +/datum/attack_info/proc/last_weapon() + if(last_attacker_weapon) + return " ([last_attacker_weapon])" + return "" diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 71bbce9086f..c3198228344 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -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])" diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index d281261f980..00add12da8e 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -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()