mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
* [Feature] Wormhole Anomaly * duration edit * timed teleportation * IRobustRandom * Update Content.Server/_White/Anomaly/Effects/WormholeAnomalySystem.cs Co-authored-by: Remuchi <72476615+Remuchi@users.noreply.github.com> * remove on shutdown * counts --------- Co-authored-by: Remuchi <72476615+Remuchi@users.noreply.github.com>
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using System;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Server.StationEvents.Components;
|
|
using Content.Shared.GameTicking.Components;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Server.StationEvents.Events;
|
|
|
|
public sealed class RandomSpawnRule : StationEventSystem<RandomSpawnRuleComponent>
|
|
{
|
|
[Dependency] private readonly IRobustRandom _random = default!; // WWDP
|
|
protected override void Started(EntityUid uid, RandomSpawnRuleComponent comp, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
{
|
|
base.Started(uid, comp, gameRule, args);
|
|
|
|
// WWDP-EDIT-START
|
|
int spawnCount = _random.Next(comp.MinCount, comp.MaxCount + 1);
|
|
|
|
for (int i = 0; i < spawnCount; i++)
|
|
{
|
|
if (TryFindRandomTile(out _, out _, out _, out var coords))
|
|
{
|
|
Sawmill.Info($"Spawning {comp.Prototype} at {coords}");
|
|
Spawn(comp.Prototype, coords);
|
|
}
|
|
// WWDP-EDIT-END
|
|
}
|
|
}
|
|
}
|