MC Configuration

This commit is contained in:
AffectedArc07
2021-05-03 19:32:16 +01:00
parent 29af4068f2
commit 34e46807e9
12 changed files with 72 additions and 77 deletions
-25
View File
@@ -34,13 +34,11 @@
var/vote_no_default = 0 // vote does not default to nochange/norestart (tbi)
var/vote_no_dead = 0 // dead people can't vote (tbi)
// var/enable_authentication = 0 // goon authentication
var/del_new_on_log = 1 // qdel's new players if they log before they spawn in
var/traitor_scaling = 0 //if amount of traitors scales based on amount of players
var/protect_roles_from_antagonist = 0// If security and such can be tratior/cult/other
var/continuous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke.
var/allow_Metadata = 0 // Metadata is supported.
var/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1.
var/Ticklag = 0.5
var/list/resource_urls = null
var/antag_hud_allowed = 0 // Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round.
var/antag_hud_restricted = 0 // Ghosts that turn on Antagovision cannot rejoin the round.
@@ -194,16 +192,6 @@
var/disable_karma = 0 // Disable all karma functions and unlock karma jobs by default
// StonedMC
var/tick_limit_mc_init = TICK_LIMIT_MC_INIT_DEFAULT //SSinitialization throttling
// Highpop tickrates
var/base_mc_tick_rate = 1
var/high_pop_mc_tick_rate = 1.1
var/high_pop_mc_mode_amount = 65
var/disable_high_pop_mc_mode_amount = 60
// Nightshift
var/randomize_shift_time = FALSE
var/enable_night_shifts = FALSE
@@ -542,9 +530,6 @@
if("allow_holidays")
config.allow_holidays = 1
if("ticklag")
Ticklag = text2num(value)
if("allow_antag_hud")
config.antag_hud_allowed = 1
@@ -683,16 +668,6 @@
if("start_now_confirmation")
config.start_now_confirmation = 1
if("tick_limit_mc_init")
config.tick_limit_mc_init = text2num(value)
if("base_mc_tick_rate")
config.base_mc_tick_rate = text2num(value)
if("high_pop_mc_tick_rate")
config.high_pop_mc_tick_rate = text2num(value)
if("high_pop_mc_mode_amount")
config.high_pop_mc_mode_amount = text2num(value)
if("disable_high_pop_mc_mode_amount")
config.disable_high_pop_mc_mode_amount = text2num(value)
if("developer_express_start")
config.developer_express_start = 1
if("enable_gamemode_player_limit")
@@ -8,8 +8,8 @@
target = ((input == 1) ? TRUE : FALSE)\
}
/// Wrapper to not overwrite a variable if a list key doesnt exist. Auto casts to int.
#define CONFIG_LOAD_INT(target, input) \
/// Wrapper to not overwrite a variable if a list key doesnt exist. Auto casts to number.
#define CONFIG_LOAD_NUM(target, input) \
if(!isnull(input)) {\
target = text2num(input)\
}
@@ -7,9 +7,14 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
/datum/server_configuration
/// Holder for the admin configuration datum
var/datum/configuration_section/admin_configuration/admin
/// Holder for the AFK configuration datum
var/datum/configuration_section/afk_configuration/afk
/// Holder for the custom sprites configuration datum
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 MC configuration datum
var/datum/configuration_section/mc_configuration/mc
/datum/server_configuration/Destroy(force)
SHOULD_CALL_PARENT(FALSE)
@@ -27,6 +32,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
afk = new()
custom_sprites = new()
database = new()
mc = new()
// Load our stuff up
var/config_file = "config/config.toml"
@@ -11,7 +11,7 @@
/datum/configuration_section/afk_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_INT(warning_minutes, data["afk_warning_minutes"])
CONFIG_LOAD_INT(auto_cryo_minutes, data["afk_auto_cryo_minutes"])
CONFIG_LOAD_INT(auto_despawn_minutes, data["afk_auto_despawn_minutes"])
CONFIG_LOAD_INT(ssd_auto_cryo_minutes, data["ssd_auto_cryo_minutes"])
CONFIG_LOAD_NUM(warning_minutes, data["afk_warning_minutes"])
CONFIG_LOAD_NUM(auto_cryo_minutes, data["afk_auto_cryo_minutes"])
CONFIG_LOAD_NUM(auto_despawn_minutes, data["afk_auto_despawn_minutes"])
CONFIG_LOAD_NUM(ssd_auto_cryo_minutes, data["ssd_auto_cryo_minutes"])
@@ -29,19 +29,19 @@
enabled = TRUE
table_prefix = ""
// This needs to happen in the CI environment to ensure the example SQL version gets updated.
CONFIG_LOAD_INT(version, data["sql_version"])
CONFIG_LOAD_NUM(version, data["sql_version"])
#else
// Load the normal config. Were not in CI mode
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
CONFIG_LOAD_BOOL(enabled, data["sql_enabled"])
CONFIG_LOAD_INT(version, data["sql_version"])
CONFIG_LOAD_NUM(version, data["sql_version"])
CONFIG_LOAD_STR(address, data["sql_address"])
CONFIG_LOAD_INT(port, data["sql_port"])
CONFIG_LOAD_NUM(port, data["sql_port"])
CONFIG_LOAD_STR(username, data["sql_username"])
CONFIG_LOAD_STR(password, data["sql_password"])
CONFIG_LOAD_STR(db, data["sql_database"])
CONFIG_LOAD_STR(table_prefix, data["sql_table_prefix"])
CONFIG_LOAD_INT(async_query_timeout, data["async_query_timeout"])
CONFIG_LOAD_INT(async_thread_limit, data["async_thread_limit"])
CONFIG_LOAD_NUM(async_query_timeout, data["async_query_timeout"])
CONFIG_LOAD_NUM(async_thread_limit, data["async_thread_limit"])
#endif
@@ -0,0 +1,23 @@
/// Config holder for all things regarding the MC
/datum/configuration_section/mc_configuration
/// Server ticklag
var/ticklag = 0.5
/// Tick limit % during world Init
var/world_init_tick_limit = TICK_LIMIT_MC_INIT_DEFAULT
/// Base MC tick rate
var/mc_base_tickrate = 1
/// Highpop MC tickrate
var/mc_highpop_tickrate = 1.1
/// MC Highpop enable threshold
var/mc_highpop_enable_threshold = 65
/// MC Highpop disable threshold
var/mc_highpop_disable_threshold = 60
/datum/configuration_section/mc_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_NUM(ticklag, data["ticklag"])
CONFIG_LOAD_NUM(world_init_tick_limit, data["world_init_mc_tick_limit"])
CONFIG_LOAD_NUM(mc_base_tickrate, data["base_mc_tick_rate"])
CONFIG_LOAD_NUM(mc_highpop_tickrate, data["highpop_mc_tick_rate"])
CONFIG_LOAD_NUM(mc_highpop_enable_threshold, data["mc_highpop_threshold_enable"])
CONFIG_LOAD_NUM(mc_highpop_disable_threshold, data["mc_highpop_threshold_disable"])
+6 -6
View File
@@ -194,7 +194,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
var/start_timeofday = REALTIMEOFDAY
// Initialize subsystems.
current_ticklimit = config.tick_limit_mc_init
current_ticklimit = GLOB.configuration.mc.world_init_tick_limit
for(var/datum/controller/subsystem/SS in subsystems)
if(SS.flags & SS_NO_INIT)
continue
@@ -216,7 +216,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
sortTim(subsystems, /proc/cmp_subsystem_display)
// Set world options.
// world.fps = CONFIG_GET(number/fps) // TIGER TODO
world.tick_lag = config.Ticklag
world.tick_lag = GLOB.configuration.mc.ticklag
var/initialized_tod = REALTIMEOFDAY
if(sleep_offline_after_initializations)
@@ -626,10 +626,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
if(!processing)
return
var/client_count = length(GLOB.clients)
if(client_count < config.disable_high_pop_mc_mode_amount)
processing = config.base_mc_tick_rate
else if(client_count > config.high_pop_mc_mode_amount)
processing = config.high_pop_mc_tick_rate
if(client_count < GLOB.configuration.mc.mc_highpop_disable_threshold)
processing = GLOB.configuration.mc.mc_base_tickrate
else if(client_count > GLOB.configuration.mc.mc_highpop_enable_threshold)
processing = GLOB.configuration.mc.mc_highpop_tickrate
/datum/controller/master/proc/formatcpu()
switch(world.cpu)