From f70b534aee7a5d06622fde4a03a8b5ffa4b2d9ec Mon Sep 17 00:00:00 2001 From: Vi3trice <80771500+Vi3trice@users.noreply.github.com> Date: Tue, 21 Nov 2023 07:59:45 -0500 Subject: [PATCH] Tweaks Load Lawset to differentiate between admins and normal players, admins can choose to not change zeroth laws (#22842) * Naughty borgs * I'm warning you * typo * Update law_manager.dm --- code/datums/ai_laws_datums.dm | 5 +++-- code/modules/tgui/modules/law_manager.dm | 17 +++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/datums/ai_laws_datums.dm b/code/datums/ai_laws_datums.dm index 8f0900921a1..36480f690a9 100644 --- a/code/datums/ai_laws_datums.dm +++ b/code/datums/ai_laws_datums.dm @@ -72,9 +72,10 @@ if(istype(AL)) sorted_laws += AL -/datum/ai_laws/proc/sync(mob/living/silicon/S, full_sync = 1) +/datum/ai_laws/proc/sync(mob/living/silicon/S, full_sync = TRUE, change_zeroth = TRUE) // Add directly to laws to avoid log-spam - S.sync_zeroth(zeroth_law, zeroth_law_borg) + if(change_zeroth) + S.sync_zeroth(zeroth_law, zeroth_law_borg) if(full_sync || ion_laws.len) S.laws.clear_ion_laws() diff --git a/code/modules/tgui/modules/law_manager.dm b/code/modules/tgui/modules/law_manager.dm index 25c7758c844..667c0a57b10 100644 --- a/code/modules/tgui/modules/law_manager.dm +++ b/code/modules/tgui/modules/law_manager.dm @@ -125,12 +125,17 @@ owner.statelaws(ALs) if("transfer_laws") - if(is_malf(usr)) - var/datum/ai_laws/ALs = locate(params["transfer_laws"]) in (is_admin(usr) ? admin_laws : player_laws) - if(ALs) - log_and_message_admins("has transfered the [ALs.name] laws to [owner].") - ALs.sync(owner, 0) - current_view = 0 + if(!is_malf(usr)) + return + var/admin_overwrite = is_admin(usr) + var/datum/ai_laws/ALs = locate(params["transfer_laws"]) in (admin_overwrite ? admin_laws : player_laws) + if(!ALs) + return + if(admin_overwrite && alert("Do you want to overwrite [owner]'s zeroth law? If the chosen lawset has no zeroth law while [owner] has one, it will get removed!", "Load Lawset", "Yes", "No") != "Yes") + admin_overwrite = FALSE + log_and_message_admins("has transfered the [ALs.name] laws to [owner][admin_overwrite ? " and overwrote their zeroth law":""].") + ALs.sync(owner, FALSE, admin_overwrite) + current_view = 0 if("notify_laws") to_chat(owner, "Law Notice")