Jobs configuration

This commit is contained in:
AffectedArc07
2021-05-03 20:34:51 +01:00
parent 4f80acc360
commit 445726812e
16 changed files with 111 additions and 118 deletions
-58
View File
@@ -46,26 +46,19 @@
var/list/modes = list() // allowed modes
var/list/votable_modes = list() // votable modes
var/list/probabilities = list() // relative probability of each mode
var/humans_need_surnames = 0
var/allow_random_events = 0 // enables random events mid-round when set to 1
var/allow_ai = 1 // allow ai job
var/respawn = 0
var/guest_jobban = 1
var/panic_bunker_threshold = 150 // above this player count threshold, never-before-seen players are blocked from connecting
var/usewhitelist = 0
var/mods_are_mentors = 0
var/load_jobs_from_txt = 0
var/automute_on = 0 //enables automuting/spam prevention
var/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access.
var/round_abandon_penalty_period = 30 MINUTES // Time from round start during which ghosting out is penalized
var/medal_hub_address = null
var/medal_hub_password = null
var/reactionary_explosions = 0 //If we use reactionary explosions, explosions that react to walls and doors
var/assistantlimit = 0 //enables assistant limiting
var/assistantratio = 2 //how many assistants to security members
var/ssd_warning = 0
var/list_afk_minimum = 5 // How long people have to be AFK before it's listed on the "List AFK players" verb
@@ -133,18 +126,11 @@
var/forum_link_url
var/forum_playerinfo_url
var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
var/use_age_restriction_for_antags = 0 //Do antags use account age restrictions? --requires database
var/use_exp_tracking = 0
var/use_exp_restrictions = 0
var/use_exp_restrictions_admin_bypass = 0
var/simultaneous_pm_warning_timeout = 100
var/assistant_maint = 0 //Do assistants get maint access?
var/gateway_delay = 6000
var/ghost_interaction = 0
@@ -286,24 +272,6 @@
if("ban_legacy_system")
config.ban_legacy_system = 1
if("use_age_restriction_for_jobs")
config.use_age_restriction_for_jobs = 1
if("use_age_restriction_for_antags")
config.use_age_restriction_for_antags = 1
if("use_exp_tracking")
config.use_exp_tracking = 1
if("use_exp_restrictions")
config.use_exp_restrictions = 1
if("use_exp_restrictions_admin_bypass")
config.use_exp_restrictions_admin_bypass = 1
if("jobs_have_minimal_access")
config.jobs_have_minimal_access = 1
if("shadowling_max_age")
config.shadowling_max_age = text2num(value)
@@ -385,9 +353,6 @@
if("log_runtime")
config.log_runtimes = 1
if("mentors")
config.mods_are_mentors = 1
if("pregame_timestart")
config.pregame_timestart = text2num(value)
@@ -415,12 +380,6 @@
if("vote_period")
config.vote_period = text2num(value)
if("allow_ai")
config.allow_ai = 1
// if("authentication")
// config.enable_authentication = 1
if("norespawn")
config.respawn = 0
@@ -469,9 +428,6 @@
if("donationsurl")
config.donationsurl = value
if("guest_jobban")
config.guest_jobban = 1
if("guest_ban")
GLOB.guests_allowed = 0
@@ -508,8 +464,6 @@
if("allow_random_events")
config.allow_random_events = 1
if("load_jobs_from_txt")
load_jobs_from_txt = 1
if("forbid_singulo_possession")
forbid_singulo_possession = 1
@@ -529,18 +483,12 @@
if("antag_hud_restricted")
config.antag_hud_restricted = 1
if("humans_need_surnames")
humans_need_surnames = 1
if("automute_on")
automute_on = 1
if("usealienwhitelist")
usealienwhitelist = 1
if("assistant_maint")
config.assistant_maint = 1
if("gateway_delay")
config.gateway_delay = text2num(value)
@@ -562,12 +510,6 @@
else //probably windows, if not this should work anyway
GLOB.python_path = "pythonw"
if("assistant_limit")
config.assistantlimit = 1
if("assistant_ratio")
config.assistantratio = text2num(value)
if("allow_drone_spawn")
config.allow_drone_spawn = text2num(value)
@@ -13,6 +13,8 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
var/datum/configuration_section/custom_sprites_configuration/custom_sprites
/// Holder for the DB configuration datum
var/datum/configuration_section/database_configuration/database
/// Holder for the job configuration datum
var/datum/configuration_section/job_configuration/jobs
/// Holder for the MC configuration datum
var/datum/configuration_section/mc_configuration/mc
/// Holder for the ruins configuration datum
@@ -34,6 +36,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
afk = new()
custom_sprites = new()
database = new()
jobs = new()
mc = new()
ruins = new()
@@ -49,6 +52,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
afk.load_data(raw_config_data["afk_configuration"])
custom_sprites.load_data(raw_config_data["custom_sprites_configuration"])
database.load_data(raw_config_data["database_configuration"])
jobs.load_data(raw_config_data["job_configuration"])
mc.load_data(raw_config_data["mc_configuration"])
ruins.load_data(raw_config_data["ruin_configuration"])
@@ -0,0 +1,56 @@
/// Config holder for all job related things
/datum/configuration_section/job_configuration
/// Do we want jobs to have minimal access or extra access (IE: Scientists having robotics access)
var/jobs_have_minimal_access = TRUE
/// Do we want to restrict jobs based on account age
var/restrict_jobs_on_account_age = FALSE
/// Allow admins to bypass age-based job restrictions
var/restrict_jobs_on_account_age_admin_bypass = TRUE
/// Enable EXP logging and tracking
var/enable_exp_tracking = FALSE
/// Lockout jobs based on EXP
var/enable_exp_restrictions = FALSE
/// Allow admins to bypass EXP restrictions
var/enable_exp_admin_bypass = TRUE
/// Allow non-admins to play as AI
var/allow_ai = TRUE
/// Prevent guests from playing high profile roles
var/guest_job_ban = TRUE
/// Grant assistants maint access
var/assistant_maint_access = TRUE
/// Limit amount of assistants?
var/assistant_limit = FALSE
/// If yes to above, ratio of assistants per security officer (IE: 4:1)
var/assistant_security_ratio = 2
/// Enable loading of job overrides from the config
var/enable_job_amount_overrides = TRUE
/// Map of job:amount for lowpop. key: Job | value: amount
var/list/lowpop_job_map = list()
/// Map of job:amount for highpop. key: Job | value: amount
var/list/highpop_job_map = list()
/datum/configuration_section/job_configuration/load_data(list/data)
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
CONFIG_LOAD_BOOL(jobs_have_minimal_access, data["jobs_have_minimal_access"])
CONFIG_LOAD_BOOL(restrict_jobs_on_account_age, data["restrict_jobs_on_account_age"])
CONFIG_LOAD_BOOL(restrict_jobs_on_account_age_admin_bypass, data["restrict_jobs_on_account_age_admin_bypass"])
CONFIG_LOAD_BOOL(enable_exp_tracking, data["enable_exp_tracking"])
CONFIG_LOAD_BOOL(enable_exp_restrictions, data["enable_exp_restrictions"])
CONFIG_LOAD_BOOL(enable_exp_admin_bypass, data["enable_exp_admin_bypass"])
CONFIG_LOAD_BOOL(allow_ai, data["allow_ai"])
CONFIG_LOAD_BOOL(guest_job_ban, data["guest_job_ban"])
CONFIG_LOAD_BOOL(assistant_maint_access, data["assistant_maint_access"])
CONFIG_LOAD_BOOL(assistant_limit, data["assistant_limit"])
CONFIG_LOAD_NUM(assistant_security_ratio, data["assistant_security_ratio"])
CONFIG_LOAD_BOOL(enable_job_amount_overrides, data["enable_job_amount_overrides"])
if(enable_job_amount_overrides && islist(data["job_slot_amounts"]))
lowpop_job_map.Cut()
highpop_job_map.Cut()
for(var/kvp in data["job_slot_amounts"])
if(!isnull(kvp["name"]))
if(!isnull(kvp["lowpop"]))
lowpop_job_map[kvp["name"]] = kvp["lowpop"]
if(!isnull(kvp["highpop"]))
highpop_job_map[kvp["name"]] = kvp["highpop"]
pass()
+1 -1
View File
@@ -166,7 +166,7 @@ SUBSYSTEM_DEF(ghost_spawns)
if(role_text)
if(jobban_isbanned(M, role_text) || jobban_isbanned(M, "Syndicate"))
return
if(config.use_exp_restrictions && min_hours)
if(GLOB.configuration.jobs.enable_exp_restrictions && min_hours)
if(M.client.get_exp_type_num(EXP_TYPE_LIVING) < min_hours * 60)
return
if(check_antaghud && cannotPossess(M))
+22 -32
View File
@@ -20,12 +20,12 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/Initialize(timeofday)
if(!occupations.len)
SetupOccupations()
LoadJobs("config/jobs.txt")
LoadJobs(FALSE)
return ..()
// Only fires every 5 minutes
/datum/controller/subsystem/jobs/fire()
if(!SSdbcore.IsConnected() || !config.use_exp_tracking)
if(!SSdbcore.IsConnected() || !GLOB.configuration.jobs.enable_exp_tracking)
return
batch_update_player_exp(announce = FALSE) // Set this to true if you ever want to inform players about their EXP gains
@@ -242,8 +242,8 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/FillAIPosition()
if(config && !config.allow_ai)
return 0
if(!GLOB.configuration.jobs.allow_ai)
return FALSE
var/ai_selected = 0
var/datum/job/job = GetJob("AI")
@@ -514,39 +514,29 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/LoadJobs(jobsfile) //ran during round setup, reads info from jobs.txt -- Urist
if(!config.load_jobs_from_txt)
return 0
/datum/controller/subsystem/jobs/proc/LoadJobs(highpop = FALSE) //ran during round setup, reads info from jobs list
if(!GLOB.configuration.jobs.enable_job_amount_overrides)
return FALSE
var/list/jobEntries = file2list(jobsfile)
var/list/joblist = list()
for(var/job in jobEntries)
if(!job)
if(highpop)
joblist = GLOB.configuration.jobs.highpop_job_map.Copy()
else
joblist = GLOB.configuration.jobs.lowpop_job_map.Copy()
for(var/job in joblist)
// Key: name | Value: Amount
var/datum/job/J = GetJob(job)
if(!J)
continue
J.total_positions = text2num(joblist[job])
J.spawn_positions = text2num(joblist[job])
job = trim(job)
if(!length(job))
continue
if(job == "AI" || job == "Cyborg") //I dont like this here but it will do for now
J.total_positions = 0
var/pos = findtext(job, "=")
var/name = null
var/value = null
if(pos)
name = copytext(job, 1, pos)
value = copytext(job, pos + 1)
else
continue
if(name && value)
var/datum/job/J = GetJob(name)
if(!J) continue
J.total_positions = text2num(value)
J.spawn_positions = text2num(value)
if(name == "AI" || name == "Cyborg")//I dont like this here but it will do for now
J.total_positions = 0
return 1
return TRUE
/datum/controller/subsystem/jobs/proc/HandleFeedbackGathering()
+1 -1
View File
@@ -276,7 +276,7 @@ SUBSYSTEM_DEF(ticker)
if(playercount >= highpop_trigger)
log_debug("Playercount: [playercount] versus trigger: [highpop_trigger] - loading highpop job config")
SSjobs.LoadJobs("config/jobs_highpop.txt")
SSjobs.LoadJobs(TRUE)
else
log_debug("Playercount: [playercount] versus trigger: [highpop_trigger] - keeping standard job config")