Adds more extensive config settings for human authority (#86886)

## About The Pull Request
Before there were two settings for human authority:
`ENFORCE_HUMAN_AUTHORITY` and `ENFORCE_HUMAN_AUTHORITY_ON_EVERYONE`
The first, if enabled, would not let non-humans be heads of staff unless
they had a specific var on their job set to TRUE.
The second, if enabled, would simply ignore that var and reject the
non-human anyways.

This PR replaces both of those settings with a single one,
`HUMAN_AUTHORITY`. You can set it to one of four settings:
* "OFF": human authority will be turned OFF. Non-Humans will be able to
be heads of staff.
* "HUMAN WHITELIST": human authority will be turned OFF, HOWEVER; if a
job has its new `human_authority` variable set to
`JOB_AUTHORITY_HUMANS_ONLY`, then whoever picks that job will be forced
to be human.
* "NON-HUMAN WHITELIST": human authority will be turned ON. However, if
a job has its `human_authority` variable set to
`JOB_AUTHORITY_NON_HUMANS_ALLOWED`, a non-human can become that job.
This is what we have now, it works the same as if
`ENFORCE_HUMAN_AUTHORITY` were turned on. This is also what I've set as
the default value.
* "ENFORCED" human authority will be turned ON. Non-Humans will never be
able to be heads of staff. This is what
`ENFORCE_HUMAN_AUTHORITY_ON_EVERYONE` used to do.

You can also now set the `human_authority` variable through
`jobconfig.toml`!

## Why It's Good For The Game

Allows more configuration options for downstreams, and lets keyholders
and headmins have more options over how to set up human authority.

## Changelog
🆑
config: Both human authority settings were combined into a singular one,
allowing for more flexibility
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
# Conflicts:
#	config/game_options.txt
#	config/jobconfig.toml
This commit is contained in:
Ilán Mori
2024-11-11 00:43:39 -08:00
committed by Majkl-J
parent dc9bfc883a
commit 9facb9914a
24 changed files with 148 additions and 39 deletions
@@ -107,9 +107,22 @@
/datum/config_entry/flag/protect_assistant_from_antagonist //If assistants can be traitor/cult/other
/datum/config_entry/flag/enforce_human_authority //If non-human species are barred from joining as a head of staff
/datum/config_entry/string/human_authority //Controls how to enforce human authority
default = "HUMAN_WHITELIST"
/datum/config_entry/flag/enforce_human_authority_on_everyone //If non-human species are barred from joining as a head of staff, including jobs flagged as allowed for non-humans, ie. Quartermaster.
/////////////////////////////////////////////////Outdated human authority settings
/datum/config_entry/flag/enforce_human_authority
deprecated_by = /datum/config_entry/string/human_authority
/datum/config_entry/flag/enforce_human_authority/DeprecationUpdate(value)
return value ? HUMAN_AUTHORITY_NON_HUMAN_WHITELIST : HUMAN_AUTHORITY_DISABLED
/datum/config_entry/flag/enforce_human_authority_on_everyone
deprecated_by = /datum/config_entry/string/human_authority
/datum/config_entry/flag/enforce_human_authority_on_everyone/DeprecationUpdate(value)
return value ? HUMAN_AUTHORITY_ENFORCED : HUMAN_AUTHORITY_DISABLED
/////////////////////////////////////////////////
/datum/config_entry/flag/allow_latejoin_antagonists // If late-joining players can be traitor/changeling
@@ -133,6 +133,11 @@
var/list/working_list = list()
for(var/config_datum_key in job_config_datum_singletons)
var/datum/job_config_type/config_datum = job_config_datum_singletons[config_datum_key]
// Dont make the entry if it doesn't apply to this job
if(!config_datum.validate_entry(occupation))
continue
var/config_read_value = job_config[job_key][config_datum_key]
if(!config_datum.validate_value(config_read_value))
working_list += list(
@@ -155,6 +160,11 @@
var/returnable_list = list()
for(var/config_datum_key in job_config_datum_singletons)
var/datum/job_config_type/config_datum = job_config_datum_singletons[config_datum_key]
// Dont make the entry if it doesn't apply to this job
if(!config_datum.validate_entry(new_occupation))
continue
// Remember, every time we write the TOML from scratch, we want to have it commented out by default.
// This is to ensure that the server operator knows that they are overriding codebase defaults when they remove the comment.
// Having comments mean that we allow server operators to defer to codebase standards when they deem acceptable. They must uncomment to override the codebase default.
@@ -171,6 +181,11 @@
var/list/datums_to_read = job_config_datum_singletons - list(JOB_CONFIG_TOTAL_POSITIONS, JOB_CONFIG_SPAWN_POSITIONS)
for(var/config_datum_key in datums_to_read)
var/datum/job_config_type/config_datum = job_config_datum_singletons[config_datum_key]
// Dont make the entry if it doesn't apply to this job
if(!config_datum.validate_entry(new_occupation))
continue
returnable_list += list(
"# [config_datum_key]" = config_datum.get_current_value(new_occupation),
)