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
This commit is contained in:
Brandon Hu
2024-03-05 04:34:18 +00:00
committed by GitHub
parent 7d841d4df1
commit 511e245de1

View File

@@ -244,10 +244,23 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
/// </remarks>
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<ZombieImmuneComponent>(x) || HasComp<InitialInfectedExemptComponent>(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<ZombieImmuneComponent>);
//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<ZombieImmuneComponent>(player) || HasComp<InitialInfectedExemptComponent>(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<ZombieImmuneComponent>
);
//If there are no players to choose, abort
if (allPlayers.Count == 0)