]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Rename SmokeDissipateSpawnComponent to SpawnOnDespawnComponent (#20782)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Wed, 11 Oct 2023 06:34:51 +0000 (07:34 +0100)
committerGitHub <noreply@github.com>
Wed, 11 Oct 2023 06:34:51 +0000 (22:34 -0800)
Content.Server/Chemistry/Components/SmokeDissipateSpawnComponent.cs [deleted file]
Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Content.Server/Spawners/Components/SpawnOnDespawnComponent.cs [new file with mode: 0644]
Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Effects/chemistry_effects.yml

diff --git a/Content.Server/Chemistry/Components/SmokeDissipateSpawnComponent.cs b/Content.Server/Chemistry/Components/SmokeDissipateSpawnComponent.cs
deleted file mode 100644 (file)
index 068ac43..0000000
+++ /dev/null
@@ -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;
-}
index b3590fec40206ac86c8e344c51556e336063f42e..2f62f54fd160220930f340af97a6f1417763ade9 100644 (file)
@@ -38,17 +38,6 @@ public sealed class SmokeSystem : EntitySystem
         SubscribeLocalEvent<SmokeComponent, EntityUnpausedEvent>(OnSmokeUnpaused);
         SubscribeLocalEvent<SmokeComponent, ReactionAttemptEvent>(OnReactionAttempt);
         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)
diff --git a/Content.Server/Spawners/Components/SpawnOnDespawnComponent.cs b/Content.Server/Spawners/Components/SpawnOnDespawnComponent.cs
new file mode 100644 (file)
index 0000000..24b57a4
--- /dev/null
@@ -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;
+}
diff --git a/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs b/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs
new file mode 100644 (file)
index 0000000..77927c9
--- /dev/null
@@ -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);
+    }
+}
index 10e2f1f7db759cdc44ce2eb6545e47a0b7ce1b86..415ecd4a9865c4d0c79a5c09fe4fe68af9c33c99 100644 (file)
@@ -89,7 +89,7 @@
     animationTime: 0.6
     animationState: mfoam-dissolve
   - type: Smoke
-  - type: SmokeDissipateSpawn
+  - type: SpawnOnDespawn
     prototype: FoamedIronMetal
 
 - type: entity
     animationTime: 0.6
     animationState: mfoam-dissolve
   - type: Smoke
-  - type: SmokeDissipateSpawn
+  - type: SpawnOnDespawn
     prototype: FoamedAluminiumMetal
 
 - type: entity