Skip to content

Commit

Permalink
diff zombi
Browse files Browse the repository at this point in the history
  • Loading branch information
CrimeMoot authored Jan 2, 2025
1 parent 0cfaf5c commit 4d20208
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public sealed partial class GameTicker
// Mainly to avoid allocations.
private readonly List<EntityCoordinates> _possiblePositions = new();

private List<EntityUid> GetSpawnableStations()
public List<EntityUid> GetSpawnableStations() // Cats edit
{
var spawnableStations = new List<EntityUid>();
var query = EntityQueryEnumerator<StationJobsComponent, StationSpawningComponent>();
Expand Down
31 changes: 13 additions & 18 deletions Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ZombieSystem _zombie = default!;
[Dependency] private readonly GameTicker _gameTicker = default!; // Cats edit

public override void Initialize()
{
Expand Down Expand Up @@ -84,7 +85,7 @@ protected override void AppendRoundEndText(EntityUid uid,
("username", data.UserName)));
}

var healthy = GetHealthyHumans();
var healthy = GetHealthyHumans(true); // Cats edit
// Gets a bunch of the living players and displays them if they're under a threshold.
// InitialInfected is used for the threshold because it scales with the player count well.
if (healthy.Count <= 0 || healthy.Count > 2 * antags.Count)
Expand Down Expand Up @@ -159,7 +160,7 @@ private void OnZombifySelf(EntityUid uid, IncurableZombieComponent component, Zo
/// <param name="includeOffStation">Include healthy players that are not on the station grid</param>
/// <param name="includeDead">Should dead zombies be included in the count</param>
/// <returns></returns>
private float GetInfectedFraction(bool includeOffStation = true, bool includeDead = false)
private float GetInfectedFraction(bool includeOffStation = false, bool includeDead = true) // Cats edit
{
var players = GetHealthyHumans(includeOffStation);
var zombieCount = 0;
Expand All @@ -179,14 +180,14 @@ private float GetInfectedFraction(bool includeOffStation = true, bool includeDea
/// Flying off via a shuttle disqualifies you.
/// </summary>
/// <returns></returns>
private List<EntityUid> GetHealthyHumans(bool includeOffStation = true)
private List<EntityUid> GetHealthyHumans(bool includeOffStation = false) // Cats edit
{
var healthy = new List<EntityUid>();

var stationGrids = new HashSet<EntityUid>();
if (!includeOffStation)
{
foreach (var station in _station.GetStationsSet())
foreach (var station in _gameTicker.GetSpawnableStations()) // Cats edit
{
if (TryComp<StationDataComponent>(station, out var data) && _station.GetLargestGrid(data) is { } grid)
stationGrids.Add(grid);
Expand All @@ -195,25 +196,19 @@ private List<EntityUid> GetHealthyHumans(bool includeOffStation = true)

var players = AllEntityQuery<HumanoidAppearanceComponent, ActorComponent, MobStateComponent, TransformComponent>();
var zombers = GetEntityQuery<ZombieComponent>();
var centcom = GetEntityQuery<ZombieComponent>(); // backmen: centcom
while (players.MoveNext(out var uid, out _, out _, out var mob, out var xform))
{
if (!_mobState.IsAlive(uid, mob))
continue;

if (zombers.HasComponent(uid))
continue;

// start-backmen: centcom
if (centcom.HasComponent(uid))
continue;
// end-backmen: centcom

if (!includeOffStation && !stationGrids.Contains(xform.GridUid ?? EntityUid.Invalid))
// Cats edit-Start
if (!_mobState.IsAlive(uid, mob)
|| HasComp<PendingZombieComponent>(uid) //Do not include infected players in the "Healthy players" list.
|| HasComp<ZombifyOnDeathComponent>(uid)
|| zombers.HasComponent(uid)
|| !includeOffStation && !stationGrids.Contains(xform.GridUid ?? EntityUid.Invalid))
// Cats edit-End
continue;

healthy.Add(uid);
}
return healthy;
}
}
}

0 comments on commit 4d20208

Please sign in to comment.