mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-20 14:04:43 +00:00
## 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 /🆑
69 lines
3.4 KiB
Plaintext
69 lines
3.4 KiB
Plaintext
/* CONTAINS:
|
|
* /obj/item/ai_module/core/freeformcore
|
|
* /obj/item/ai_module/supplied/freeform
|
|
**/
|
|
|
|
/obj/item/ai_module/core/freeformcore
|
|
name = "'Freeform' Core AI Module"
|
|
laws = list("")
|
|
|
|
/obj/item/ai_module/core/freeformcore/attack_self(mob/user)
|
|
var/targName = tgui_input_text(user, "Enter a new core law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), TRUE)
|
|
if(!targName || !user.is_holding(src))
|
|
return
|
|
if(is_ic_filtered(targName))
|
|
to_chat(user, span_warning("Error: Law contains invalid text."))
|
|
return
|
|
var/list/soft_filter_result = is_soft_ooc_filtered(targName)
|
|
if(soft_filter_result)
|
|
if(tgui_alert(user,"Your law contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to use it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
|
|
return
|
|
message_admins("[ADMIN_LOOKUPFLW(user)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term for an AI law. Law: \"[html_encode(targName)]\"")
|
|
log_admin_private("[key_name(user)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term for an AI law. Law: \"[targName]\"")
|
|
laws[1] = targName
|
|
..()
|
|
|
|
/obj/item/ai_module/core/freeformcore/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
|
|
..()
|
|
return laws[1]
|
|
|
|
/obj/item/ai_module/supplied/freeform
|
|
name = "'Freeform' AI Module"
|
|
lawpos = 15
|
|
laws = list("")
|
|
|
|
/obj/item/ai_module/supplied/freeform/attack_self(mob/user)
|
|
var/newpos = tgui_input_number(user, "Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority ", lawpos, 50, 15)
|
|
if(!newpos || !user.is_holding(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH))
|
|
return
|
|
lawpos = newpos
|
|
var/targName = tgui_input_text(user, "Enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), TRUE)
|
|
if(!targName || !user.is_holding(src))
|
|
return
|
|
if(is_ic_filtered(targName))
|
|
to_chat(user, span_warning("Error: Law contains invalid text.")) // AI LAW 2 SAY U W U WITHOUT THE SPACES
|
|
return
|
|
var/list/soft_filter_result = is_soft_ooc_filtered(targName)
|
|
if(soft_filter_result)
|
|
if(tgui_alert(user,"Your law contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to use it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
|
|
return
|
|
message_admins("[ADMIN_LOOKUPFLW(user)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term for an AI law. Law: \"[html_encode(targName)]\"")
|
|
log_admin_private("[key_name(user)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term for an AI law. Law: \"[targName]\"")
|
|
laws[1] = targName
|
|
..()
|
|
|
|
/obj/item/ai_module/supplied/freeform/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
|
|
if(!overflow)
|
|
..()
|
|
else if(law_datum.owner)
|
|
law_datum.owner.replace_random_law(laws[1], list(LAW_SUPPLIED), LAW_SUPPLIED)
|
|
else
|
|
law_datum.replace_random_law(laws[1], list(LAW_SUPPLIED), LAW_SUPPLIED)
|
|
return laws[1]
|
|
|
|
/obj/item/ai_module/supplied/freeform/install(datum/ai_laws/law_datum, mob/user)
|
|
if(laws[1] == "")
|
|
to_chat(user, span_alert("No law detected on module, please create one."))
|
|
return 0
|
|
..()
|