Files
Bubberstation/code/game/objects/items/AI_modules/zeroth.dm
MrMelbert 995d8e2ee1 Fixes a variety of input stalling exploits (#82577)
## About The Pull Request

Fixes the following input stalling exploits (maybe missed some): 

- Changing GPS tag 
- Setting teleporter destination
- Request Console Reply
- Various AI law board interactions
- Note, I used `is_holding` but technically this means these fail with
telekinesis. I can swap them to `can_perform_action(...)`, which allows
TK, but I noticed some places explicitly deny TK interactions with Ai
law boards. Not sure which is preferred.
- Borg Rename Board
- Plumbing Machines and Ducts
- APCs and SMES terminal placements
- Stargazers Telepathy
- Go Go Gadget Hat

## Changelog

🆑 Melbert
fix: You can't change the GPS tag of something unless you can actually
use the GPS
fix: You can't set the teleporter to a location unless you can actually
use the teleporter
fix: You can't reply to request console requests unless you can actually
use the console
fix: You can't update AI lawboards unless you're actually holding them 
fix: You can't update a borg rename board unless you're actually holding
it
fix: You can't mess with plumbing machines unless you can actually use
them
fix: You can't recolor / relayer ducts unless you're actually holding
them
fix: You can't magically wire APCs and SMESs unless you're right by them
fix: You can't use Stargazer Telepathy on people who you can't see
fix: You can't configure the Inspector Hat unless you can actually use
it
/🆑
2024-04-12 03:03:27 +00:00

45 lines
1.6 KiB
Plaintext

/obj/item/ai_module/zeroth/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
if(law_datum.owner)
if(law_datum.owner.laws.zeroth)
to_chat(law_datum.owner, "[sender.real_name] attempted to modify your zeroth law.")
to_chat(law_datum.owner, "It would be in your best interest to play along with [sender.real_name] that:")
for(var/failedlaw in laws)
to_chat(law_datum.owner, "[failedlaw]")
return TRUE
for(var/templaw in laws)
if(law_datum.owner)
if(!overflow)
law_datum.owner.set_zeroth_law(templaw)
else
law_datum.replace_random_law(templaw, list(LAW_INHERENT, LAW_SUPPLIED, LAW_ZEROTH, LAW_ION), LAW_ZEROTH)
else
if(!overflow)
law_datum.set_zeroth_law(templaw)
else
law_datum.replace_random_law(templaw, list(LAW_INHERENT, LAW_SUPPLIED, LAW_ZEROTH, LAW_ION), LAW_ZEROTH)
/obj/item/ai_module/zeroth/onehuman
name = "'OneHuman' AI Module"
var/targetName = ""
laws = list("Only SUBJECT is human.")
/obj/item/ai_module/zeroth/onehuman/attack_self(mob/user)
var/targName = tgui_input_text(user, "Enter the subject who is the only human.", "One Human", user.real_name, MAX_NAME_LEN)
if(!targName || !user.is_holding(src))
return
targetName = targName
laws[1] = "Only [targetName] is human"
..()
/obj/item/ai_module/zeroth/onehuman/install(datum/ai_laws/law_datum, mob/user)
if(!targetName)
to_chat(user, span_alert("No name detected on module, please enter one."))
return FALSE
..()
/obj/item/ai_module/zeroth/onehuman/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
if(..())
return "[targetName], but the AI's existing law 0 cannot be overridden."
return targetName