[MIRROR] Fix dynamic parameters ignoring configuration (#3285)

* Fix dynamic parameters ignoring configuration (#56778)

Dynamic was ignoring the parameters in dynamic.json, because they were being ran in can_start, which runs before pre_setup. This has been moved to its own proc which is correctly called after configuration.

Let this be a lesson in why you should not be putting side effects in functions that don't imply they are impure.

* Fix dynamic parameters ignoring configuration

Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-02-11 13:11:02 +01:00
committed by GitHub
co-authored by Mothblocks
parent 09b9ac997f
commit d3453e645e
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -324,6 +324,9 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
mid_round_budget = threat_level - round_start_budget
/datum/game_mode/dynamic/can_start()
return TRUE
/datum/game_mode/dynamic/proc/setup_parameters()
log_game("DYNAMIC: Dynamic mode parameters for the round:")
log_game("DYNAMIC: Centre is [threat_curve_centre], Width is [threat_curve_width], Forced extended is [GLOB.dynamic_forced_extended ? "Enabled" : "Disabled"], No stacking is [GLOB.dynamic_no_stacking ? "Enabled" : "Disabled"].")
log_game("DYNAMIC: Stacking limit is [GLOB.dynamic_stacking_limit].")
@@ -355,6 +358,8 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
continue
vars[variable] = configuration["Dynamic"][variable]
setup_parameters()
var/valid_roundstart_ruleset = 0
for (var/rule in subtypesof(/datum/dynamic_ruleset))
var/datum/dynamic_ruleset/ruleset = new rule()
+1 -1
View File
@@ -37,7 +37,7 @@ this value is then added to `world.time` and assigned to the injection cooldown
[rigged_roundstart][/datum/game_mode/dynamic/proc/rigged_roundstart] is called instead if there are forced rules (an admin set the mode)
1. [can_start][/datum/game_mode/proc/can_start]\()
1. [setup_parameters][/datum/game_mode/proc/setup_parameters]\()
2. [pre_setup][/datum/game_mode/proc/pre_setup]\()
3. [roundstart][/datum/game_mode/dynamic/proc/roundstart]\() OR [rigged_roundstart][/datum/game_mode/dynamic/proc/rigged_roundstart]\()
4. [picking_roundstart_rule][/datum/game_mode/dynamic/proc/picking_roundstart_rule]\(drafted_rules)