From 511e245de1fe668e0af5d2ae0581c54e44712812 Mon Sep 17 00:00:00 2001 From: Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> Date: Tue, 5 Mar 2024 04:34:18 +0000 Subject: [PATCH] Remove the ability for command or any antag-safe role from being initial infected in zombie mode #25529 (#25785) * fix(antags): respects canBeAntag = true * updated more * includeAllJobs = False?????????? * fixed comma placement * removed unused dependencies --- .../GameTicking/Rules/ZombieRuleSystem.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs b/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs index aa8ada95a7..0b7cb9cf8f 100644 --- a/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs @@ -244,10 +244,23 @@ public sealed class ZombieRuleSystem : GameRuleSystem /// private void InfectInitialPlayers(ZombieRuleComponent component) { - //Get all players with initial infected enabled, and exclude those with the ZombieImmuneComponent - var eligiblePlayers = _antagSelection.GetEligiblePlayers(_playerManager.Sessions, component.PatientZeroPrototypeId, includeAllJobs: true, customExcludeCondition: x => HasComp(x) || HasComp(x)); - //And get all players, excluding ZombieImmune - to fill any leftover initial infected slots - var allPlayers = _antagSelection.GetEligiblePlayers(_playerManager.Sessions, component.PatientZeroPrototypeId, acceptableAntags: Shared.Antag.AntagAcceptability.All, includeAllJobs: true, ignorePreferences: true, customExcludeCondition: HasComp); + //Get all players with initial infected enabled, and exclude those with the ZombieImmuneComponent and roles with CanBeAntag = False + var eligiblePlayers = _antagSelection.GetEligiblePlayers( + _playerManager.Sessions, + component.PatientZeroPrototypeId, + includeAllJobs: false, + customExcludeCondition: player => HasComp(player) || HasComp(player) + ); + + //And get all players, excluding ZombieImmune and roles with CanBeAntag = False - to fill any leftover initial infected slots + var allPlayers = _antagSelection.GetEligiblePlayers( + _playerManager.Sessions, + component.PatientZeroPrototypeId, + acceptableAntags: Shared.Antag.AntagAcceptability.All, + includeAllJobs: false , + ignorePreferences: true, + customExcludeCondition: HasComp + ); //If there are no players to choose, abort if (allPlayers.Count == 0) -- 2.51.2