From 03da6d6960e8c5e7e7015390021e14f5854ef0c9 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 10 Nov 2019 06:41:42 +0100 Subject: [PATCH] fixeronis. --- .../gamemodes/dynamic/dynamic_rulesets.dm | 42 +++++++++---------- .../dynamic/dynamic_rulesets_latejoin.dm | 2 +- .../dynamic/dynamic_rulesets_midround.dm | 6 +-- .../dynamic/dynamic_rulesets_roundstart.dm | 26 ++++++------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets.dm b/code/game/gamemodes/dynamic/dynamic_rulesets.dm index b77bfcc4a0..22a54d9b73 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets.dm @@ -2,21 +2,21 @@ /// For admin logging and round end screen. var/name = "" /// For admin logging and round end screen, do not change this unless making a new rule type. - var/ruletype = "" + var/ruletype = "" /// For config purposes, similar to config_tag for secret game modes. var/config_tag = null /// If set to TRUE, the rule won't be discarded after being executed, and dynamic will call rule_process() every time it ticks. - var/persistent = FALSE + var/persistent = FALSE /// If set to TRUE, dynamic mode will be able to draft this ruleset again later on. (doesn't apply for roundstart rules) - var/repeatable = FALSE + var/repeatable = FALSE /// If set higher than 0 decreases weight by itself causing the ruleset to appear less often the more it is repeated. - var/repeatable_weight_decrease = 2 + var/repeatable_weight_decrease = 2 /// List of players that are being drafted for this rule - var/list/mob/candidates = list() + var/list/mob/candidates = list() /// List of players that were selected for this rule - var/list/datum/mind/assigned = list() + var/list/datum/mind/assigned = list() /// Preferences flag such as ROLE_WIZARD that need to be turned on for players to be antag - var/antag_flag = null + var/antag_flag = null /// The antagonist datum that is assigned to the mobs mind on ruleset execution. var/datum/antagonist/antag_datum = null /// The required minimum account age for this ruleset. @@ -24,19 +24,19 @@ /// If set, and config flag protect_roles_from_antagonist is false, then the rule will not pick players from these roles. var/list/protected_roles = list() /// If set, rule will deny candidates from those roles always. - var/list/restricted_roles = list() + var/list/restricted_roles = list() /// If set, rule will only accept candidates from those roles, IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS. - var/list/exclusive_roles = list() + var/list/exclusive_roles = list() /// If set, there needs to be a certain amount of players doing those roles (among the players who won't be drafted) for the rule to be drafted IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS. - var/list/enemy_roles = list() + var/list/enemy_roles = list() /// If enemy_roles was set, this is the amount of enemy job workers needed per threat_level range (0-10,10-20,etc) IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS. - var/required_enemies = list(1,1,0,0,0,0,0,0,0,0) + var/required_enemies = list(1,1,0,0,0,0,0,0,0,0) /// The rule needs this many candidates (post-trimming) to be executed (example: Cult needs 4 players at round start) - var/required_candidates = 0 + var/required_candidates = 0 /// 1 -> 9, probability for this rule to be picked against other rules - var/weight = 5 + var/weight = 5 /// Threat cost for this rule, this is decreased from the mode's threat when the rule is executed. - var/cost = 0 + var/cost = 0 /// A flag that determines how the ruleset is handled /// HIGHLANDER_RULESET are rulesets can end the round. /// TRAITOR_RULESET and MINOR_RULESET can't end the round and have no difference right now. @@ -46,18 +46,18 @@ /// Requirements are the threat level requirements per pop range. /// With the default values, The rule will never get drafted below 10 threat level (aka: "peaceful extended"), and it requires a higher threat level at lower pops. var/list/requirements = list(40,30,20,10,10,10,10,10,10,10) - /// An alternative, static requirement used instead when pop is over mode's high_pop_limit. + /// An alternative, static requirement used instead when pop is over mode's high_pop_limit. var/high_population_requirement = 10 /// Reference to the mode, use this instead of SSticker.mode. var/datum/game_mode/dynamic/mode = null /// If a role is to be considered another for the purpose of banning. - var/antag_flag_override = null + var/antag_flag_override = null /// If a ruleset type which is in this list has been executed, then the ruleset will not be executed. var/list/blocking_rules = list() - /// The minimum amount of players required for the rule to be considered. + /// The minimum amount of players required for the rule to be considered. var/minimum_players = 0 /// The maximum amount of players required for the rule to be considered. - /// Anything below zero or exactly zero is ignored. + /// Anything below zero or exactly zero is ignored. var/maximum_players = 0 @@ -105,7 +105,7 @@ return (threat_level >= high_population_requirement) else pop_per_requirement = pop_per_requirement > 0 ? pop_per_requirement : mode.pop_per_requirement - var/indice_pop = min(10,round(population/pop_per_requirement)+1) + var/indice_pop = min(requirements.len,round(population/pop_per_requirement)+1) return (threat_level >= requirements[indice_pop]) /// This is called if persistent variable is true everytime SSTicker ticks. @@ -128,8 +128,8 @@ /// Here you can perform any additional checks you want. (such as checking the map etc) /// Remember that on roundstart no one knows what their job is at this point. /// IMPORTANT: If ready() returns TRUE, that means pre_execute() or execute() should never fail! -/datum/dynamic_ruleset/proc/ready(forced = 0) - if (required_candidates > candidates.len) +/datum/dynamic_ruleset/proc/ready(forced = 0) + if (required_candidates > candidates.len) return FALSE return TRUE diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm index a560e03f6e..5c4728bc89 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm @@ -17,7 +17,7 @@ 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) || is_banned_from(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? diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 006a80cca6..d26aa57856 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -44,7 +44,7 @@ candidates.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) || is_banned_from(M.ckey, list(antag_flag, ROLE_SYNDICATE))) candidates.Remove(M) continue if (M.mind) @@ -317,14 +317,14 @@ cost = 35 requirements = list(90,90,90,80,60,40,30,20,10,10) high_population_requirement = 10 - var/operative_cap = list(2,2,3,3,4,5,5,5,5,5) + var/list/operative_cap = list(2,2,3,3,4,5,5,5,5,5) var/datum/team/nuclear/nuke_team flags = HIGHLANDER_RULESET /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 - var/indice_pop = min(10,round(living_players.len/5)+1) + var/indice_pop = min(operative_cap.len, round(living_players.len/5)+1) required_candidates = operative_cap[indice_pop] return ..() diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index f515ccc443..d48153b222 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -123,7 +123,7 @@ /datum/dynamic_ruleset/roundstart/changeling/execute() var/team_mode = FALSE - if(prob(team_mode_probability)) + if(prob(team_mode_probability)) team_mode = TRUE var/list/team_objectives = subtypesof(/datum/objective/changeling_team_objective) var/list/possible_team_objectives = list() @@ -171,13 +171,13 @@ /datum/dynamic_ruleset/roundstart/wizard/pre_execute() if(GLOB.wizardstart.len == 0) return FALSE - + var/mob/M = pick_n_take(candidates) if (M) assigned += M.mind M.mind.assigned_role = ROLE_WIZARD M.mind.special_role = ROLE_WIZARD - + return TRUE /datum/dynamic_ruleset/roundstart/wizard/execute() @@ -185,7 +185,7 @@ M.current.forceMove(pick(GLOB.wizardstart)) M.add_antag_datum(new antag_datum()) return TRUE - + ////////////////////////////////////////////// // // // BLOOD CULT // @@ -207,16 +207,16 @@ high_population_requirement = 10 pop_per_requirement = 5 flags = HIGHLANDER_RULESET - var/cultist_cap = list(2,2,2,3,3,4,4,4,4,4) + var/list/cultist_cap = list(2,2,2,3,3,4,4,4,4,4) var/datum/team/cult/main_cult /datum/dynamic_ruleset/roundstart/bloodcult/ready(forced = FALSE) - var/indice_pop = min(10,round(mode.roundstart_pop_ready/pop_per_requirement)+1) + var/indice_pop = min(cultist_cap.len, round(mode.roundstart_pop_ready/pop_per_requirement)+1) required_candidates = cultist_cap[indice_pop] . = ..() /datum/dynamic_ruleset/roundstart/bloodcult/pre_execute() - var/indice_pop = min(10,round(mode.roundstart_pop_ready/pop_per_requirement)+1) + var/indice_pop = min(cultist_cap.len, round(mode.roundstart_pop_ready/pop_per_requirement)+1) var/cultists = cultist_cap[indice_pop] for(var/cultists_number = 1 to cultists) if(candidates.len <= 0) @@ -233,7 +233,7 @@ var/datum/antagonist/cult/new_cultist = new antag_datum() new_cultist.cult_team = main_cult new_cultist.give_equipment = TRUE - M.add_antag_datum(new_cultist) + M.add_antag_datum(new_cultist) main_cult.setup_objectives() return TRUE @@ -267,18 +267,18 @@ high_population_requirement = 10 pop_per_requirement = 5 flags = HIGHLANDER_RULESET - var/operative_cap = list(2,2,2,3,3,3,4,4,5,5) + var/list/operative_cap = list(2,2,2,3,3,3,4,4,5,5) var/datum/team/nuclear/nuke_team /datum/dynamic_ruleset/roundstart/nuclear/ready(forced = FALSE) - var/indice_pop = min(10,round(mode.roundstart_pop_ready/pop_per_requirement)+1) + var/indice_pop = min(operative_cap.len,round(mode.roundstart_pop_ready/pop_per_requirement)+1) required_candidates = operative_cap[indice_pop] . = ..() /datum/dynamic_ruleset/roundstart/nuclear/pre_execute() // If ready() did its job, candidates should have 5 or more members in it - var/indice_pop = min(10,round(mode.roundstart_pop_ready/5)+1) + var/indice_pop = min(operative_cap.len, round(mode.roundstart_pop_ready/5)+1) var/operatives = operative_cap[indice_pop] for(var/operatives_number = 1 to operatives) if(candidates.len <= 0) @@ -385,7 +385,7 @@ revolution.update_heads() SSshuttle.registerHostileEnvironment(src) return TRUE - + /datum/dynamic_ruleset/roundstart/revs/rule_process() if(check_rev_victory()) finished = 1 @@ -599,7 +599,7 @@ high_population_requirement = 101 var/devil_limit = 4 // Hard limit on devils if scaling is turned off -/datum/dynamic_ruleset/roundstart/devil/pre_execute() +/datum/dynamic_ruleset/roundstart/devil/pre_execute() var/tsc = CONFIG_GET(number/traitor_scaling_coeff) var/num_devils = 1