Files
OldThink/Content.Server/StationEvents/Events/VentCritters.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

35 lines
1.1 KiB
C#

using System.Linq;
using Content.Server.StationEvents.Components;
using Content.Shared.Sound;
using Robust.Shared.Random;
namespace Content.Server.StationEvents.Events;
public sealed class VentCritters : StationEventSystem
{
public static List<string> SpawnedPrototypeChoices = new List<string>()
{"MobGiantSpiderAngry", "MobMouse", "MobMouse1", "MobMouse2"};
public override string Prototype => "VentCritters";
public override void Started()
{
base.Started();
var spawnChoice = RobustRandom.Pick(SpawnedPrototypeChoices);
var spawnLocations = EntityManager.EntityQuery<VentCritterSpawnLocationComponent>().ToList();
RobustRandom.Shuffle(spawnLocations);
var spawnAmount = RobustRandom.Next(4, 12); // A small colony of critters.
Sawmill.Info($"Spawning {spawnAmount} of {spawnChoice}");
foreach (var location in spawnLocations)
{
if (spawnAmount-- == 0)
break;
var coords = EntityManager.GetComponent<TransformComponent>(location.Owner);
EntityManager.SpawnEntity(spawnChoice, coords.Coordinates);
}
}
}