Editing stuff to let it compile (see description)

Malf AI is no longer available as a roundstart ruleset because antag assignment happens before job assignment. On secret, this is not a problem, but on dynamic, there is no way to make malfunctioning AI limited to certain threat levels except by making it a delayed ruleset. Unfortunately, with the upstream changes, delayed rulesets were removed--all roundstart rulesets are delayed, and if it were to roll malf AI, it would simply error, make a runtime stack trace and, in general, shit the bed. There would be no roundstart antag that round, which is *kind of* a problem I'm desperate to fix. So, no more roundstart malf--it's either that or some rounds having no roundstart antags at all.
This commit is contained in:
Putnam
2019-11-10 22:58:16 -08:00
parent b5d8b30ae3
commit 9618050b17
4 changed files with 13 additions and 63 deletions
@@ -223,11 +223,11 @@
candidates.Remove(P)
continue
if(antag_flag_override)
if(!(antag_flag_override in P.client.prefs.be_special) || is_banned_from(P.ckey, list(antag_flag_override, ROLE_SYNDICATE)))
if(!(antag_flag_override in P.client.prefs.be_special) || jobban_isbanned(P.ckey, list(antag_flag_override, ROLE_SYNDICATE)))
candidates.Remove(P)
continue
else
if(!(antag_flag in P.client.prefs.be_special) || is_banned_from(P.ckey, list(antag_flag, ROLE_SYNDICATE)))
if(!(antag_flag in P.client.prefs.be_special) || jobban_isbanned(P.ckey, list(antag_flag, ROLE_SYNDICATE)))
candidates.Remove(P)
continue
@@ -13,11 +13,11 @@
candidates.Remove(P)
continue
if(antag_flag_override)
if(!(antag_flag_override in P.client.prefs.be_special) || is_banned_from(P.ckey, list(antag_flag_override, ROLE_SYNDICATE)))
if(!(antag_flag_override in P.client.prefs.be_special) || jobban_isbanned(P.ckey, list(antag_flag_override)))
candidates.Remove(P)
continue
else
if(!(antag_flag in P.client.prefs.be_special) || is_banned_from(P.ckey, list(antag_flag, ROLE_SYNDICATE)))
if(!(antag_flag in P.client.prefs.be_special) || jobban_isbanned(P.ckey, list(antag_flag, ROLE_SYNDICATE)))
candidates.Remove(P)
continue
if (P.mind.assigned_role in restricted_roles) // Does their job allow for it?
@@ -48,11 +48,11 @@
trimmed_list.Remove(M)
continue
if(antag_flag_override)
if(!(antag_flag_override in M.client.prefs.be_special) || is_banned_from(M.ckey, list(antag_flag_override, ROLE_SYNDICATE)))
if(!(antag_flag_override in M.client.prefs.be_special) || jobban_isbanned(M.ckey, list(antag_flag_override, ROLE_SYNDICATE)))
trimmed_list.Remove(M)
continue
else
if(!(antag_flag in M.client.prefs.be_special) || is_banned_from(M.ckey, list(antag_flag, ROLE_SYNDICATE)))
if(!(antag_flag in M.client.prefs.be_special) || jobban_isbanned(M.ckey, list(antag_flag, ROLE_SYNDICATE)))
trimmed_list.Remove(M)
continue
if (M.mind)
@@ -349,7 +349,13 @@
/datum/dynamic_ruleset/midround/from_ghosts/nuclear/acceptable(population=0, threat=0)
if (locate(/datum/dynamic_ruleset/roundstart/nuclear) in mode.executed_rules)
return FALSE // Unavailable if nuke ops were already sent at roundstart
indice_pop = min(operative_cap.len, round(living_players.len/5)+1)
indice_pop = min(10, round(living_players.len/5)+1)
/* NOTE: The above line's magic value of "10" is a hack due to the fact that byond was
not recognizing operative_cap as a defined variable. It should be operative_cap.len--
and yes, this means that if the len is changed, this variable must be changed along with it.
One day, once the mystery of why this issue was occuring is figured out,
we may change it back, but until this day comes, we must make it simply 10.
*/
required_candidates = operative_cap[indice_pop]
return ..()
@@ -41,62 +41,6 @@
log_game("DYNAMIC: Checking if we can turn someone into a traitor.")
mode.picking_specific_rule(/datum/dynamic_ruleset/midround/autotraitor)
//////////////////////////////////////////////
// //
// MALF AI //
// //
//////////////////////////////////////////////
/datum/dynamic_ruleset/roundstart/malf_ai
name = "Malfunctioning AI"
config_tag = "malf_ai"
antag_datum = /datum/antagonist/traitor
antag_flag = ROLE_MALF
enemy_roles = list("Security Officer", "Warden","Detective","Head of Security", "Captain", "Scientist", "Chemist", "Research Director", "Chief Engineer")
exclusive_roles = list("AI")
required_enemies = list(4,4,4,4,4,4,2,2,2,0)
required_candidates = 1
weight = 1
cost = 35
requirements = list(101,101,101,100,90,80,70,60,50,50)
high_population_requirement = 50
required_type = /mob/living/silicon/ai
delay = 30 SECONDS
var/autotraitor_cooldown = 450 // 15 minutes (ticks once per 2 sec)
/datum/dynamic_ruleset/roundstart/malf_ai/trim_candidates()
..()
candidates = candidates[CURRENT_LIVING_PLAYERS]
for(var/mob/living/player in candidates)
if(!isAI(player))
candidates -= player
continue
if(is_centcom_level(player.z))
candidates -= player
continue
if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0))
candidates -= player
/datum/dynamic_ruleset/roundstart/malf_ai/execute()
if(!candidates || !candidates.len)
return FALSE
var/mob/living/silicon/ai/M = pick(candidates)
candidates -= M
assigned += M.mind
var/datum/antagonist/traitor/AI = new
M.mind.special_role = antag_flag
M.mind.add_antag_datum(AI)
return TRUE
/datum/dynamic_ruleset/roundstart/malf_ai/rule_process()
if (autotraitor_cooldown > 0)
autotraitor_cooldown--
else
autotraitor_cooldown = 450 // 15 minutes
message_admins("Checking if we can turn someone into a traitor.")
log_game("DYNAMIC: Checking if we can turn someone into a traitor.")
mode.picking_specific_rule(/datum/dynamic_ruleset/midround/autotraitor)
//////////////////////////////////////////
// //
// BLOOD BROTHERS //