Rename SmokeDissipateSpawnComponent to SpawnOnDespawnComponent (#20782)
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
using Content.Server.Fluids.EntitySystems;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When a <see cref="SmokeComponent"/> despawns this will spawn another entity in its place.
|
|
||||||
/// </summary>
|
|
||||||
[RegisterComponent, Access(typeof(SmokeSystem))]
|
|
||||||
public sealed partial class SmokeDissipateSpawnComponent : Component
|
|
||||||
{
|
|
||||||
[DataField("prototype", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
||||||
public string Prototype = string.Empty;
|
|
||||||
}
|
|
||||||
@@ -38,17 +38,6 @@ public sealed class SmokeSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<SmokeComponent, EntityUnpausedEvent>(OnSmokeUnpaused);
|
SubscribeLocalEvent<SmokeComponent, EntityUnpausedEvent>(OnSmokeUnpaused);
|
||||||
SubscribeLocalEvent<SmokeComponent, ReactionAttemptEvent>(OnReactionAttempt);
|
SubscribeLocalEvent<SmokeComponent, ReactionAttemptEvent>(OnReactionAttempt);
|
||||||
SubscribeLocalEvent<SmokeComponent, SpreadNeighborsEvent>(OnSmokeSpread);
|
SubscribeLocalEvent<SmokeComponent, SpreadNeighborsEvent>(OnSmokeSpread);
|
||||||
SubscribeLocalEvent<SmokeDissipateSpawnComponent, TimedDespawnEvent>(OnSmokeDissipate);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSmokeDissipate(EntityUid uid, SmokeDissipateSpawnComponent component, ref TimedDespawnEvent args)
|
|
||||||
{
|
|
||||||
if (!TryComp<TransformComponent>(uid, out var xform))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Spawn(component.Prototype, xform.Coordinates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSmokeSpread(EntityUid uid, SmokeComponent component, ref SpreadNeighborsEvent args)
|
private void OnSmokeSpread(EntityUid uid, SmokeComponent component, ref SpreadNeighborsEvent args)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Content.Server.Spawners.EntitySystems;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Server.Spawners.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When a <c>TimedDespawnComponent"</c> despawns, another one will be spawned in its place.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, Access(typeof(SpawnOnDespawnSystem))]
|
||||||
|
public sealed partial class SpawnOnDespawnComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Entity prototype to spawn.
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true)]
|
||||||
|
public EntProtoId Prototype = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Content.Server.Spawners.Components;
|
||||||
|
using Robust.Shared.Spawners;
|
||||||
|
|
||||||
|
namespace Content.Server.Spawners.EntitySystems;
|
||||||
|
|
||||||
|
public sealed class SpawnOnDespawnSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<SpawnOnDespawnComponent, TimedDespawnEvent>(OnDespawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDespawn(EntityUid uid, SpawnOnDespawnComponent comp, ref TimedDespawnEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<TransformComponent>(uid, out var xform))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Spawn(comp.Prototype, xform.Coordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
animationTime: 0.6
|
animationTime: 0.6
|
||||||
animationState: mfoam-dissolve
|
animationState: mfoam-dissolve
|
||||||
- type: Smoke
|
- type: Smoke
|
||||||
- type: SmokeDissipateSpawn
|
- type: SpawnOnDespawn
|
||||||
prototype: FoamedIronMetal
|
prototype: FoamedIronMetal
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
animationTime: 0.6
|
animationTime: 0.6
|
||||||
animationState: mfoam-dissolve
|
animationState: mfoam-dissolve
|
||||||
- type: Smoke
|
- type: Smoke
|
||||||
- type: SmokeDissipateSpawn
|
- type: SpawnOnDespawn
|
||||||
prototype: FoamedAluminiumMetal
|
prototype: FoamedAluminiumMetal
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user