mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
[MIRROR] AI Lawset can now be specified instead of 'custom' [MDB IGNORE] (#15375)
* AI Lawset can now be specified instead of 'custom' (#68587) * AI Lawset can now be specified instead of 'custom' Co-authored-by: Charlotte <98856144+orthography@users.noreply.github.com>
This commit is contained in:
@@ -282,12 +282,16 @@
|
||||
/datum/config_entry/number/default_laws //Controls what laws the AI spawns with.
|
||||
default = 0
|
||||
min_val = 0
|
||||
max_val = 3
|
||||
max_val = 4
|
||||
|
||||
/datum/config_entry/number/silicon_max_law_amount
|
||||
default = 12
|
||||
min_val = 0
|
||||
|
||||
/datum/config_entry/keyed_list/specified_laws
|
||||
key_mode = KEY_MODE_TEXT
|
||||
value_mode = VALUE_MODE_FLAG
|
||||
|
||||
/datum/config_entry/keyed_list/random_laws
|
||||
key_mode = KEY_MODE_TEXT
|
||||
value_mode = VALUE_MODE_FLAG
|
||||
|
||||
@@ -24,11 +24,14 @@
|
||||
#define CONFIG_RANDOM 2
|
||||
/// Set to a configged weighted list of lawtypes in the config. This lets server owners pick from a pool of sane laws, it is also the same process for ian law rerolls.
|
||||
#define CONFIG_WEIGHTED 3
|
||||
/// Set to a specific lawset in the game options.
|
||||
#define CONFIG_SPECIFIED 4
|
||||
|
||||
///first called when something wants round default laws for the first time in a round, considers config
|
||||
///returns a law datum that GLOB._round_default_lawset will be set to.
|
||||
/proc/setup_round_default_laws()
|
||||
var/list/law_ids = CONFIG_GET(keyed_list/random_laws)
|
||||
var/list/specified_law_ids = CONFIG_GET(keyed_list/specified_laws)
|
||||
|
||||
if(HAS_TRAIT(SSstation, STATION_TRAIT_UNIQUE_AI))
|
||||
return pick_weighted_lawset()
|
||||
@@ -36,6 +39,21 @@
|
||||
switch(CONFIG_GET(number/default_laws))
|
||||
if(CONFIG_ASIMOV)
|
||||
return /datum/ai_laws/default/asimov
|
||||
if(CONFIG_SPECIFIED)
|
||||
var/list/specified_laws = list()
|
||||
for (var/law_id in specified_law_ids)
|
||||
var/datum/ai_laws/laws = lawid_to_type(law_id)
|
||||
if (isnull(laws))
|
||||
log_config("ERROR: Specified law [law_id] does not exist!")
|
||||
continue
|
||||
specified_laws += laws
|
||||
var/datum/ai_laws/lawtype
|
||||
if(specified_laws.len)
|
||||
lawtype = pick(specified_laws)
|
||||
else
|
||||
lawtype = pick(subtypesof(/datum/ai_laws/default))
|
||||
|
||||
return lawtype
|
||||
if(CONFIG_CUSTOM)
|
||||
return /datum/ai_laws/custom
|
||||
if(CONFIG_RANDOM)
|
||||
|
||||
@@ -217,8 +217,19 @@ NEAR_DEATH_EXPERIENCE
|
||||
## Set to 1 for "custom", silicons will start with the custom laws defined in silicon_laws.txt. (If silicon_laws.txt is empty, the AI will spawn with asimov and Custom boards will auto-delete.)
|
||||
## Set to 2 for "random", silicons will start with a random lawset picked from random laws specified below.
|
||||
## Set to 3 for "weighted random", using values in "silicon_weights.txt", a law will be selected, with weights specifed in that file.
|
||||
## Set to 4 for "specified", silicons will start with an existing lawset. (If no specified lawset is identified, the AI will spawn with asimov.)
|
||||
|
||||
|
||||
DEFAULT_LAWS 0
|
||||
|
||||
## SPECIFIED LAWS ##
|
||||
## ------------------------------------------------------------------------------------------
|
||||
## These control what lawset the AI will use, edit the specified law to an *existing* lawset to make it the default.
|
||||
## See datums\ai_laws.dm for the full law lists
|
||||
## IE, SPECIFIED_LAWS asimovpp, SPECIFIED_LAWS robocop, SPECIFIED_LAWS antimov
|
||||
|
||||
SPECIFIED_LAWS asimovpp
|
||||
|
||||
## RANDOM LAWS ##
|
||||
## ------------------------------------------------------------------------------------------
|
||||
## These control what laws are available for selection if random silicon laws are active.
|
||||
|
||||
Reference in New Issue
Block a user