This commit is contained in:
kevinz000
2019-08-07 13:07:38 -07:00
parent 39dea966ae
commit 277971971f
9 changed files with 92 additions and 2 deletions

View File

@@ -19,6 +19,7 @@
var/abstract_type = /datum/config_entry //do not instantiate if type matches this
var/vv_VAS = TRUE //Force validate and set on VV. VAS proccall guard will run regardless.
var/postload_required = FALSE //requires running OnPostload()
var/dupes_allowed = FALSE
@@ -72,6 +73,9 @@
/datum/config_entry/proc/DeprecationUpdate(value)
return
/datum/config_entry/proc/OnPostload()
return
/datum/config_entry/string
config_entry_value = ""
abstract_type = /datum/config_entry/string
@@ -80,7 +84,7 @@
/datum/config_entry/string/vv_edit_var(var_name, var_value)
return var_name != "auto_trim" && ..()
/datum/config_entry/string/ValidateAndSet(str_val)
/datum/config_entry/string/ValidateAndSet(str_val, during_load)
if(!VASProcCallGuard(str_val))
return FALSE
config_entry_value = auto_trim ? trim(str_val) : str_val

View File

@@ -101,6 +101,7 @@
log_config("Loading config file [filename]...")
var/list/lines = world.file2list("[directory]/[filename]")
var/list/_entries = entries
var/list/postload_required = list()
for(var/L in lines)
L = trim(L)
if(!L)
@@ -157,18 +158,24 @@
else
warning("[new_ver.type] is deprecated but gave no proper return for DeprecationUpdate()")
var/validated = E.ValidateAndSet(value)
var/validated = E.ValidateAndSet(value, TRUE)
if(!validated)
log_config("Failed to validate setting \"[value]\" for [entry]")
else
if(E.modified && !E.dupes_allowed)
log_config("Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.")
if(E.postload_required)
postload_required[E] = TRUE
E.resident_file = filename
if(validated)
E.modified = TRUE
for(var/i in postload_required)
var/datum/config_entry/E = i
E.OnPostload()
++.
/datum/controller/configuration/can_vv_get(var_name)

View File

@@ -0,0 +1,22 @@
/datum/config_entry/keyed_list/donator_group
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_FLAG
abstract_type = /datum/config_entry/keyed_list/donator_group
//If we're in the middle of a config load, only do the regeneration afterwards to prevent this from wasting a massive amount of CPU for list regenerations.
/datum/config_entry/keyed_list/donator_group/ValidateAndSet(str_val, during_load)
. = ..()
if(. && during_load)
regenerate_donator_grouping_list()
/datum/config_entry/keyed_list/donator_group/OnPostload()
. = ..()
regenerate_donator_grouping_list()
//This is kinda weird in that the config entries are defined here but all the handling/calculations are in __HELPERS/donator_groupings.dm
/datum/config_entry/keyed_list/donator_group/tier_1_donators
/datum/config_entry/keyed_list/donator_group/tier_2_donators
/datum/config_entry/keyed_list/donator_group/tier_3_donators