Adds a max length config option for AI law upload boards. (#42700)

* Adds a length check for freeforms, 250 char cap

* added a define as requested.

* Actually it's better if it applies to all boards

* Now it's better good

Also added a max to the Asimov board that was missing it before.

* Better defined

* Undefining defines

* Config code

* Adding config line

* whoops

* Update AI_modules.dm
This commit is contained in:
zxaber
2019-02-12 12:18:17 -08:00
committed by moo
parent 3229426124
commit aba756ea58
3 changed files with 16 additions and 4 deletions

View File

@@ -306,6 +306,9 @@
value_mode = VALUE_MODE_NUM
splitter = ","
/datum/config_entry/number/max_law_len
config_entry_value = 1024
/datum/config_entry/number/overflow_cap
config_entry_value = -1
min_val = -1

View File

@@ -238,7 +238,7 @@ AI MODULES
return
newpos = 15
lawpos = min(newpos, 50)
var/targName = stripped_input(user, "Please enter a new law for the AI.", "Freeform Law Entry", laws[1])
var/targName = stripped_input(user, "Please enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len))
if(!targName)
return
laws[1] = targName
@@ -365,7 +365,7 @@ AI MODULES
var/subject = "human being"
/obj/item/aiModule/core/full/asimov/attack_self(var/mob/user as mob)
var/targName = stripped_input(user, "Please enter a new subject that asimov is concerned with.", "Asimov to whom?", subject)
var/targName = stripped_input(user, "Please enter a new subject that asimov is concerned with.", "Asimov to whom?", subject, MAX_NAME_LEN)
if(!targName)
return
subject = targName
@@ -447,7 +447,7 @@ AI MODULES
laws = list("")
/obj/item/aiModule/core/freeformcore/attack_self(mob/user)
var/targName = stripped_input(user, "Please enter a new core law for the AI.", "Freeform Law Entry", laws[1])
var/targName = stripped_input(user, "Please enter a new core law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len))
if(!targName)
return
laws[1] = targName
@@ -499,7 +499,7 @@ AI MODULES
laws = list("")
/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])
var/targName = stripped_input(user, "Please enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len))
if(!targName)
return
laws[1] = targName

View File

@@ -417,6 +417,15 @@ LAW_WEIGHT buildawall,0
## Attempting to upload laws past this point will fail unless the AI is reset
SILICON_MAX_LAW_AMOUNT 12
##------------------------------------------------
## SILICON LAW MAX LENGTH ###
## The maximum number of characters in a law uploaded
## Affects Freeform, Core Freeform, and Syndicate Hacked boards.
#MAX_LAW_LEN 1024
##------------------------------------------------
## Roundstart Races
##-------------------------------------------------------------------------------------------
## Uncommenting races will allow them to be choosen at roundstart while join_with_muntant_race is on. You'll need at least one.