dragon minor refactor and stuff (#18149)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Content.Server.StationEvents.Events;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.StationEvents.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Spawns a single entity at a random tile on a station using TryGetRandomTile.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(RandomSpawnRule))]
|
||||
public sealed class RandomSpawnRuleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity to be spawned.
|
||||
/// </summary>
|
||||
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string Prototype = string.Empty;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Content.Server.StationEvents.Events;
|
||||
|
||||
namespace Content.Server.StationEvents.Components;
|
||||
|
||||
[RegisterComponent, Access(typeof(RevenantSpawnRule))]
|
||||
public sealed class RevenantSpawnRuleComponent : Component
|
||||
{
|
||||
[DataField("revenantPrototype")]
|
||||
public string RevenantPrototype = "MobRevenant";
|
||||
}
|
||||
18
Content.Server/StationEvents/Events/RandomSpawnRule.cs
Normal file
18
Content.Server/StationEvents/Events/RandomSpawnRule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.StationEvents.Components;
|
||||
|
||||
namespace Content.Server.StationEvents.Events;
|
||||
|
||||
public sealed class RandomSpawnRule : StationEventSystem<RandomSpawnRuleComponent>
|
||||
{
|
||||
protected override void Started(EntityUid uid, RandomSpawnRuleComponent comp, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||
{
|
||||
base.Started(uid, comp, gameRule, args);
|
||||
|
||||
if (TryFindRandomTile(out _, out _, out _, out var coords))
|
||||
{
|
||||
Sawmill.Info($"Spawning {comp.Prototype} at {coords}");
|
||||
Spawn(comp.Prototype, coords);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.StationEvents.Components;
|
||||
|
||||
namespace Content.Server.StationEvents.Events;
|
||||
|
||||
public sealed class RevenantSpawnRule : StationEventSystem<RevenantSpawnRuleComponent>
|
||||
{
|
||||
protected override void Started(EntityUid uid, RevenantSpawnRuleComponent component, GameRuleComponent gameRule,
|
||||
GameRuleStartedEvent args)
|
||||
{
|
||||
base.Started(uid, component, gameRule, args);
|
||||
|
||||
if (TryFindRandomTile(out _, out _, out _, out var coords))
|
||||
{
|
||||
Sawmill.Info($"Spawning revenant at {coords}");
|
||||
Spawn(component.RevenantPrototype, coords);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user