[MIRROR] Adds logging for all Silicon rather than just Laws [MDB IGNORE] (#9346)

* Adds logging for all Silicon rather than just Laws (#62500)

I find stuffing everything in game.log is a real problem when you need to actually find useful information about what happened to a specific Silicon. It's hard to tell what happened to Silicon throughout a round, even when crossreferencing attack/game logs, so having a Silicon log for all the information related to them would be really useful.
For example, a Cyborg can spawn unlinked on Robocop, go Janitor and crowbar someone to death with a Robodoctor AI. When looking through logs, an Admin can easily assume it was a rogue Engineering cyborg who disobeyed their laws to kill someone.
This also isn't adding a whole new log file, more than it is just renaming the law log file to silicon and adding more useful things into it, so it isn't logging bloat (if that's even a concern)

* Adds logging for all Silicon rather than just Laws

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-11-09 14:16:27 -05:00
committed by GitHub
co-authored by John Willard
parent 41e03f6b35
commit ad008ecfa6
15 changed files with 50 additions and 21 deletions
+2
View File
@@ -30,6 +30,8 @@
for(var/mob/living/silicon/robot/R in GLOB.silicon_mobs)
if(!R.connected_ai)
R.TryConnectToAI()
var/mob/living/silicon/ai/ai_spawn = spawned
ai_spawn.log_current_laws()
/datum/job/ai/get_roundstart_spawn_point()
+2 -1
View File
@@ -28,7 +28,8 @@
spawned.gender = NEUTER
var/mob/living/silicon/robot/robot_spawn = spawned
robot_spawn.notify_ai(AI_NOTIFICATION_NEW_BORG)
if(!robot_spawn.connected_ai) // Only log if there's no Master AI
robot_spawn.log_current_laws()
/datum/job/cyborg/radio_help_message(mob/M)
to_chat(M, "<b>Prefix your message with :b to speak with other cyborgs and AI.</b>")
+7 -3
View File
@@ -165,9 +165,13 @@
deploy_action.Grant(src)
if(isturf(loc))
add_verb(src, list(/mob/living/silicon/ai/proc/ai_network_change, /mob/living/silicon/ai/proc/ai_hologram_change, \
/mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, \
/mob/living/silicon/ai/proc/set_automatic_say_channel))
add_verb(src, list(
/mob/living/silicon/ai/proc/ai_network_change,
/mob/living/silicon/ai/proc/ai_hologram_change,
/mob/living/silicon/ai/proc/botcall,
/mob/living/silicon/ai/proc/control_integrated_radio,
/mob/living/silicon/ai/proc/set_automatic_say_channel,
))
GLOB.ai_list += src
GLOB.shuttle_caller_list += src
+5
View File
@@ -5,6 +5,11 @@
if (!laws)
make_laws()
/mob/living/silicon/proc/log_current_laws()
var/list/the_laws = laws.get_law_list(include_zeroth = TRUE)
var/lawtext = the_laws.Join(" ")
log_silicon("LAW: [key_name(src)] spawned with [lawtext]")
/mob/living/silicon/proc/deadchat_lawchange()
var/list/the_laws = laws.get_law_list(include_zeroth = TRUE)
var/lawtext = the_laws.Join("<br/>")
+10 -5
View File
@@ -176,11 +176,13 @@
to_chat(src,span_userdanger("ERROR: Model installer reply timeout. Please check internal connections."))
return
var/list/model_list = list("Engineering" = /obj/item/robot_model/engineering, \
"Medical" = /obj/item/robot_model/medical, \
"Miner" = /obj/item/robot_model/miner, \
"Janitor" = /obj/item/robot_model/janitor, \
"Service" = /obj/item/robot_model/service)
var/list/model_list = list(
"Engineering" = /obj/item/robot_model/engineering,
"Medical" = /obj/item/robot_model/medical,
"Miner" = /obj/item/robot_model/miner,
"Janitor" = /obj/item/robot_model/janitor,
"Service" = /obj/item/robot_model/service,
)
if(!CONFIG_GET(flag/disable_peaceborg))
model_list["Peacekeeper"] = /obj/item/robot_model/peacekeeper
if(!CONFIG_GET(flag/disable_secborg))
@@ -365,6 +367,7 @@
message_admins(span_notice("[ADMIN_LOOKUPFLW(usr)] detonated [key_name_admin(src, client)] at [ADMIN_VERBOSEJMP(groundzero)]!"))
log_game("[key_name(usr)] detonated [key_name(src)]!")
log_combat(usr, src, "detonated cyborg")
log_silicon("CYBORG: [key_name(src)] has been detonated by [key_name(usr)].")
if(connected_ai)
to_chat(connected_ai, "<br><br>[span_alert("ALERT - Cyborg detonation detected: [name]")]<br>")
@@ -380,6 +383,7 @@
lawupdate = FALSE
set_lockcharge(FALSE)
scrambledcodes = TRUE
log_silicon("CYBORG: [key_name(src)] has been unlinked from an AI.")
//Disconnect it's camera so it's not so easily tracked.
if(!QDELETED(builtInCamera))
QDEL_NULL(builtInCamera)
@@ -694,6 +698,7 @@
hasAffection = FALSE //Just so they can get the affection modules back if they want them.
//SKYRAT EDIT ADDITION END
logevent("Chassis model has been reset.")
log_silicon("CYBORG: [key_name(src)] has reset their cyborg model.")
model.transform_to(/obj/item/robot_model)
// Remove upgrades.
@@ -339,12 +339,12 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real
to_chat(src, span_danger("ALERT: Foreign software execution prevented."))
logevent("ALERT: Foreign software execution prevented.")
to_chat(connected_ai, span_danger("ALERT: Cyborg unit \[[src]\] successfully defended against subversion."))
log_game("[key_name(user)] attempted to emag cyborg [key_name(src)], but they were slaved to traitor AI [connected_ai].")
log_silicon("EMAG: [key_name(user)] attempted to emag cyborg [key_name(src)], but they were slaved to traitor AI [connected_ai].")
return
if(shell) //AI shells cannot be emagged, so we try to make it look like a standard reset. Smart players may see through this, however.
to_chat(user, span_danger("[src] is remotely controlled! Your emag attempt has triggered a system reset instead!"))
log_game("[key_name(user)] attempted to emag an AI shell belonging to [key_name(src) ? key_name(src) : connected_ai]. The shell has been reset as a result.")
log_silicon("EMAG: [key_name(user)] attempted to emag an AI shell belonging to [key_name(src) ? key_name(src) : connected_ai]. The shell has been reset as a result.")
ResetModel()
return
@@ -353,7 +353,7 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real
lawupdate = FALSE
set_connected_ai(null)
message_admins("[ADMIN_LOOKUPFLW(user)] emagged cyborg [ADMIN_LOOKUPFLW(src)]. Laws overridden.")
log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
log_silicon("EMAG: [key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
var/time = time2text(world.realtime,"hh:mm:ss")
if(user)
GLOB.lawchanges.Add("[time] <B>:</B> [user.name]([user.key]) emagged [name]([key])")
@@ -188,6 +188,7 @@
new_model.rebuild_modules()
cyborg.radio.recalculateChannels()
cyborg.set_modularInterface_theme()
log_silicon("CYBORG: [key_name(cyborg)] has transformed into the [new_model] model.")
//SKYRAT EDIT ADDITION BEGIN - ALTBORGS - Old check for 'dogborg' var no longer necessary, refactored into model_features instead.
if(cyborg.is_dogborg()) //Should pass because model was set previously.