Files
tbd-station-14/Content.Server/StationEvents/Events/ZombieOutbreak.cs
Kara b9a0894d7c Event refactor (#9589)
* Station event refactor

* Remove clientside `IStationEventManager`

we can just use prototypes

* Basic API idea

* Cruft

* first attempt at epicness

* okay yeah this shit is really clean

* sort out minor stuff

* Convert `BreakerFlip`

* `BureaucraticError` + general cleanup

* `DiseaseOutbreak`

* `FalseAlarm`

* `GasLeak`

* `KudzuGrowth`

* `MeteorSwarm`

* `MouseMigration`

* misc errors

* `PowerGridCheck`

* `RandomSentience`

* `VentClog`

* `VentCritters`

* `ZombieOutbreak`

* Rewrite basic event scheduler

* Minor fixes and logging

* ooooops

* errors + fix

* linter

* completions, `RuleStarted` property, update loop fixes

* Tweaks

* Fix #9462

* Basic scheduler update fix, and fixes #8174

* Add test

* UI cleanup

* really this was just for testing
2022-07-10 20:48:41 -05:00

42 lines
1.2 KiB
C#

using Content.Shared.MobState.Components;
using Content.Server.Zombies;
namespace Content.Server.StationEvents.Events
{
/// <summary>
/// Revives several dead entities as zombies
/// </summary>
public sealed class ZombieOutbreak : StationEventSystem
{
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
public override string Prototype => "ZombieOutbreak";
/// <summary>
/// Finds 1-3 random, dead entities across the station
/// and turns them into zombies.
/// </summary>
public override void Started()
{
base.Started();
List<MobStateComponent> deadList = new();
foreach (var mobState in EntityManager.EntityQuery<MobStateComponent>())
{
if (mobState.IsDead() || mobState.IsCritical())
deadList.Add(mobState);
}
RobustRandom.Shuffle(deadList);
var toInfect = RobustRandom.Next(1, 3);
foreach (var target in deadList)
{
if (toInfect-- == 0)
break;
_zombify.ZombifyEntity(target.Owner);
}
}
}
}