From 18af69f81d194d2b7b559cf6cf92f1b148e828ab Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 11 Mar 2023 02:42:17 +0100 Subject: [PATCH] [MIRROR] Fixes the `null` law check for the law panel not working adds an alert for non-observers using it [MDB IGNORE] (#19767) * Fixes the `null` law check for the law panel not working adds an alert for non-observers using it (#73859) ## About The Pull Request - The `null` law check for the law panel existed in the UI side, but on the dm side it didn't pass it as null correctly. Fixes that - Adds a message admins for non-observers using the panel, a la Check Antagonists. Just to be safe ## Changelog Nothing player facing * Fixes the `null` law check for the law panel not working adds an alert for non-observers using it --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com> --- code/modules/admin/verbs/lawpanel.dm | 8 +++++++- tgui/packages/tgui/interfaces/Lawpanel.tsx | 14 +++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/code/modules/admin/verbs/lawpanel.dm b/code/modules/admin/verbs/lawpanel.dm index 92da08b2375..c17a5e3df42 100644 --- a/code/modules/admin/verbs/lawpanel.dm +++ b/code/modules/admin/verbs/lawpanel.dm @@ -4,6 +4,8 @@ if(!check_rights(R_ADMIN)) return + if(!isobserver(usr) && SSticker.HasRoundStarted()) + message_admins("[key_name_admin(usr)] checked AI laws via the Law Panel.") SSblackbox.record_feedback("tally", "admin_verb", 1, "Law Panel") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! var/datum/law_panel/tgui = new() @@ -283,7 +285,11 @@ borg_information["ref"] = REF(borgo) var/datum/ai_laws/lawset = borgo.laws - if(!isnull(lawset)) + if(isnull(lawset)) + // Whoopsie something wrong wrong this isn't supposed to happen + borg_information["laws"] = null + + else var/list/borg_laws = list() // zeroth law on top if(lawset.zeroth || lawset.zeroth_borg) diff --git a/tgui/packages/tgui/interfaces/Lawpanel.tsx b/tgui/packages/tgui/interfaces/Lawpanel.tsx index f14face699d..89df6e688ea 100644 --- a/tgui/packages/tgui/interfaces/Lawpanel.tsx +++ b/tgui/packages/tgui/interfaces/Lawpanel.tsx @@ -48,9 +48,9 @@ type Silicon = { // List of our laws, this is almost never null. If it is null, that's an error. laws: null | Law[]; // String, name of our master AI. Null means no master or we're not a borg - master_ai: null | string; + master_ai?: null | string; // TRUE, we're law-synced to our master AI. FALSE, we're not, null, we're not a borg - borg_synced: null | BooleanLike; + borg_synced?: null | BooleanLike; // REF() to our silicon ref: string; }; @@ -222,15 +222,19 @@ export const SiliconReadout = (props: { cyborg: Silicon }, context) => {
- {cyborg.master_ai && cyborg.borg_synced && ( + {cyborg.master_ai && !!cyborg.borg_synced && ( )} {cyborg.laws === null ? (