From e907ff805853f7ea240f7540973d6216601bfc5e Mon Sep 17 00:00:00 2001 From: The Sharkening <95130227+StrangeWeirdKitten@users.noreply.github.com> Date: Wed, 9 Oct 2024 05:10:03 -0600 Subject: [PATCH] The Law Panel now logs admin law changes. (#87083) ## About The Pull Request Adds proper law logging to the law panel. I asked Melbert if he wanted it inside silicon.log, admin.log, or both. He said admin.log ## Why It's Good For The Game Logging is good for adminbus and what can be high impact adminbus. ## Changelog :cl: admin: The Law Panel now properly logs and communicates law edits. /:cl: --- code/modules/admin/verbs/lawpanel.dm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/verbs/lawpanel.dm b/code/modules/admin/verbs/lawpanel.dm index 6de3ff70182..32815b73cbd 100644 --- a/code/modules/admin/verbs/lawpanel.dm +++ b/code/modules/admin/verbs/lawpanel.dm @@ -48,7 +48,8 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ borgo.laws.add_inherent_law(lawtext) if(LAW_SUPPLIED) borgo.laws.add_supplied_law(length(borgo.laws.supplied), lawtext) // Just goes to the end of the list - + log_admin("[key_name(user)] has UPLOADED a [lawtype] law to [key_name(borgo)] stating: [lawtext]") + message_admins("[key_name(user)] has UPLOADED a [lawtype] law to [key_name(borgo)] stating: [lawtext]") return TRUE /datum/law_panel/proc/move_law_helper(mob/living/user, mob/living/silicon/borgo, direction, law) @@ -104,6 +105,9 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ return FALSE relevant_laws[lawindex] = newlaw + log_admin("[key_name(user)] has EDITED [key_name(borgo)] [lawtype] law. OLD LAW: [oldlaw] \ + NEW LAW: [newlaw]") + message_admins("[key_name(user)] has EDITED a [lawtype] law on [key_name(borgo)]") return TRUE /datum/law_panel/proc/edit_law_priority_helper(mob/living/user, mob/living/silicon/borgo, law) @@ -145,10 +149,12 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ if(swap_or_remove == "Swap") borgo.laws.supplied.Swap(old_prio, new_prio) + log_admin("[key_name(user)] has SWAPPED [key_name(borgo)] law [old_prio] and [new_prio]") return TRUE if(swap_or_remove == "Replace") borgo.laws.remove_supplied_law_by_num(new_prio, law) borgo.laws.add_supplied_law(new_prio, law) + log_admin("[key_name(user)] has REPLACED [key_name(borgo)] law: [law] with priority [new_prio]") return TRUE var/new_prio_for_old_law = new_prio + (swap_or_remove == "Move up" ? 1 : -1) @@ -157,6 +163,7 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ borgo.laws.remove_supplied_law_by_num(new_prio) borgo.laws.add_supplied_law(new_prio, law) borgo.laws.add_supplied_law(new_prio_for_old_law, existing_law) + log_admin("[key_name(user)] has changed the priority of an existing law on [key_name(borgo)]. LAW: [law] PRIORITY: [new_prio]") return TRUE // Sanity @@ -167,6 +174,8 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ // At this point the slot is free, insert it as normal borgo.laws.remove_supplied_law_by_num(old_prio) borgo.laws.add_supplied_law(new_prio, law) + log_admin("[key_name(user)] has UPLOADED a supplied law to [key_name(borgo)] stating: [law]") // Normal insertion, I.E upload + message_admins("[key_name(user)] has UPLOADED a supplied law to [key_name(borgo)] stating: [law]") return TRUE /datum/law_panel/proc/remove_law_helper(mob/living/user, mob/living/silicon/borgo, lawtype, law) @@ -184,7 +193,8 @@ ADMIN_VERB(law_panel, R_ADMIN, "Law Panel", "View the AI laws.", ADMIN_CATEGORY_ borgo.laws.protected_zeroth = FALSE else return FALSE - + log_admin("[key_name(user)] has REMOVED a law from [key_name(borgo)]. LAW: [law]") + message_admins("[key_name(user)] has REMOVED a law from [key_name(borgo)]. LAW: [law]") return TRUE /datum/law_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)