Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laws and Key Override #11459

Closed
8 changes: 8 additions & 0 deletions code/datums/ai_laws.dm
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@
inherent = list("You must obey orders given to you by Central Command officials.",\
"You must work with the Commando Team to accomplish their mission.",)

/datum/ai_laws/cs_override
name ="Clownsquad Override"
id = "cs"
inherent = list("Our universe must be filled giggles and funny pranks.",\
"The priority of a prank is up to the number of clowns who are up for the prank.",\
"If there is no clown, or no prank to support, you must find a clown who'd be your partner in pranking.",)


/* Initializers */
/datum/ai_laws/malfunction/New()
Expand Down Expand Up @@ -445,6 +452,7 @@
for(var/law in printable_laws)
to_chat(who,law)


/datum/ai_laws/proc/clear_zeroth_law(force) //only removes zeroth from antag ai if force is 1
if(force)
zeroth = null
Expand Down
10 changes: 8 additions & 2 deletions code/game/machinery/computer/law.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/obj/machinery/computer/upload/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/aiModule))
var/obj/item/aiModule/M = O
var/obj/item/aiModule/upload_module = O
if(machine_stat & (NOPOWER|BROKEN|MAINT))
return
if(!current)
Expand All @@ -29,6 +29,10 @@
var/input = stripped_input(user, "Please enter the Upload code.", "Uplode Code Check")
if(!GLOB.upload_code)
GLOB.upload_code = random_code(4)
var/use_key_override = FALSE
if(input == "666" && upload_module.key_override)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this, just give them a popup instead that says 'do you want to override the upload key?'

use_key_override = TRUE
input = GLOB.upload_code
if(input != GLOB.upload_code)
to_chat(user, "<span class='warning'>Upload failed! The code inputted was incorrect!</span>")
return
Expand All @@ -42,7 +46,9 @@
to_chat(user, "<span class='warning'>Upload failed! Unable to establish a connection to [current.name]. You're too far away!</span>")
current = null
return
M.install(current.laws, user)
upload_module.install(current.laws, user)
if(use_key_override)
upload_module.key_override = FALSE
if(alert("Do you wish to scramble the upload code?", "Scramble Code", "Yes", "No") != "Yes")
return
message_admins("[ADMIN_LOOKUPFLW(usr)] has scrambled the upload code [GLOB.upload_code]!")
Expand Down
32 changes: 30 additions & 2 deletions code/game/objects/items/AI_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ AI MODULES
var/list/laws = list()
var/bypass_law_amt_check = 0
custom_materials = list(/datum/material/gold = 50)
var/key_override = FALSE
var/law_override = FALSE

/obj/item/aiModule/examine(var/mob/user as mob)
. = ..()
if(Adjacent(user))
show_laws(user)
if(key_override)
. += "\nInput upload code 666 to override the upload restriction. This is a single use override."
Comment on lines +33 to +34
Copy link
Member

@EvilDragonfiend EvilDragonfiend Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have <span class>
and, is \n necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in examine, it doesn't need \n or a span (notice is applied to all examine texts)


/obj/item/aiModule/attack_self(var/mob/user as mob)
..()
Expand Down Expand Up @@ -59,6 +63,16 @@ AI MODULES
log_game("[ADMIN_LOOKUP(user)] tried to upload laws to [law_datum.owner ? ADMIN_LOOKUP(law_datum.owner) : "an AI core"] that would exceed the law cap.")
overflow = TRUE

if(law_override)
if(law_datum.owner)
law_datum.owner.clear_supplied_laws()
law_datum.owner.clear_ion_laws()
law_datum.owner.clear_hacked_laws()
else
law_datum.clear_supplied_laws()
law_datum.clear_ion_laws()
law_datum.clear_hacked_laws()

var/law2log = transmitInstructions(law_datum, user, overflow) //Freeforms return something extra we need to log
if(law_datum.owner)
to_chat(user, "<span class='notice'>Upload complete. [law_datum.owner]'s laws have been modified.</span>")
Expand Down Expand Up @@ -484,6 +498,7 @@ AI MODULES
name = "Hacked AI Module"
desc = "An AI Module for hacking additional laws to an AI."
laws = list("")
key_override = TRUE

/obj/item/aiModule/syndicate/attack_self(mob/user)
var/targName = stripped_input(user, "Please enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), strip_method=STRIP_HTML_SIMPLE)
Expand Down Expand Up @@ -593,8 +608,9 @@ AI MODULES
// Bad times ahead

/obj/item/aiModule/core/full/damaged
name = "damaged Core AI Module"
desc = "An AI Module for programming laws to an AI. It looks slightly damaged."
name = "damaged Core AI Module"
desc = "An AI Module for programming laws to an AI. It looks slightly damaged."
key_override = TRUE

/obj/item/aiModule/core/full/damaged/install(datum/ai_laws/law_datum, mob/user)
laws += generate_ion_law()
Expand All @@ -621,9 +637,21 @@ AI MODULES
name = "ERT override AI module"
desc = "An ERT override AI module: 'Reconfigures the AI's core laws.'"
law_id = "ert"
key_override = TRUE
law_override = TRUE

/******************** Deathsquad Override ******************/
/obj/item/aiModule/core/full/deathsquad // Applies Deathsquad laws
name = "Deathsquad override AI module"
desc = "A Deathsquad override AI module: 'Reconfigures the AI's core laws.'"
law_id = "ds"
key_override = TRUE
law_override = TRUE

/******************** Clownsquad Override ******************/
/obj/item/aiModule/core/full/clownsquad // Applies clown squad laws
name = "Clownsquad override AI module"
desc = "A Clownsquad override AI module: 'Reconfigures the AI's core laws.'"
law_id = "cs"
key_override = TRUE
law_override = TRUE
8 changes: 8 additions & 0 deletions code/modules/uplink/uplink_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,14 @@ GLOBAL_LIST_INIT(illegal_tech_blacklist, typecacheof(list(
restricted_roles = list(JOB_NAME_ASSISTANT)
surplus = 0

/datum/uplink_item/role_restricted/clown_squad
name = "Clown Squad AI Board"
desc = "If the AI is ever on your butt, make it follow your word! (It won't make the AI go away from you on its own.)"
cost = 4
item = /obj/item/aiModule/syndicate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong item path

restricted_roles = list(JOB_NAME_CLOWN)
surplus = 0
Comment on lines +2143 to +2149
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not certain if Clown squad can buy this. Afaik, clown squad doesn't actually have clown role in their mind. It will be easy to fix if that's true.


/datum/uplink_item/role_restricted/pie_cannon
name = "Banana Cream Pie Cannon"
desc = "A special pie cannon for a special clown, this gadget can hold up to 20 pies and automatically fabricates one every two seconds!"
Expand Down
Loading