From a50820a5745445f88254bb50aa7f1e94ca80f059 Mon Sep 17 00:00:00 2001 From: Erki Date: Sat, 5 Aug 2017 22:36:14 +0300 Subject: [PATCH] Fixes a bug with default values. (#3237) --- code/controllers/configuration.dm | 4 ++++ code/game/antagonist/_antagonist_setup.dm | 2 +- code/game/jobs/job/job.dm | 5 +++++ code/world.dm | 2 +- config/example/config.txt | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0f33d81d1ad..f3a2ecbae48 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -160,6 +160,7 @@ var/list/gamemode_cache = list() 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/age_restrictions_from_file = 0 // Are hardcoded values used or config ones? var/sql_stats = 0 //Do we record round statistics on the database (deaths, round reports, population, etcetera) or not? var/sql_whitelists = 0 //Defined whether the server uses an SQL based whitelist system, or the legacy one with two .txts. Config option in config.txt var/sql_saves = 0 //Defines whether the server uses an SQL based character and preference saving system. Config option in config.txt @@ -330,6 +331,9 @@ var/list/gamemode_cache = list() if ("use_age_restriction_for_antags") config.use_age_restriction_for_antags = 1 + if ("load_age_restrictions_from_file") + config.age_restrictions_from_file = 1 + if ("jobs_have_minimal_access") config.jobs_have_minimal_access = 1 diff --git a/code/game/antagonist/_antagonist_setup.dm b/code/game/antagonist/_antagonist_setup.dm index 4bd05fb781b..7f40ec5ae90 100644 --- a/code/game/antagonist/_antagonist_setup.dm +++ b/code/game/antagonist/_antagonist_setup.dm @@ -70,7 +70,7 @@ var/global/list/bantype_to_antag_age = list() // Set up age restrictions for the different antag bantypes. if (!bantype_to_antag_age[A.bantype]) - if (config.age_restrictions[lowertext(A.bantype)]) + if (config.age_restrictions_from_file && config.age_restrictions[lowertext(A.bantype)]) bantype_to_antag_age[lowertext(A.bantype)] = config.age_restrictions[lowertext(A.bantype)] else bantype_to_antag_age[A.bantype] = 0 diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index 5412964b720..b86052793c3 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -118,8 +118,13 @@ return (current_positions < total_positions) || (total_positions == -1) /datum/job/proc/fetch_age_restriction() + if (!config.age_restrictions_from_file) + return + if (config.age_restrictions[lowertext(title)]) minimal_player_age = config.age_restrictions[lowertext(title)] + else + minimal_player_age = 0 /datum/job/proc/late_equip(var/mob/living/carbon/human/H) if(!H) diff --git a/code/world.dm b/code/world.dm index 10a658a1165..2c4f4b1bf95 100644 --- a/code/world.dm +++ b/code/world.dm @@ -258,7 +258,7 @@ var/list/world_api_rate_limit = list() config.load("config/config.txt") config.load("config/game_options.txt","game_options") - if (config.use_age_restriction_for_jobs || config.use_age_restriction_for_antags) + if (config.age_restrictions_from_file) config.load("config/age_restrictions.txt", "age_restrictions") /hook/startup/proc/loadMods() diff --git a/config/example/config.txt b/config/example/config.txt index 25d27b4a3c7..a52b1d62e6c 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -29,6 +29,9 @@ JOBS_HAVE_MINIMAL_ACCESS ## Non-automatic antagonist recruitment, such as being converted to cultism is not affected. Has the same database requirements and notes as USE_AGE_RESTRICTION_FOR_JOBS. #USE_AGE_RESTRICTION_FOR_ANTAGS +## Unhash to enable loading of age restrictions from age_restrictions.txt. +#LOAD_AGE_RESTRICTIONS_FROM_FILE + ## Unhash this to use recursive explosions, keep it hashed to use circle explosions. Recursive explosions react to walls, airlocks and blast doors, making them look a lot cooler than the boring old circular explosions. They require more CPU and are (as of january 2013) experimental #USE_RECURSIVE_EXPLOSIONS