Reduced dynamic budget at low player count (#28300)

* Reduced dynamic budget at low player count

* Tests

* One linty boy

* I was, uh, making sure the test worked. That definitely wasn't a typo. <.<
This commit is contained in:
Charlie Nolan
2025-02-16 08:02:22 +00:00
committed by GitHub
parent 7721d032b8
commit 9d227fe4aa
3 changed files with 36 additions and 2 deletions
+20 -2
View File
@@ -3,7 +3,7 @@ GLOBAL_LIST_EMPTY(dynamic_forced_rulesets)
/datum/game_mode/dynamic
name = "Dynamic"
config_tag = "dynamic"
required_players = 10
required_players = 0
/// Non-implied rulesets in play
var/list/datum/ruleset/rulesets = list()
/// Implied rulesets that are in play
@@ -26,9 +26,27 @@ GLOBAL_LIST_EMPTY(dynamic_forced_rulesets)
possible_rulesets |= ruleset.implied_ruleset_type.name
to_chat(world, "<b>Possible Rulesets:</b> [english_list(possible_rulesets)]")
/// Calculates the dynamic budget based on the number of players in the round
/datum/game_mode/dynamic/proc/calculate_budget(players)
switch(players)
if(0 to 4)
// Flat budget of 7
return 7
if(5 to 20)
// +0.5 budget each for players 5-20
// Cumulative total at 20 players: 15
return 7 + 0.5 * (players - 4)
if(21 to 30)
// +1.5 budget each for players 21 to 30
// Cumulative total at 30 players: 30
return 15 + 1.5 * (players - 20)
else
// +1 budget each for players 31+, so just player count.
return players
/datum/game_mode/dynamic/proc/allocate_ruleset_budget()
var/ruleset_budget = text2num(GLOB.dynamic_forced_rulesets["budget"] || pickweight(list("0" = 3, "1" = 8, "2" = 12, "3" = 3)))
antag_budget = num_players()
antag_budget = calculate_budget(num_players())
log_dynamic("Allocated gamemode budget: [ruleset_budget]")
var/list/possible_rulesets = list()
for(var/datum/ruleset/ruleset as anything in subtypesof(/datum/ruleset))