From 442ef4811e350ccf43ce810b48422203a8587d36 Mon Sep 17 00:00:00 2001 From: farie82 Date: Fri, 10 Apr 2020 07:33:53 +0200 Subject: [PATCH] Improved logging (#13208) * Death is logged. hiveminds and robot talk is logged * Added channels to the say log * Shuttle logging * Spell targets logging --- code/__HELPERS/mobs.dm | 4 ++-- code/controllers/subsystem/shuttles.dm | 3 ++- code/datums/spell.dm | 2 +- code/modules/mining/laborcamp/laborstacker.dm | 3 ++- code/modules/mob/language.dm | 9 +++++++-- code/modules/mob/living/death.dm | 1 + code/modules/mob/living/say.dm | 10 ++++++---- .../simple_animal/hostile/megafauna/megafauna.dm | 4 ++-- code/modules/shuttle/on_move.dm | 2 +- code/modules/shuttle/shuttle.dm | 7 +++++-- 10 files changed, 29 insertions(+), 16 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 8f0fa4f5131..5b72dd3ec38 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -277,8 +277,8 @@ This is always put in the attack log. /proc/add_attack_logs(atom/user, target, what_done, custom_level) if(islist(target)) // Multi-victim adding var/list/targets = target - for(var/mob/M in targets) - add_attack_logs(user, M, what_done, custom_level) + for(var/t in targets) + add_attack_logs(user, t, what_done, custom_level) return var/user_str = key_name_log(user) + COORD(user) diff --git a/code/controllers/subsystem/shuttles.dm b/code/controllers/subsystem/shuttles.dm index da3d91c1de1..14a9b507977 100644 --- a/code/controllers/subsystem/shuttles.dm +++ b/code/controllers/subsystem/shuttles.dm @@ -223,11 +223,12 @@ SUBSYSTEM_DEF(shuttle) return 0 //dock successful -/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed) +/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed, mob/user) var/obj/docking_port/mobile/M = getShuttle(shuttleId) var/obj/docking_port/stationary/D = getDock(dockId) if(!M) return 1 + M.last_caller = user // Save the caller of the shuttle for later logging if(timed) if(M.request(D)) return 2 diff --git a/code/datums/spell.dm b/code/datums/spell.dm index e367e2d9aa4..6b114971258 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -241,7 +241,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) before_cast(targets) invocation() if(user && user.ckey) - add_attack_logs(user, null, "cast the spell [name]", ATKLOG_ALL) + add_attack_logs(user, targets, "cast the spell [name]", ATKLOG_ALL) spawn(0) if(charge_type == "recharge" && recharge) start_recharge() diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index 0b32b6aedde..dbb41229e27 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -109,7 +109,7 @@ GLOBAL_LIST(labor_sheet_values) if(!alone_in_area(get_area(src), usr)) to_chat(usr, "Prisoners are only allowed to be released while alone.") else - switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE)) + switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE, usr)) if(1) to_chat(usr, "Shuttle not found.") if(2) @@ -121,6 +121,7 @@ GLOBAL_LIST(labor_sheet_values) var/message = "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval." announcer.autosay(message, "Labor Camp Controller", "Security") to_chat(usr, "Shuttle received message and will be sent shortly.") + usr.create_log(MISC_LOG, "used [src] to call the laborcamp shuttle") return TRUE diff --git a/code/modules/mob/language.dm b/code/modules/mob/language.dm index 5936a0624d0..8445dec51ee 100644 --- a/code/modules/mob/language.dm +++ b/code/modules/mob/language.dm @@ -98,7 +98,9 @@ if(!check_can_speak(speaker)) return FALSE - log_say("([name]-HIVE) [message]", speaker) + var/log_message = "([name]-HIVE) [message]" + log_say(log_message, speaker) + speaker.create_log(SAY_LOG, log_message) if(!speaker_mask) speaker_mask = speaker.name @@ -605,7 +607,10 @@ if(!message) return - log_say("(ROBOT) [message]", speaker) + var/log_message = "(ROBOT) [message]" + log_say(log_message, speaker) + speaker.create_log(SAY_LOG, log_message) + var/message_start = "[name], [speaker.name]" var/message_body = "[speaker.say_quote(message)],\"[message]\"" diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 4d8aa1b776b..0984c56decb 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -81,6 +81,7 @@ update_canmove() timeofdeath = world.time + create_log(ATTACK_LOG, "died[gibbed ? " (Gibbed)": ""]") GLOB.living_mob_list -= src GLOB.dead_mob_list += src diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index eeaed10b9c5..edb62d0e013 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -177,6 +177,12 @@ proc/get_radio_key_from_channel(var/channel) if(handle_message_mode(message_mode, message_pieces, verb, used_radios)) return 1 + // Log of what we've said, plain message, no spans or junk + // handle_message_mode should have logged this already if it handled it + var/log_message = "[message_mode ? "([message_mode])" : ""] '[message]'" + say_log += log_message + create_log(SAY_LOG, log_message) // TODO after #13047: Include the channel + log_say(log_message, src) var/list/handle_v = handle_speech_sound() var/sound/speech_sound = handle_v[1] @@ -274,10 +280,6 @@ proc/get_radio_key_from_channel(var/channel) if(O) //It's possible that it could be deleted in the meantime. O.hear_talk(src, message_pieces, verb) - //Log of what we've said, plain message, no spans or junk - say_log += message - create_log(SAY_LOG, message) // TODO after #13047: Include the channel - log_say(message, src) return 1 /obj/effect/speech_bubble diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index b3618efff0a..4ce66ccd1d5 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -91,7 +91,7 @@ else devour(L) -/mob/living/simple_animal/hostile/megafauna/onShuttleMove() +/mob/living/simple_animal/hostile/megafauna/onShuttleMove(turf/oldT, turf/T1, rotation, mob/caller) var/turf/oldloc = loc . = ..() if(!.) @@ -100,7 +100,7 @@ message_admins("Megafauna [src] \ ([ADMIN_FLW(src,"FLW")]) \ moved via shuttle from ([oldloc.x], [oldloc.y], [oldloc.z]) to \ - ([newloc.x], [newloc.y], [newloc.z])") + ([newloc.x], [newloc.y], [newloc.z])[caller ? " called by [ADMIN_LOOKUP(caller)]" : ""]") /mob/living/simple_animal/hostile/megafauna/proc/devour(mob/living/L) if(!L) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index dbec1c611f7..f0394349f4d 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -1,5 +1,5 @@ // Shuttle on-movement // -/atom/movable/proc/onShuttleMove(turf/oldT, turf/T1, rotation) +/atom/movable/proc/onShuttleMove(turf/oldT, turf/T1, rotation, mob/caller) var/turf/newT = get_turf(src) if(newT.z != oldT.z) onTransitZ(oldT.z, newT.z) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 6441d0f9cb5..0f872b599a1 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -218,6 +218,8 @@ var/travelDir = 0 //direction the shuttle would travel in var/rebuildable = 0 //can build new shuttle consoles for this one + var/mob/last_caller // Who called the shuttle the last time + var/obj/docking_port/stationary/destination var/obj/docking_port/stationary/previous @@ -496,7 +498,7 @@ areaInstance.moving = TRUE //move mobile to new location for(var/atom/movable/AM in T0) - AM.onShuttleMove(T0, T1, rotation) + AM.onShuttleMove(T0, T1, rotation, last_caller) if(rotation) T1.shuttleRotate(rotation) @@ -809,9 +811,10 @@ // Seriously, though, NEVER trust a Topic with something like this. Ever. message_admins("move HREF ([src] attempted to move to: [href_list["move"]]) exploit attempted by [key_name_admin(usr)] on [src] (JMP)") return - switch(SSshuttle.moveShuttle(shuttleId, href_list["move"], 1)) + switch(SSshuttle.moveShuttle(shuttleId, href_list["move"], 1, usr)) if(0) atom_say("Shuttle departing! Please stand away from the doors.") + usr.create_log(MISC_LOG, "used [src] to call the [shuttleId] shuttle") if(1) to_chat(usr, "Invalid shuttle requested.") else