CatStation/Content.Server/StationEvents/Events/RandomSpawnRule.cs
Whatstone 27ca7ebbc6
Cleanup: Resolve GameRule warnings. (#46094)
* Resolve StationEvent warnings

* fix misuses of ent after rename, paracusia flip

* oh god more rules

* comments, whitespace, unnecessary precision

* comments, NotNull->IsNull

oops

* more consistent ent vs. ent.Owner, whitespace

* Greytide: "with accress from... access groups"
2026-09-20 17:55:24 +00:00

22 lines
794 B
C#

using Content.Server.StationEvents.Components;
using Content.Shared.GameTicking.Components;
namespace Content.Server.StationEvents.Events;
/// <summary>
/// Handler for events that spawn a given entity at a random tile on the affected station.
/// </summary>
/// <seealso cref="RandomSpawnRuleComponent"/>
public sealed partial class RandomSpawnRule : StationEventSystem<RandomSpawnRuleComponent>
{
protected override void Started(Entity<RandomSpawnRuleComponent, GameRuleComponent> ent, ref GameRuleStartedEvent args)
{
base.Started(ent, ref args);
if (Station.TryFindRandomTile(out _, out _, out _, out var coords))
{
Sawmill.Info($"Spawning {ent.Comp1.Prototype} at {coords}");
Spawn(ent.Comp1.Prototype, coords);
}
}
}