From 4b22aa12da970f5522ae9f25a6b49d2a49c23e6b Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Tue, 7 Sep 2021 21:04:29 +0200 Subject: [PATCH 1/2] add_attack_logs ssd tweak only overrides the log_level if the target is SSD AND there is a user --- code/__HELPERS/mobs.dm | 2 +- code/game/machinery/wishgranter.dm | 10 +++++----- code/game/mecha/equipment/weapons/weapons.dm | 2 +- code/modules/projectiles/guns/magic/wand.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index e836824ad3a..bfb4706d6e0 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -323,7 +323,7 @@ This is always put in the attack log. loglevel = ATKLOG_ALMOSTALL else loglevel = ATKLOG_ALL // Hitting an object. Not a mob - if(isLivingSSD(target)) // Attacks on SSDs are shown to admins with any log level except ATKLOG_NONE. Overrides custom level + if(user && isLivingSSD(target)) // Attacks on SSDs are shown to admins with any log level except ATKLOG_NONE. Overrides custom level loglevel = ATKLOG_FEW diff --git a/code/game/machinery/wishgranter.dm b/code/game/machinery/wishgranter.dm index d762543f807..23f251efaff 100644 --- a/code/game/machinery/wishgranter.dm +++ b/code/game/machinery/wishgranter.dm @@ -42,11 +42,11 @@ user.mind.add_antag_datum(/datum/antagonist/wishgranter) to_chat(user, "You have a very bad feeling about this.") - + /obj/machinery/wish_granter/super name = "super wish granter" var/list/types = list() - + /obj/machinery/wish_granter/super/attack_hand(mob/living/carbon/user) . = ..() @@ -60,9 +60,9 @@ if(is_special_character(user) || jobban_isbanned(user, ROLE_TRAITOR) || jobban_isbanned(user, ROLE_SYNDICATE)) to_chat(user, "Something instinctual makes you pull away.") return TRUE - + to_chat(user, "Your touch makes the Wish Granter stir. Are you really sure you want to do this?") - + for(var/supname in GLOB.all_superheroes) types += supname @@ -85,6 +85,6 @@ playsound(src.loc, 'sound/effects/bamf.ogg', 50, 1) visible_message("The wishgranter fades into mist..") - add_attack_logs(null, user, "Became [GLOB.all_superheroes[wish]]") + add_attack_logs(user, user, "Became [GLOB.all_superheroes[wish]]") notify_ghosts("[GLOB.all_superheroes[wish]] has appeared in [get_area(user)].", source = user) qdel(src) diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 351aba3905b..2b04b105535 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -165,7 +165,7 @@ if(istype(firer, /mob)) add_attack_logs(firer, M, "Mecha-shot with [src]") else - add_attack_logs(null, M, "Mecha-shot with [src]") + add_attack_logs(src, M, "Mecha-shot with [src] (no firer)") if(life <= 0) qdel(src) return diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index 08e7b79ac33..81cfd9cf1e5 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -51,7 +51,7 @@ user.visible_message("[user] zaps [user.p_them()]self with [src].") playsound(user, fire_sound, 50, 1) user.create_attack_log("[key_name(user)] zapped [user.p_them()]self with a [src]") - add_attack_logs(null, user, "zapped [user.p_them()]self with a [src]", ATKLOG_ALL) + add_attack_logs(user, user, "zapped [user.p_them()]self with a [src]", ATKLOG_ALL) ///////////////////////////////////// //WAND OF DEATH diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 512f9188606..19efbbc35d5 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -275,7 +275,7 @@ return M.create_attack_log("[key_name(M)] became [new_mob.real_name].") - add_attack_logs(null, M, "became [new_mob.real_name]", ATKLOG_ALL) + add_attack_logs(M, M, "became [new_mob.real_name]", ATKLOG_ALL) new_mob.a_intent = INTENT_HARM if(M.mind) From 1f6ac281add026f4e69a30ca16e6731b621fee22 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Tue, 7 Sep 2021 21:16:19 +0200 Subject: [PATCH 2/2] Add documentation for add_attack_logs --- code/__HELPERS/mobs.dm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index bfb4706d6e0..0aa01605808 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -272,15 +272,19 @@ update_all_mob_security_hud() return 1 -/* -Proc for attack log creation, because really why not -1 argument is the actor -2 argument is the target of action -3 is the full description of the action -4 is whether or not to message admins -This is always put in the attack log. -*/ - +/** + * Creates attack (old and new) logs for the user and defense logs for the target. + * Will message admins depending on the custom_level, user and target. + * + * custom_level will determine the log level set. Unless the target is SSD and there is a user doing it + * If custom_level is not set then the log level will be determined using the user and the target. + * + * * Arguments: + * * user - The thing doing it. Can be null + * * target - The target of the attack + * * what_done - What has happened + * * custom_level - The log level override + */ /proc/add_attack_logs(atom/user, target, what_done, custom_level) if(islist(target)) // Multi-victim adding var/list/targets = target