Made minor roundstarts actually work.

This commit is contained in:
Putnam
2020-12-17 22:44:35 -08:00
parent bdd5fc777f
commit 6f0075e606
3 changed files with 44 additions and 2 deletions
+1 -1
View File
@@ -415,7 +415,7 @@ GLOBAL_VAR_INIT(dynamic_forced_storyteller, null)
/datum/game_mode/dynamic/post_setup(report)
update_playercounts()
if(minor_ruleset_start)
addtimer(CALLBACK(src, /datum/game_mode/dynamic/.proc/minor_roundstart),rand(1 MINUTES,5 MINUTES))
addtimer(CALLBACK(src, /datum/game_mode/dynamic/.proc/minor_roundstart),rand(1 MINUTES,3 MINUTES))
else
for(var/datum/dynamic_ruleset/roundstart/rule in executed_rules)
addtimer(CALLBACK(src, /datum/game_mode/dynamic/.proc/execute_roundstart_rule, rule), rule.delay)
@@ -1,3 +1,46 @@
/datum/dynamic_ruleset/minor/proc/trim_list(list/L = list())
var/list/trimmed_list = L.Copy()
for(var/mob/M in trimmed_list)
if (!ishuman(M))
trimmed_list.Remove(M)
continue
if (HAS_TRAIT(M, TRAIT_NO_MIDROUND_ANTAG))
trimmed_list.Remove(M)
continue
if (!M.client) // Are they connected?
trimmed_list.Remove(M)
continue
if(!mode.check_age(M.client, minimum_required_age))
trimmed_list.Remove(M)
continue
if(antag_flag_override)
if(!(antag_flag_override in M.client.prefs.be_special) || jobban_isbanned(M.ckey, antag_flag_override))
trimmed_list.Remove(M)
continue
else
if(!(antag_flag in M.client.prefs.be_special) || jobban_isbanned(M.ckey, antag_flag))
trimmed_list.Remove(M)
continue
if (M.mind)
if ((M.mind.assigned_role in GLOB.exp_specialmap[EXP_TYPE_SPECIAL])) // Are they playing a ghost role?
trimmed_list.Remove(M)
continue
if (M.mind.assigned_role in restricted_roles) // Does their job allow it?
trimmed_list.Remove(M)
continue
if ((exclusive_roles.len > 0) && !(M.mind.assigned_role in exclusive_roles)) // Is the rule exclusive to their job?
trimmed_list.Remove(M)
continue
return trimmed_list
/datum/dynamic_ruleset/minor/trim_candidates()
//
// All you need to know is that here, the candidates list contains 4 lists itself, indexed with the following defines:
// Candidates = list(CURRENT_LIVING_PLAYERS, CURRENT_LIVING_ANTAGS, CURRENT_DEAD_PLAYERS, CURRENT_OBSERVERS)
// So for example you can get the list of all current dead players with var/list/dead_players = candidates[CURRENT_DEAD_PLAYERS]
// Make sure to properly typecheck the mobs in those lists, as the dead_players list could contain ghosts, or dead players still in their bodies.
// We're still gonna trim the obvious (mobs without clients, jobbanned players, etc)
candidates = trim_list(mode.current_players[CURRENT_LIVING_PLAYERS])
//////////////////////////////////////////////
// //
@@ -128,7 +128,6 @@ Property weights are added to the config weight of the ruleset. They are:
var/list/drafted_rules = list()
for (var/datum/dynamic_ruleset/minor/rule in mode.minor_rules)
if (rule.acceptable(mode.current_players[CURRENT_LIVING_PLAYERS].len, mode.threat_level))
rule.candidates = mode.candidates.Copy()
rule.trim_candidates()
if (rule.ready() && rule.candidates.len > 0)
var/property_weight = 0