mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 19:47:47 +01:00
Ports over configuration controller (#16484)
* Ports over configuration controller * Fixes * Manual path fix * patch (#16490) * patch * . * SQL Fix * Post-rebase fix * Added missing examples --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
@@ -6,9 +6,9 @@ SUBSYSTEM_DEF(assets)
|
||||
var/list/preload = list()
|
||||
var/datum/asset_transport/transport = new()
|
||||
|
||||
/datum/controller/subsystem/assets/proc/OnConfigLoad()
|
||||
/datum/controller/subsystem/assets/OnConfigLoad()
|
||||
var/newtransporttype = /datum/asset_transport
|
||||
switch (config.asset_transport)
|
||||
switch (CONFIG_GET(string/asset_transport))
|
||||
if ("webroot")
|
||||
newtransporttype = /datum/asset_transport/webroot
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ SUBSYSTEM_DEF(inactivity)
|
||||
var/number_kicked = 0
|
||||
|
||||
/datum/controller/subsystem/inactivity/fire(resumed = FALSE)
|
||||
if (!config.kick_inactive)
|
||||
if (!CONFIG_GET(number/kick_inactive))
|
||||
can_fire = FALSE
|
||||
return
|
||||
if (!resumed)
|
||||
@@ -15,8 +15,8 @@ SUBSYSTEM_DEF(inactivity)
|
||||
while(client_list.len)
|
||||
var/client/C = client_list[client_list.len]
|
||||
client_list.len--
|
||||
if(C.is_afk(config.kick_inactive MINUTES) && can_kick(C))
|
||||
to_chat_immediate(C, world.time, span_warning("You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected."))
|
||||
if(C.is_afk(CONFIG_GET(number/kick_inactive) MINUTES) && can_kick(C))
|
||||
to_chat_immediate(C, world.time, span_warning("You have been inactive for more than [CONFIG_GET(number/kick_inactive)] minute\s and have been disconnected."))
|
||||
|
||||
var/information
|
||||
if(C.mob)
|
||||
|
||||
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(lighting)
|
||||
|
||||
/datum/controller/subsystem/lighting/Initialize(timeofday)
|
||||
if(!subsystem_initialized)
|
||||
if (config.starlight)
|
||||
if (CONFIG_GET(flag/starlight))
|
||||
for(var/area/A in world)
|
||||
if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
|
||||
A.luminosity = 0
|
||||
|
||||
@@ -20,7 +20,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
maploader = new()
|
||||
load_map_templates()
|
||||
|
||||
if(config.generate_map)
|
||||
if(CONFIG_GET(flag/generate_map))
|
||||
// Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order.
|
||||
using_map.perform_map_generation()
|
||||
|
||||
@@ -52,8 +52,8 @@ SUBSYSTEM_DEF(mapping)
|
||||
|
||||
// Choose an engine type
|
||||
var/datum/map_template/engine/chosen_type = null
|
||||
if (LAZYLEN(config.engine_map))
|
||||
var/chosen_name = pick(config.engine_map)
|
||||
if (LAZYLEN(CONFIG_GET(str_list/engine_map)))
|
||||
var/chosen_name = pick(CONFIG_GET(str_list/engine_map))
|
||||
chosen_type = map_templates[chosen_name]
|
||||
if(!istype(chosen_type))
|
||||
error("Configured engine map [chosen_name] is not a valid engine map name!")
|
||||
|
||||
@@ -16,7 +16,7 @@ SUBSYSTEM_DEF(media_tracks)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/media_tracks/proc/load_tracks()
|
||||
for(var/filename in config.jukebox_track_files)
|
||||
for(var/filename in CONFIG_GET(str_list/jukebox_track_files))
|
||||
report_progress("Loading jukebox track: [filename]")
|
||||
|
||||
if(!fexists(filename))
|
||||
|
||||
@@ -11,7 +11,7 @@ SUBSYSTEM_DEF(nightshift)
|
||||
var/high_security_mode = FALSE
|
||||
|
||||
/datum/controller/subsystem/nightshift/Initialize()
|
||||
if(!config.enable_night_shifts)
|
||||
if(!CONFIG_GET(flag/enable_night_shifts))
|
||||
can_fire = FALSE
|
||||
/*
|
||||
if(config.randomize_shift_time)
|
||||
|
||||
@@ -16,7 +16,7 @@ SUBSYSTEM_DEF(persist)
|
||||
|
||||
// Do PTO Accruals
|
||||
/datum/controller/subsystem/persist/proc/update_department_hours(var/resumed = FALSE)
|
||||
if(!config.time_off)
|
||||
if(!CONFIG_GET(flag/time_off))
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
@@ -78,7 +78,7 @@ SUBSYSTEM_DEF(persist)
|
||||
play_hours[department_earning] = wait_in_hours
|
||||
|
||||
// Cap it
|
||||
dept_hours[department_earning] = min(config.pto_cap, dept_hours[department_earning])
|
||||
dept_hours[department_earning] = min(CONFIG_GET(number/pto_cap), dept_hours[department_earning])
|
||||
|
||||
// Okay we figured it out, lets update database!
|
||||
var/sql_ckey = sql_sanitize_text(C.ckey)
|
||||
@@ -104,4 +104,4 @@ SUBSYSTEM_DEF(persist)
|
||||
// They have a custom title, aren't crew, or someone deleted their record, so we need a fallback method.
|
||||
// Let's check the mind.
|
||||
if(M.mind && M.mind.assigned_role)
|
||||
. = job_master.GetJob(M.mind.assigned_role)
|
||||
. = job_master.GetJob(M.mind.assigned_role)
|
||||
|
||||
@@ -25,7 +25,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/track_value(var/atom/value, var/track_type)
|
||||
|
||||
if(config.persistence_disabled) //if the config is set to persistence disabled, nothing will save or load.
|
||||
if(CONFIG_GET(flag/persistence_disabled)) //if the config is set to persistence disabled, nothing will save or load.
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(value)
|
||||
|
||||
@@ -24,7 +24,7 @@ SUBSYSTEM_DEF(radiation)
|
||||
if(QDELETED(S))
|
||||
sources -= S
|
||||
else if(S.decay)
|
||||
S.update_rad_power(S.rad_power - config.radiation_decay_rate)
|
||||
S.update_rad_power(S.rad_power - CONFIG_GET(number/radiation_decay_rate))
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
@@ -93,12 +93,12 @@ SUBSYSTEM_DEF(radiation)
|
||||
origin.calc_rad_resistance()
|
||||
|
||||
if(origin.cached_rad_resistance)
|
||||
if(config.radiation_resistance_calc_mode == RAD_RESIST_CALC_DIV)
|
||||
working = round((working / (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0.01)
|
||||
else if(config.radiation_resistance_calc_mode == RAD_RESIST_CALC_SUB)
|
||||
working = round((working - (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0.01)
|
||||
if(CONFIG_GET(flag/radiation_resistance_calc_mode) == RAD_RESIST_CALC_DIV)
|
||||
working = round((working / (origin.cached_rad_resistance * CONFIG_GET(number/radiation_resistance_multiplier))), 0.01)
|
||||
else if(CONFIG_GET(flag/radiation_resistance_calc_mode) == RAD_RESIST_CALC_SUB)
|
||||
working = round((working - (origin.cached_rad_resistance * CONFIG_GET(number/radiation_resistance_multiplier))), 0.01)
|
||||
|
||||
if(working <= config.radiation_lower_limit) // Too far from this source
|
||||
if(working <= CONFIG_GET(number/radiation_lower_limit)) // Too far from this source
|
||||
working = 0 // May as well be 0
|
||||
break
|
||||
|
||||
@@ -106,7 +106,7 @@ SUBSYSTEM_DEF(radiation)
|
||||
// Shouldn't really ever have practical uses, but standing in a room literally made from uranium is more dangerous than standing next to a single uranium vase
|
||||
. += working / (dist ** 2)
|
||||
|
||||
if(. <= config.radiation_lower_limit)
|
||||
if(. <= CONFIG_GET(number/radiation_lower_limit))
|
||||
. = 0
|
||||
|
||||
// Add a radiation source instance to the repository. It will override any existing source on the same turf.
|
||||
|
||||
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(sqlite)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/sqlite/proc/connect()
|
||||
if(!config.sqlite_enabled)
|
||||
if(!CONFIG_GET(flag/sqlite_enabled))
|
||||
return
|
||||
|
||||
if(!sqlite_db)
|
||||
@@ -104,17 +104,17 @@ SUBSYSTEM_DEF(sqlite)
|
||||
return !sqlite_check_for_errors(query, "Insert Feedback")
|
||||
|
||||
/datum/controller/subsystem/sqlite/proc/can_submit_feedback(client/C)
|
||||
if(!config.sqlite_enabled)
|
||||
if(!CONFIG_GET(flag/sqlite_enabled))
|
||||
return FALSE
|
||||
if(config.sqlite_feedback_min_age && !is_old_enough(C))
|
||||
if(CONFIG_GET(number/sqlite_feedback_min_age) && !is_old_enough(C))
|
||||
return FALSE
|
||||
if(config.sqlite_feedback_cooldown > 0 && get_feedback_cooldown(C.key, config.sqlite_feedback_cooldown, sqlite_db) > 0)
|
||||
if(CONFIG_GET(number/sqlite_feedback_cooldown) > 0 && get_feedback_cooldown(C.key, CONFIG_GET(number/sqlite_feedback_cooldown), sqlite_db) > 0)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// Returns TRUE if the player is 'old' enough, according to the config.
|
||||
/datum/controller/subsystem/sqlite/proc/is_old_enough(client/C)
|
||||
if(get_player_age(C.key) < config.sqlite_feedback_min_age)
|
||||
if(get_player_age(C.key) < CONFIG_GET(number/sqlite_feedback_min_age))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
global.ticker = src // TODO - Remove this! Change everything to point at SSticker intead
|
||||
|
||||
/datum/controller/subsystem/ticker/Initialize()
|
||||
pregame_timeleft = config.pregame_time
|
||||
send2mainirc("Server lobby is loaded and open at byond://[config.serverurl ? config.serverurl : (config.server ? config.server : "[world.address]:[world.port]")]")
|
||||
pregame_timeleft = CONFIG_GET(number/pregame_time)
|
||||
send2mainirc("Server lobby is loaded and open at byond://[CONFIG_GET(string/serverurl) ? CONFIG_GET(string/serverurl) : (CONFIG_GET(string/server) ? CONFIG_GET(string/server) : "[world.address]:[world.port]")]")
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_ROUNDPREP,
|
||||
list(
|
||||
@@ -108,7 +108,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
round_start_time = world.time // otherwise round_start_time would be 0 for the signals
|
||||
if(!setup_choose_gamemode())
|
||||
// It failed, go back to lobby state and re-send the welcome message
|
||||
pregame_timeleft = config.pregame_time
|
||||
pregame_timeleft = CONFIG_GET(number/pregame_time)
|
||||
// SSvote.gamemode_vote_called = FALSE // Allow another autogamemode vote
|
||||
current_state = GAME_STATE_PREGAME
|
||||
Master.SetRunLevel(RUNLEVEL_LOBBY)
|
||||
@@ -135,8 +135,8 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
if(!src.mode)
|
||||
var/list/weighted_modes = list()
|
||||
for(var/datum/game_mode/GM in runnable_modes)
|
||||
weighted_modes[GM.config_tag] = config.probabilities[GM.config_tag]
|
||||
src.mode = gamemode_cache[pickweight(weighted_modes)]
|
||||
weighted_modes[GM.config_tag] = CONFIG_GET(keyed_list/probabilities)[GM.config_tag]
|
||||
src.mode = config.gamemode_cache[pickweight(weighted_modes)]
|
||||
else
|
||||
src.mode = config.pick_mode(master_mode)
|
||||
|
||||
@@ -150,7 +150,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
job_master.DivideOccupations() // Apparently important for new antagonist system to register specific job antags properly.
|
||||
|
||||
if(!src.mode.can_start())
|
||||
to_world(span_filter_system(span_bold("Unable to start [mode.name].") + " Not enough players readied, [config.player_requirements[mode.config_tag]] players needed. Reverting to pregame lobby."))
|
||||
to_world(span_filter_system(span_bold("Unable to start [mode.name].") + " Not enough players readied, [CONFIG_GET(keyed_list/player_requirements)[mode.config_tag]] players needed. Reverting to pregame lobby."))
|
||||
mode.fail_setup()
|
||||
mode = null
|
||||
job_master.ResetOccupations()
|
||||
@@ -198,7 +198,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
current_state = GAME_STATE_PLAYING
|
||||
Master.SetRunLevel(RUNLEVEL_GAME)
|
||||
|
||||
if(config.sql_enabled)
|
||||
if(CONFIG_GET(flag/sql_enabled))
|
||||
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
|
||||
|
||||
return 1
|
||||
@@ -214,7 +214,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
// Calculate if game and/or mode are finished (Complicated by the continuous_rounds config option)
|
||||
var/game_finished = FALSE
|
||||
var/mode_finished = FALSE
|
||||
if (config.continous_rounds) // Game keeps going after mode ends.
|
||||
if (CONFIG_GET(flag/continuous_rounds)) // Game keeps going after mode ends.
|
||||
game_finished = (emergency_shuttle.returned() || mode.station_was_nuked)
|
||||
mode_finished = ((end_game_state >= END_GAME_MODE_FINISHED) || mode.check_finished()) // Short circuit if already finished.
|
||||
else // Game ends when mode does
|
||||
|
||||
Reference in New Issue
Block a user