Mob lists
This commit is contained in:
@@ -17,7 +17,10 @@ GLOBAL_LIST_EMPTY(dynamic_forced_roundstart_ruleset)
|
||||
GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
|
||||
/datum/game_mode/dynamic
|
||||
name = "dynamic mode"
|
||||
config_tag = "dynamic"
|
||||
announce_span = "danger"
|
||||
announce_text = "Dynamic mode!" // This needs to be changed maybe
|
||||
// Threat logging vars
|
||||
/// The "threat cap", threat shouldn't normally go above this and is used in ruleset calculations
|
||||
var/threat_level = 0
|
||||
@@ -252,7 +255,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
. = "<b><i>Central Command Status Summary</i></b><hr>"
|
||||
switch(round(shown_threat))
|
||||
if(0 to 19)
|
||||
if(!GLOB.current_living_antags.len)
|
||||
if(!current_players[CURRENT_LIVING_ANTAGS].len)
|
||||
. += "<b>Peaceful Waypoint</b></center><BR>"
|
||||
. += "Your station orbits deep within controlled, core-sector systems and serves as a waypoint for routine traffic through Nanotrasen's trade empire. Due to the combination of high security, interstellar traffic, and low strategic value, it makes any direct threat of violence unlikely. Your primary enemies will be incompetence and bored crewmen: try to organize team-building events to keep staffers interested and productive."
|
||||
else
|
||||
@@ -560,7 +563,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
if(high_impact_ruleset_executed)
|
||||
return FALSE
|
||||
|
||||
var/population = GLOB.alive_player_list.len
|
||||
var/population = current_players[CURRENT_LIVING_PLAYERS].len
|
||||
if((new_rule.acceptable(population, threat_level) && new_rule.cost <= mid_round_budget) || forced)
|
||||
new_rule.trim_candidates()
|
||||
if (new_rule.ready(forced))
|
||||
@@ -612,7 +615,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
for (var/datum/dynamic_ruleset/midround/rule in midround_rules)
|
||||
if (!rule.weight)
|
||||
continue
|
||||
if (rule.acceptable(GLOB.alive_player_list.len, threat_level) && mid_round_budget >= rule.cost)
|
||||
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level) && mid_round_budget >= rule.cost)
|
||||
rule.trim_candidates()
|
||||
if (rule.ready())
|
||||
drafted_rules[rule] = rule.get_weight()
|
||||
@@ -634,16 +637,16 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
forced_injection = dry_run
|
||||
return 100
|
||||
var/chance = 0
|
||||
var/max_pop_per_antag = max(5,15 - round(threat_level/10) - round(GLOB.alive_player_list.len/5))
|
||||
if (!GLOB.current_living_antags.len)
|
||||
var/max_pop_per_antag = max(5,15 - round(threat_level/10) - round(current_players[CURRENT_LIVING_PLAYERS].len/5))
|
||||
if (!current_players[CURRENT_LIVING_ANTAGS].len)
|
||||
chance += 50 // No antags at all? let's boost those odds!
|
||||
else
|
||||
var/current_pop_per_antag = GLOB.alive_player_list.len / GLOB.current_living_antags.len
|
||||
var/current_pop_per_antag = current_players[CURRENT_LIVING_PLAYERS].len / current_players[CURRENT_LIVING_ANTAGS].len
|
||||
if (current_pop_per_antag > max_pop_per_antag)
|
||||
chance += min(50, 25+10*(current_pop_per_antag-max_pop_per_antag))
|
||||
else
|
||||
chance += 25-10*(max_pop_per_antag-current_pop_per_antag)
|
||||
if (GLOB.dead_player_list.len > GLOB.alive_player_list.len)
|
||||
if (current_players[CURRENT_DEAD_PLAYERS].len > current_players[CURRENT_LIVING_PLAYERS].len)
|
||||
chance -= 30 // More than half the crew died? ew, let's calm down on antags
|
||||
if (mid_round_budget > higher_injection_chance_minimum_threat)
|
||||
chance += higher_injection_chance
|
||||
@@ -707,7 +710,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
for (var/datum/dynamic_ruleset/latejoin/rule in latejoin_rules)
|
||||
if (!rule.weight)
|
||||
continue
|
||||
if (rule.acceptable(GLOB.alive_player_list.len, threat_level) && mid_round_budget >= rule.cost)
|
||||
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level) && mid_round_budget >= rule.cost)
|
||||
// No stacking : only one round-ender, unless threat level > stacking_limit.
|
||||
if (threat_level < GLOB.dynamic_stacking_limit && GLOB.dynamic_no_stacking)
|
||||
if(rule.flags & HIGH_IMPACT_RULESET && high_impact_ruleset_executed)
|
||||
|
||||
@@ -89,11 +89,11 @@
|
||||
|
||||
new_snapshot.remaining_threat = mid_round_budget
|
||||
new_snapshot.time = world.time
|
||||
new_snapshot.alive_players = GLOB.alive_player_list.len
|
||||
new_snapshot.dead_players = GLOB.dead_player_list.len
|
||||
new_snapshot.observers = GLOB.current_observers_list.len
|
||||
new_snapshot.alive_players = current_players[CURRENT_LIVING_PLAYERS].len
|
||||
new_snapshot.dead_players = current_players[CURRENT_DEAD_PLAYERS].len
|
||||
new_snapshot.observers = current_players[CURRENT_OBSERVERS].len
|
||||
new_snapshot.total_players = new_snapshot.alive_players + new_snapshot.dead_players + new_snapshot.observers
|
||||
new_snapshot.alive_antags = GLOB.current_living_antags.len
|
||||
new_snapshot.alive_antags = current_players[CURRENT_LIVING_ANTAGS].len
|
||||
new_snapshot.ruleset_chosen = new /datum/dynamic_snapshot_ruleset(ruleset_chosen)
|
||||
|
||||
LAZYADD(snapshots, new_snapshot)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
if (!forced)
|
||||
var/job_check = 0
|
||||
if (enemy_roles.len > 0)
|
||||
for (var/mob/M in GLOB.alive_player_list)
|
||||
for (var/mob/M in mode.current_players[CURRENT_LIVING_PLAYERS])
|
||||
if (M.stat == DEAD)
|
||||
continue // Dead players cannot count as opponents
|
||||
if (M.mind && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
|
||||
@@ -96,7 +96,7 @@
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/head_check = 0
|
||||
for(var/mob/player in GLOB.alive_player_list)
|
||||
for(var/mob/player in mode.current_players[CURRENT_LIVING_PLAYERS])
|
||||
if (player.mind.assigned_role in GLOB.command_positions)
|
||||
head_check++
|
||||
return (head_check >= required_heads_of_staff)
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
var/required_applicants = 1
|
||||
|
||||
/datum/dynamic_ruleset/midround/trim_candidates()
|
||||
living_players = trim_list(GLOB.alive_player_list)
|
||||
living_antags = trim_list(GLOB.current_living_antags)
|
||||
dead_players = trim_list(GLOB.dead_player_list)
|
||||
list_observers = trim_list(GLOB.current_observers_list)
|
||||
living_players = trim_list(mode.current_players[CURRENT_LIVING_PLAYERS])
|
||||
living_antags = trim_list(mode.current_players[CURRENT_LIVING_ANTAGS])
|
||||
dead_players = trim_list(mode.current_players[CURRENT_DEAD_PLAYERS])
|
||||
list_observers = trim_list(mode.current_players[CURRENT_OBSERVERS])
|
||||
|
||||
/datum/dynamic_ruleset/midround/proc/trim_list(list/L = list())
|
||||
var/list/trimmed_list = L.Copy()
|
||||
@@ -75,7 +75,7 @@
|
||||
if (!forced)
|
||||
var/job_check = 0
|
||||
if (enemy_roles.len > 0)
|
||||
for (var/mob/M in GLOB.alive_player_list)
|
||||
for (var/mob/M in mode.current_players[CURRENT_LIVING_PLAYERS])
|
||||
if (M.stat == DEAD || !M.client)
|
||||
continue // Dead/disconnected players cannot count as opponents
|
||||
if (M.mind && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
|
||||
@@ -198,8 +198,8 @@
|
||||
var/has_failure_chance = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/midround/autotraitor/acceptable(population = 0, threat = 0)
|
||||
var/player_count = GLOB.alive_player_list.len
|
||||
var/antag_count = GLOB.current_living_antags.len
|
||||
var/player_count = mode.current_players[CURRENT_LIVING_PLAYERS].len
|
||||
var/antag_count = mode.current_players[CURRENT_LIVING_ANTAGS].len
|
||||
var/max_traitors = round(player_count / 10) + 1
|
||||
|
||||
// adding traitors if the antag population is getting low
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
var/datum/dynamic_ruleset/rule = sent_rule
|
||||
spend_midround_budget(rule.cost)
|
||||
threat_log += "[worldtime2text()]: [rule.ruletype] [rule.name] spent [rule.cost]"
|
||||
rule.pre_execute(GLOB.alive_player_list.len)
|
||||
rule.pre_execute(current_players[CURRENT_LIVING_PLAYERS].len)
|
||||
if (rule.execute())
|
||||
log_game("DYNAMIC: Injected a [rule.ruletype == "latejoin" ? "latejoin" : "midround"] ruleset [rule.name].")
|
||||
if(rule.flags & HIGH_IMPACT_RULESET)
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
var/setup_error //What stopepd setting up the mode.
|
||||
var/flipseclevel = FALSE //CIT CHANGE - adds a 10% chance for the alert level to be the opposite of what the gamemode is supposed to have
|
||||
|
||||
/// Associative list of current players, in order: living players, living antagonists, dead players and observers.
|
||||
var/list/list/current_players = list(CURRENT_LIVING_PLAYERS = list(), CURRENT_LIVING_ANTAGS = list(), CURRENT_DEAD_PLAYERS = list(), CURRENT_OBSERVERS = list())
|
||||
|
||||
/datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description.
|
||||
to_chat(world, "<b>The gamemode is: <span class='[announce_span]'>[name]</span>!</b>")
|
||||
to_chat(world, "<b>[announce_text]</b>")
|
||||
@@ -76,6 +79,8 @@
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
|
||||
///Attempts to select players for special roles the mode might have.
|
||||
/datum/game_mode/proc/pre_setup()
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user