mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-15 19:46:38 +00:00
* canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE The most idiotic thing I've seen is canUseTopic's defines, they literally just define TRUE, you can use it however you want, it doesn't matter, it just means TRUE. You can mix and match the args and it will set that arg to true, despite the name. It's so idiotic I decided to remove it, so now I can reclaim a little bit of my sanity.
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)
|
|
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 || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
|
|
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)
|
|
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
|
|
..()
|