From 3a929b2b4e1cd91054830e61fea12feff0f71dca Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Sat, 13 Jul 2024 17:54:35 +0300 Subject: [PATCH 1/9] no roundstart antags if not enough sec --- code/controllers/subsystem/dynamic/dynamic.dm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index 5fdd93b1ae0c2..7b5aa8dd58ab7 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -699,6 +699,15 @@ SUBSYSTEM_DEF(dynamic) if (GLOB.dynamic_forced_extended) log_dynamic("Starting a round of forced extended.") return TRUE + // BANDASTATION EDIT START - Force players to play sec + var/security + for(var/mob/checked_mob in GLOB.alive_player_list) + if(checked_mob.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) + security++ + if(security < 4) + log_dynamic("Starting a round of forced extended; Not enough security.") + return TRUE + // BANDASTATION EDIT END - Force players to play sec var/list/drafted_rules = list() for (var/datum/dynamic_ruleset/roundstart/rule in roundstart_rules) if (!rule.weight) From 86d5191bfa844d84cd9b0713ab61387e2b1b4301 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:30:33 +0300 Subject: [PATCH 2/9] better logic --- code/controllers/subsystem/dynamic/dynamic.dm | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index 7b5aa8dd58ab7..e5b2626d6dd20 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -530,6 +530,8 @@ SUBSYSTEM_DEF(dynamic) //To new_player and such, and we want the datums to just free when the roundstart work is done var/list/roundstart_rules = init_rulesets(/datum/dynamic_ruleset/roundstart) + var/security // BANDASTATION EDIT - Force players to play Sec + SSjob.DivideOccupations(pure = TRUE, allow_all = TRUE) for(var/i in GLOB.new_player_list) var/mob/dead/new_player/player = i @@ -545,12 +547,24 @@ SUBSYSTEM_DEF(dynamic) else roundstart_pop_ready++ candidates.Add(player) + // BANDASTATION EDIT START - Force players to play Sec + if(player.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) + security++ + // BANDASTATION EDIT END SSjob.ResetOccupations() log_dynamic("Listing [roundstart_rules.len] round start rulesets, and [candidates.len] players ready.") if (candidates.len <= 0) log_dynamic("[candidates.len] candidates.") return TRUE + // BANDASTATION EDIT START - Force players to play Sec + if(security < 5) + mid_round_budget += round_start_budget + round_start_budget = 0 + initial_round_start_budget = 0 + log_dynamic("Not enough security; forcing roundstart budget to 0") + // BANDASTATION EDIT END + if(GLOB.dynamic_forced_roundstart_ruleset.len > 0) rigged_roundstart() else @@ -699,15 +713,7 @@ SUBSYSTEM_DEF(dynamic) if (GLOB.dynamic_forced_extended) log_dynamic("Starting a round of forced extended.") return TRUE - // BANDASTATION EDIT START - Force players to play sec - var/security - for(var/mob/checked_mob in GLOB.alive_player_list) - if(checked_mob.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) - security++ - if(security < 4) - log_dynamic("Starting a round of forced extended; Not enough security.") - return TRUE - // BANDASTATION EDIT END - Force players to play sec + var/list/drafted_rules = list() for (var/datum/dynamic_ruleset/roundstart/rule in roundstart_rules) if (!rule.weight) From 5075ed1118ab349db57d4bfc6f84abc728a24454 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:34:55 +0300 Subject: [PATCH 3/9] count only assigned --- code/controllers/subsystem/dynamic/dynamic.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index e5b2626d6dd20..051fb8e19bb42 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -547,10 +547,10 @@ SUBSYSTEM_DEF(dynamic) else roundstart_pop_ready++ candidates.Add(player) - // BANDASTATION EDIT START - Force players to play Sec - if(player.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) - security++ - // BANDASTATION EDIT END + // BANDASTATION EDIT START - Force players to play Sec + if(player.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) + security++ + // BANDASTATION EDIT END SSjob.ResetOccupations() log_dynamic("Listing [roundstart_rules.len] round start rulesets, and [candidates.len] players ready.") if (candidates.len <= 0) From 269f1d6e7e1315715a1eaa3b0c6649c1e7214642 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:43:07 +0300 Subject: [PATCH 4/9] scale roundstart on sec --- code/controllers/subsystem/dynamic/dynamic.dm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index 051fb8e19bb42..28735f3e97baf 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -559,10 +559,12 @@ SUBSYSTEM_DEF(dynamic) // BANDASTATION EDIT START - Force players to play Sec if(security < 5) - mid_round_budget += round_start_budget - round_start_budget = 0 - initial_round_start_budget = 0 - log_dynamic("Not enough security; forcing roundstart budget to 0") + var/roundstart_budget_low_sec = security / 5 * round_start_budget + var/transfer_to_midround = round_start_budget - roundstart_budget_low_sec + mid_round_budget += transfer_to_midround + round_start_budget = roundstart_budget_low_sec + initial_round_start_budget = roundstart_budget_low_sec + log_dynamic("Not enough security; forcing roundstart budget to [roundstart_budget_low_sec]") // BANDASTATION EDIT END if(GLOB.dynamic_forced_roundstart_ruleset.len > 0) From 94076cfb9d68e49025d2c00a4b4443fabc1c1010 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:58:25 +0300 Subject: [PATCH 5/9] fix runtimes? --- code/controllers/subsystem/dynamic/dynamic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index 28735f3e97baf..c9cd5359ece4a 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -548,7 +548,7 @@ SUBSYSTEM_DEF(dynamic) roundstart_pop_ready++ candidates.Add(player) // BANDASTATION EDIT START - Force players to play Sec - if(player.mind.assigned_role?.departments_list.Find(/datum/job_department/security)) + if(player.mind?.assigned_role?.departments_list?.Find(/datum/job_department/security)) security++ // BANDASTATION EDIT END SSjob.ResetOccupations() From 3616847dda342e493971b4e3334104e0bdf8243b Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:17:30 +0300 Subject: [PATCH 6/9] Update code/controllers/subsystem/dynamic/dynamic.dm Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com> --- code/controllers/subsystem/dynamic/dynamic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index c9cd5359ece4a..b41a9f1c450c1 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -530,7 +530,7 @@ SUBSYSTEM_DEF(dynamic) //To new_player and such, and we want the datums to just free when the roundstart work is done var/list/roundstart_rules = init_rulesets(/datum/dynamic_ruleset/roundstart) - var/security // BANDASTATION EDIT - Force players to play Sec + var/security = 0 // BANDASTATION EDIT - Force players to play Sec SSjob.DivideOccupations(pure = TRUE, allow_all = TRUE) for(var/i in GLOB.new_player_list) From 8e22e48396cab21b4a69b86129fb86895f07372b Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:30:13 +0300 Subject: [PATCH 7/9] use config --- code/controllers/subsystem/dynamic/dynamic.dm | 4 ++-- config/bandastation/bandastation_config.txt | 5 +++++ modular_bandastation/balance/_balance.dme | 1 + modular_bandastation/balance/code/dynamic.dm | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 modular_bandastation/balance/code/dynamic.dm diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index b41a9f1c450c1..da39e3e973260 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -558,8 +558,8 @@ SUBSYSTEM_DEF(dynamic) return TRUE // BANDASTATION EDIT START - Force players to play Sec - if(security < 5) - var/roundstart_budget_low_sec = security / 5 * round_start_budget + if(security < CONFIG_GET(number/roundstart_security_for_threat)) + var/roundstart_budget_low_sec = security / CONFIG_GET(number/roundstart_security_for_threat) * round_start_budget var/transfer_to_midround = round_start_budget - roundstart_budget_low_sec mid_round_budget += transfer_to_midround round_start_budget = roundstart_budget_low_sec diff --git a/config/bandastation/bandastation_config.txt b/config/bandastation/bandastation_config.txt index de1681f429ba1..bd0949ebec6cd 100644 --- a/config/bandastation/bandastation_config.txt +++ b/config/bandastation/bandastation_config.txt @@ -5,3 +5,8 @@ #TTS_API_URL_SILERO #WHITELIST220 + +## A minimum amount of security required on roundstart +## If there is less security than this value, a percent of roundstart threat will be pushed to midround +## Example: if there is 2 security members out of N, then 3/N of roundstart threat will be moved to midround +#ROUNDSTART_SECURITY_FOR_THREAT 5 diff --git a/modular_bandastation/balance/_balance.dme b/modular_bandastation/balance/_balance.dme index 6e7f85ea5e598..b1cdc16a01138 100644 --- a/modular_bandastation/balance/_balance.dme +++ b/modular_bandastation/balance/_balance.dme @@ -1,6 +1,7 @@ #include "_balance.dm" #include "code/balance_riding.dm" +#include "code/dynamic.dm" #include "code/events.dm" #include "code/station_traits.dm" #include "code/supply_packs.dm" diff --git a/modular_bandastation/balance/code/dynamic.dm b/modular_bandastation/balance/code/dynamic.dm new file mode 100644 index 0000000000000..4617cc64f9962 --- /dev/null +++ b/modular_bandastation/balance/code/dynamic.dm @@ -0,0 +1,3 @@ +/datum/config_entry/number/roundstart_security_for_threat + default = 5 + min_val = 0 From 217763afe4f453559cf70523eefc766328826e58 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:47:21 +0300 Subject: [PATCH 8/9] oops --- code/controllers/subsystem/dynamic/dynamic.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm index da39e3e973260..ed0ebec7aeae9 100644 --- a/code/controllers/subsystem/dynamic/dynamic.dm +++ b/code/controllers/subsystem/dynamic/dynamic.dm @@ -715,7 +715,6 @@ SUBSYSTEM_DEF(dynamic) if (GLOB.dynamic_forced_extended) log_dynamic("Starting a round of forced extended.") return TRUE - var/list/drafted_rules = list() for (var/datum/dynamic_ruleset/roundstart/rule in roundstart_rules) if (!rule.weight) From 8b22bb111abe777d0db7dfc9b116b1debe98e105 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:48:07 +0300 Subject: [PATCH 9/9] better readme --- config/bandastation/bandastation_config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/bandastation/bandastation_config.txt b/config/bandastation/bandastation_config.txt index bd0949ebec6cd..2925f6c37cb00 100644 --- a/config/bandastation/bandastation_config.txt +++ b/config/bandastation/bandastation_config.txt @@ -8,5 +8,5 @@ ## A minimum amount of security required on roundstart ## If there is less security than this value, a percent of roundstart threat will be pushed to midround -## Example: if there is 2 security members out of N, then 3/N of roundstart threat will be moved to midround +## Example: with value of 5, if there is 2 security members out of 5, then 3/5 of roundstart threat will be moved to midround #ROUNDSTART_SECURITY_FOR_THREAT 5