diff --git a/code/__DEFINES/logging.dm b/code/__DEFINES/logging.dm index 755f30e908a..fda10bc6034 100644 --- a/code/__DEFINES/logging.dm +++ b/code/__DEFINES/logging.dm @@ -39,15 +39,16 @@ #define LOG_CLONING (1 << 17) #define LOG_SHUTTLE (1 << 18) #define LOG_ECON (1 << 19) +#define LOG_VICTIM (1 << 20) //Individual logging panel pages -#define INDIVIDUAL_ATTACK_LOG (LOG_ATTACK) +#define INDIVIDUAL_ATTACK_LOG (LOG_ATTACK | LOG_VICTIM) #define INDIVIDUAL_SAY_LOG (LOG_SAY | LOG_WHISPER | LOG_DSAY) #define INDIVIDUAL_EMOTE_LOG (LOG_EMOTE) #define INDIVIDUAL_COMMS_LOG (LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS) #define INDIVIDUAL_OOC_LOG (LOG_OOC | LOG_ADMIN) #define INDIVIDUAL_OWNERSHIP_LOG (LOG_OWNERSHIP) -#define INDIVIDUAL_SHOW_ALL_LOG (LOG_ATTACK | LOG_SAY | LOG_WHISPER | LOG_EMOTE | LOG_DSAY | LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS | LOG_OOC | LOG_ADMIN | LOG_OWNERSHIP | LOG_GAME | LOG_ADMIN_PRIVATE | LOG_ASAY | LOG_MECHA | LOG_VIRUS | LOG_CLONING | LOG_SHUTTLE | LOG_ECON) +#define INDIVIDUAL_SHOW_ALL_LOG (LOG_ATTACK | LOG_SAY | LOG_WHISPER | LOG_EMOTE | LOG_DSAY | LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS | LOG_OOC | LOG_ADMIN | LOG_OWNERSHIP | LOG_GAME | LOG_ADMIN_PRIVATE | LOG_ASAY | LOG_MECHA | LOG_VIRUS | LOG_CLONING | LOG_SHUTTLE | LOG_ECON | LOG_VICTIM) #define LOGSRC_CLIENT "Client" #define LOGSRC_MOB "Mob" diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index 2d1dd604495..9bc83d338fe 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -112,7 +112,8 @@ to_chat(user, span_notice("You try to put [equipping] on [source]...")) var/log = "[key_name(source)] is having [equipping] put on them by [key_name(user)]" - source.log_message(log, LOG_ATTACK, color="red") + user.log_message(log, LOG_ATTACK, color="red") + source.log_message(log, LOG_VICTIM, color="red", log_globally=FALSE) return TRUE @@ -154,7 +155,8 @@ ) to_chat(user, span_danger("You try to remove [source]'s [item]...")) - source.log_message("[key_name(source)] is being stripped of [item] by [key_name(user)]", LOG_ATTACK, color="red") + user.log_message("[key_name(source)] is being stripped of [item] by [key_name(user)]", LOG_ATTACK, color="red") + source.log_message("[key_name(source)] is being stripped of [item] by [key_name(user)]", LOG_VICTIM, color="red", log_globally=FALSE) item.add_fingerprint(src) if(ishuman(source)) @@ -299,7 +301,8 @@ if (!item.doStrip(user, source)) return FALSE - source.log_message("[key_name(source)] has been stripped of [item] by [key_name(user)]", LOG_ATTACK, color="red") + user.log_message("[key_name(source)] has been stripped of [item] by [key_name(user)]", LOG_ATTACK, color="red") + source.log_message("[key_name(source)] has been stripped of [item] by [key_name(user)]", LOG_VICTIM, color="red", log_globally=FALSE) // Updates speed in case stripped speed affecting item source.update_equipment_speed_mods() diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 78996dd74f4..075530b9146 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -700,8 +700,8 @@ var/mob/living/carbon/C = owner C.cure_trauma_type(/datum/brain_trauma/hypnosis, TRAUMA_RESILIENCE_SURGERY) //clear previous hypnosis // The brain trauma itself does its own set of logging, but this is the only place the source of the hypnosis phrase can be found. - C.log_message("has been hypnotised by the phrase '[hearing_args[HEARING_RAW_MESSAGE]]' spoken by [key_name(hearing_speaker)]", LOG_ATTACK) - hearing_speaker.log_message("has hypnotised [key_name(C)] with the phrase '[hearing_args[HEARING_RAW_MESSAGE]]'", LOG_ATTACK, log_globally = FALSE) + hearing_speaker.log_message("has hypnotised [key_name(C)] with the phrase '[hearing_args[HEARING_RAW_MESSAGE]]'", LOG_ATTACK) + C.log_message("has been hypnotised by the phrase '[hearing_args[HEARING_RAW_MESSAGE]]' spoken by [key_name(hearing_speaker)]", LOG_VICTIM, log_globally = FALSE) addtimer(CALLBACK(C, /mob/living/carbon.proc/gain_trauma, /datum/brain_trauma/hypnosis, TRAUMA_RESILIENCE_SURGERY, hearing_args[HEARING_RAW_MESSAGE]), 10) addtimer(CALLBACK(C, /mob/living.proc/Stun, 60, TRUE, TRUE), 15) //Take some time to think about it qdel(src) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 699e7f3bb8c..51c9ada0793 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1567,7 +1567,18 @@ /atom/proc/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) return -/// Generic logging helper +/** + * Generic logging helper + * + * reads the type of the log + * and writes it to the respective log file + * unless log_globally is FALSE + * Arguments: + * * message - The message being logged + * * message_type - the type of log the message is(ATTACK, SAY, etc) + * * color - color of the log text + * * log_globally - boolean checking whether or not we write this log to the log file + */ /atom/proc/log_message(message, message_type, color=null, log_globally=TRUE) if(!log_globally) return @@ -1614,7 +1625,19 @@ stack_trace("Invalid individual logging type: [message_type]. Defaulting to [LOG_GAME] (LOG_GAME).") log_game(log_text) -/// Helper for logging chat messages or other logs with arbitrary inputs (e.g. announcements) +/** + * Helper for logging chat messages or other logs with arbitrary inputs(e.g. announcements) + * + * This proc compiles a log string by prefixing the tag to the message + * and suffixing what it was forced_by if anything + * if the message lacks a tag and suffix then it is logged on its own + * Arguments: + * * message - The message being logged + * * message_type - the type of log the message is(ATTACK, SAY, etc) + * * tag - tag that indicates the type of text(announcement, telepathy, etc) + * * log_globally - boolean checking whether or not we write this log to the log file + * * forced_by - source that forced the dialogue if any + */ /atom/proc/log_talk(message, message_type, tag=null, log_globally=TRUE, forced_by=null) var/prefix = tag ? "([tag]) " : "" var/suffix = forced_by ? " FORCED by [forced_by]" : "" @@ -1627,6 +1650,8 @@ tag = "UNKNOWN" source.log_talk(message, message_type, tag="[tag] to [key_name(target)]") + if(source != target) + target.log_talk(message, LOG_VICTIM, tag="[tag] from [key_name(source)]", log_globally=FALSE) /** * Log a combat message in the attack log @@ -1639,6 +1664,7 @@ * * addition - is any additional text, which will be appended to the rest of the log line */ /proc/log_combat(atom/user, atom/target, what_done, atom/object=null, addition=null) + var/ssource = key_name(user) var/starget = key_name(target) var/mob/living/living_target = target @@ -1656,6 +1682,10 @@ var/message = "has [what_done] [starget][postfix]" user.log_message(message, LOG_ATTACK, color="red") + if(user != target) + var/reverse_message = "has been [what_done] by [ssource][postfix]" + target.log_message(reverse_message, LOG_VICTIM, color="orange", log_globally=FALSE) + /** * log_wound() is for when someone is *attacked* and suffers a wound. Note that this only captures wounds from damage, so smites/forced wounds aren't logged, as well as demotions like cuts scabbing over * diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index d9623222d8c..d7d203a80da 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -200,7 +200,7 @@ return FALSE brainwash(C, objective) message_admins("[ADMIN_LOOKUPFLW(user)] brainwashed [key_name_admin(C)] with objective '[objective]'.") - C.log_message("has been brainwashed with the objective '[objective]' by [key_name(user)] using \the [src]", LOG_ATTACK) - user.log_message("has brainwashed [key_name(C)] with the objective '[objective]' using \the [src]", LOG_ATTACK, log_globally = FALSE) + user.log_message("has brainwashed [key_name(C)] with the objective '[objective]' using \the [src]", LOG_ATTACK) + C.log_message("has been brainwashed with the objective '[objective]' by [key_name(user)] using \the [src]", LOG_VICTIM, log_globally = FALSE) log_game("[key_name(user)] brainwashed [key_name(C)] with objective '[objective]'.") return TRUE diff --git a/code/modules/antagonists/brainwashing/brainwashing.dm b/code/modules/antagonists/brainwashing/brainwashing.dm index ab867b45631..cf986bd602a 100644 --- a/code/modules/antagonists/brainwashing/brainwashing.dm +++ b/code/modules/antagonists/brainwashing/brainwashing.dm @@ -90,7 +90,7 @@ brainwash(C, objectives) var/obj_list = english_list(objectives) message_admins("[key_name_admin(admin)] has brainwashed [key_name_admin(C)] with the following objectives: [obj_list].") - C.log_message("has been force-brainwashed with the objective '[obj_list]' by admin [key_name(admin)]", LOG_ATTACK, log_globally = FALSE) + C.log_message("has been force-brainwashed with the objective '[obj_list]' by admin [key_name(admin)]", LOG_VICTIM, log_globally = FALSE) log_admin("[key_name(admin)] has brainwashed [key_name(C)] with the following objectives: [obj_list].") /datum/objective/brainwashing diff --git a/code/modules/mob/living/carbon/human/human_stripping.dm b/code/modules/mob/living/carbon/human/human_stripping.dm index 0b49b3500fd..ae5fa42f6e6 100644 --- a/code/modules/mob/living/carbon/human/human_stripping.dm +++ b/code/modules/mob/living/carbon/human/human_stripping.dm @@ -157,7 +157,8 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list( to_chat(user, span_notice("You try to empty [source]'s [pocket_side] pocket.")) var/log_message = "[key_name(source)] is being pickpocketed of [item] by [key_name(user)] ([pocket_side])" - source.log_message(log_message, LOG_ATTACK, color="red") + user.log_message(log_message, LOG_ATTACK, color="red") + source.log_message(log_message, LOG_VICTIM, color="red", log_globally=FALSE) item.add_fingerprint(src) var/result = start_unequip_mob(item, source, user, POCKET_STRIP_DELAY) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 939942b1f6f..b4bf84a627e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1005,7 +1005,8 @@ who.visible_message(span_warning("[src] tries to remove [who]'s [what.name]."), \ span_userdanger("[src] tries to remove your [what.name]."), null, null, src) to_chat(src, span_danger("You try to remove [who]'s [what.name]...")) - who.log_message("[key_name(who)] is being stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + log_message("[key_name(who)] is being stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + who.log_message("[key_name(who)] is being stripped of [what] by [key_name(src)]", LOG_VICTIM, color="red", log_globally = FALSE) what.add_fingerprint(src) if(do_mob(src, who, what.strip_delay, interaction_key = what)) if(what && Adjacent(who)) @@ -1013,10 +1014,12 @@ var/list/L = where if(what == who.get_item_for_held_index(L[2])) if(what.doStrip(src, who)) - who.log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + who.log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_VICTIM, color="red", log_globally = FALSE) if(what == who.get_item_by_slot(where)) if(what.doStrip(src, who)) - who.log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_ATTACK, color="red") + who.log_message("[key_name(who)] has been stripped of [what] by [key_name(src)]", LOG_VICTIM, color="red", log_globally = FALSE) // The src mob is trying to place an item on someone // Override if a certain mob should be behave differently when placing items (can't, for example) @@ -1049,7 +1052,8 @@ who.visible_message(span_notice("[src] tries to put [what] on [who]."), \ span_notice("[src] tries to put [what] on you."), null, null, src) to_chat(src, span_notice("You try to put [what] on [who]...")) - who.log_message("[key_name(who)] is having [what] put on them by [key_name(src)]", LOG_ATTACK, color="red") + log_message("[key_name(who)] is having [what] put on them by [key_name(src)]", LOG_ATTACK, color="red") + who.log_message("[key_name(who)] is having [what] put on them by [key_name(src)]", LOG_VICTIM, color="red", log_globally=FALSE) if(do_mob(src, who, what.equip_delay_other)) if(what && Adjacent(who) && what.mob_can_equip(who, src, final_where, TRUE, TRUE)) if(temporarilyRemoveItemFromInventory(what)) @@ -1058,7 +1062,8 @@ what.forceMove(get_turf(who)) else who.equip_to_slot(what, where, TRUE) - who.log_message("[key_name(who)] had [what] put on them by [key_name(src)]", LOG_ATTACK, color="red") + log_message("[key_name(who)] had [what] put on them by [key_name(src)]", LOG_ATTACK, color="red") + who.log_message("[key_name(who)] had [what] put on them by [key_name(src)]", LOG_VICTIM, color="red", log_globally = FALSE) /mob/living/singularity_pull(S, current_size) ..() diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 1e1f0ae2c73..0d25eeeb287 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -455,7 +455,7 @@ return // Cannot use the list as a map if the key is a number, so we stringify it (thank you BYOND) - var/smessage_type = num2text(message_type) + var/smessage_type = num2text(message_type, MAX_BITFLAG_DIGITS) if(client) if(!islist(client.player_details.logging[smessage_type])) diff --git a/code/modules/surgery/advanced/brainwashing.dm b/code/modules/surgery/advanced/brainwashing.dm index 3d88d619031..18d36c4f5b4 100644 --- a/code/modules/surgery/advanced/brainwashing.dm +++ b/code/modules/surgery/advanced/brainwashing.dm @@ -56,8 +56,8 @@ to_chat(target, span_userdanger("A new compulsion fills your mind... you feel forced to obey it!")) brainwash(target, objective) message_admins("[ADMIN_LOOKUPFLW(user)] surgically brainwashed [ADMIN_LOOKUPFLW(target)] with the objective '[objective]'.") - target.log_message("has been brainwashed with the objective '[objective]' by [key_name(user)] using brainwashing surgery.", LOG_ATTACK) - user.log_message("has brainwashed [key_name(target)] with the objective '[objective]' using brainwashing surgery.", LOG_ATTACK, log_globally = FALSE) + user.log_message("has brainwashed [key_name(target)] with the objective '[objective]' using brainwashing surgery.", LOG_ATTACK) + target.log_message("has been brainwashed with the objective '[objective]' by [key_name(user)] using brainwashing surgery.", LOG_VICTIM, log_globally=FALSE) log_game("[key_name(user)] surgically brainwashed [key_name(target)] with the objective '[objective]'.") return ..()