Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions code/game/gamemodes/dynamic/dynamic_rulesets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,23 @@

/// Checks if candidates are connected and if they are banned or don't want to be the antagonist.
/datum/dynamic_ruleset/roundstart/trim_candidates()
var/list/real_candidates = list()
for(var/mob/dead/new_player/candidate_player in candidates)
var/client/candidate_client = GET_CLIENT(candidate_player)
if (!candidate_client || !candidate_player.mind) // Are they connected?
candidates.Remove(candidate_player)
continue

else if(!mode.check_age(candidate_client, minimum_required_age))
candidates.Remove(candidate_player)
continue

if(candidate_player.mind.special_role) // We really don't want to give antag to an antag.
candidates.Remove(candidate_player)
continue

if(antag_flag_override)
if(!(HAS_ANTAG_PREF(candidate_player.client, antag_flag_override)))
candidates.Remove(candidate_player)
continue
else
if(!(HAS_ANTAG_PREF(candidate_player.client, antag_flag)))
candidates.Remove(candidate_player)
continue

// If this ruleset has exclusive_roles set, we want to only consider players who have those
Expand All @@ -232,7 +228,9 @@
// If they didn't have any of the required job prefs enabled or were banned from all enabled prefs,
// they're not eligible for this antag type.
if(!exclusive_candidate)
candidates.Remove(candidate_player)
continue
real_candidates += candidate_player.mind
candidates = real_candidates

/// Do your checks if the ruleset is ready to be executed here.
/// Should ignore certain checks if forced is TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
cost = 20
requirements = list(101,101,101,101,50,20,20,20,20,20)
flags = HIGH_IMPACT_RULESET
blocking_rules = list(/datum/dynamic_ruleset/roundstart/revs)
blocking_rules = list(/datum/dynamic_ruleset/roundstart/on_station/revs)
var/required_heads_of_staff = 3
var/finished = FALSE
/// How much threat should be injected when the revolution wins?
Expand Down
40 changes: 21 additions & 19 deletions code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,26 +216,28 @@

/datum/dynamic_ruleset/midround/autotraitor/trim_candidates()
..()
candidates = list()
for(var/mob/living/player in living_players)
if(issilicon(player)) // Your assigned role doesn't change when you are turned into a silicon.
living_players -= player
continue
else if(is_centcom_level(player.z))
living_players -= player // We don't autotator people in CentCom
continue // We don't autotator people in CentCom
else if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0))
living_players -= player // We don't autotator people with roles already
continue // We don't autotator people with roles already
candidates += player.mind

/datum/dynamic_ruleset/midround/autotraitor/ready(forced = FALSE)
if (required_candidates > living_players.len)
return FALSE
return ..()

/datum/dynamic_ruleset/midround/autotraitor/execute()
var/mob/M = pick(living_players)
var/datum/mind/M = antag_pick(candidates)
assigned += M
living_players -= M
living_players -= M.current
var/datum/antagonist/traitor/newTraitor = new
M.mind.add_antag_datum(newTraitor)
message_admins("[ADMIN_LOOKUPFLW(M)] was selected by the [name] ruleset and has been made into a midround traitor.")
M.add_antag_datum(newTraitor)
message_admins("[ADMIN_LOOKUPFLW(M.current)] was selected by the [name] ruleset and has been made into a midround traitor.")
log_game("DYNAMIC: [key_name(M)] was selected by the [name] ruleset and has been made into a midround traitor.")
return TRUE

Expand Down Expand Up @@ -323,33 +325,33 @@

/datum/dynamic_ruleset/midround/malf/trim_candidates()
..()
candidates = living_players
candidates = list()
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
continue
candidates += player.mind

/datum/dynamic_ruleset/midround/malf/execute()
if(!candidates || !candidates.len)
return FALSE
var/mob/living/silicon/ai/M = pick_n_take(candidates)
assigned += M.mind
var/datum/antagonist/traitor/AI = new
M.mind.special_role = antag_flag
M.mind.add_antag_datum(AI)
var/datum/mind/M = antag_pick(candidates)
assigned += M
var/datum/antagonist/traitor/malf = new
M.special_role = antag_flag
M.add_antag_datum(malf)
if(prob(MALF_ION_PROB))
var/mob/living/silicon/ai = M.current
priority_announce("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert", "ionstorm")
if(prob(REPLACE_LAW_WITH_ION_PROB))
M.replace_random_law(generate_ion_law(), list(LAW_INHERENT, LAW_SUPPLIED, LAW_ION))
ai.replace_random_law(generate_ion_law(), list(LAW_INHERENT, LAW_SUPPLIED, LAW_ION))
else
M.add_ion_law(generate_ion_law())
ai.add_ion_law(generate_ion_law())
return TRUE

//////////////////////////////////////////////
Expand Down Expand Up @@ -467,7 +469,7 @@
flags = HIGH_IMPACT_RULESET

/datum/dynamic_ruleset/midround/ratvar_awakening/acceptable(population=0, threat=0)
if (locate(/datum/dynamic_ruleset/roundstart/clockcult) in mode.executed_rules)
if (locate(/datum/dynamic_ruleset/roundstart/on_station/clockcult) in mode.executed_rules)
return FALSE // Unavailable if clockies exist at round start
indice_pop = min(clock_cap.len, round(living_players.len/5)+1)
required_candidates = clock_cap[indice_pop]
Expand Down
Loading