Skip to content

Commit

Permalink
Fixes Stacking with the Check AI Laws verb (ParadiseSS13#27497)
Browse files Browse the repository at this point in the history
  • Loading branch information
Contrabang authored Nov 30, 2024
1 parent f1b3b0e commit eea4872
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
12 changes: 12 additions & 0 deletions code/datums/ai_laws_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@
else
to_chat(who, "[law.get_index()]. [law.law]")

/datum/ai_laws/proc/return_laws_text()
. = list()
sort_laws()
for(var/datum/ai_law/law in sorted_laws)
if(law == zeroth_law_borg)
continue
if(law == zeroth_law)
. += "<span class='danger'>[law.get_index()]. [law.law]</span>"
else
. += "[law.get_index()]. [law.law]"


/********************
* Stating Laws *
********************/
Expand Down
22 changes: 13 additions & 9 deletions code/modules/admin/misc_admin_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -795,30 +795,34 @@ GLOBAL_VAR_INIT(disable_explosions, FALSE)

/datum/admins/proc/output_ai_laws()
var/ai_number = 0
var/list/messages = list()
for(var/mob/living/silicon/S in GLOB.mob_list)
if(istype(S, /mob/living/silicon/decoy) && !S.client)
continue
ai_number++
if(isAI(S))
to_chat(usr, "<b>AI [key_name(S, TRUE)]'s laws:</b>")
messages += "<b>AI [key_name(S, TRUE)]'s laws:</b>"
else if(isrobot(S))
var/mob/living/silicon/robot/R = S
to_chat(usr, "<b>CYBORG [key_name(S, TRUE)]'s [R.connected_ai?"(Slaved to: [R.connected_ai])":"(Independent)"] laws:</b>")
messages += "<b>CYBORG [key_name(S, TRUE)]'s [R.connected_ai?"(Slaved to: [R.connected_ai])":"(Independent)"] laws:</b>"
else if(ispAI(S))
var/mob/living/silicon/pai/P = S
to_chat(usr, "<b>pAI [key_name(S, TRUE)]'s laws:</b>")
to_chat(usr, "[P.pai_law0]")
messages += "<b>pAI [key_name(S, TRUE)]'s laws:</b>"
messages += "[P.pai_law0]"
if(P.pai_laws)
to_chat(usr, "[P.pai_laws]")
messages += "[P.pai_laws]"
continue // Skip showing normal silicon laws for pAIs - they don't have any
else
to_chat(usr, "<b>SILICON [key_name(S, TRUE)]'s laws:</b>")
messages += "<b>SILICON [key_name(S, TRUE)]'s laws:</b>"

if(S.laws == null)
to_chat(usr, "[key_name(S, TRUE)]'s laws are null. Contact a coder.")
messages += "[key_name(S, TRUE)]'s laws are null. Contact a coder."
else
S.laws.show_laws(usr)
messages += S.laws.return_laws_text()
if(!ai_number)
to_chat(usr, "<b>No AI's located.</b>")//Just so you know the thing is actually working and not just ignoring you.
messages += "<b>No AI's located.</b>" //Just so you know the thing is actually working and not just ignoring you.

to_chat(usr, chat_box_examine(messages.Join("\n")))

log_admin("[key_name(usr)] checked the AI laws")
message_admins("[key_name_admin(usr)] checked the AI laws")
Expand Down

0 comments on commit eea4872

Please sign in to comment.