forked from cosmatic-drift-14/cosmatic-drift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename SmokeDissipateSpawnComponent to SpawnOnDespawnComponent (#20782)
- Loading branch information
1 parent
d466747
commit e911c9e
Showing
5 changed files
with
42 additions
and
29 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
Content.Server/Chemistry/Components/SmokeDissipateSpawnComponent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Content.Server/Spawners/Components/SpawnOnDespawnComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
22 changes: 22 additions & 0 deletions
22
Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters