]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move TimedDespawn to engine (#20515)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 30 Sep 2023 04:35:32 +0000 (14:35 +1000)
committerGitHub <noreply@github.com>
Sat, 30 Sep 2023 04:35:32 +0000 (14:35 +1000)
21 files changed:
Content.Client/Animations/ReusableAnimations.cs
Content.Client/Chemistry/Visualizers/FoamVisualizerSystem.cs
Content.Client/Content.Client.csproj
Content.Client/Projectiles/ProjectileSystem.cs
Content.Client/Salvage/FultonSystem.cs
Content.Client/Spawners/TimedDespawnSystem.cs [deleted file]
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.Server/Chemistry/EntitySystems/VaporSystem.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs
Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Content.Server/Magic/MagicSystem.cs
Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Content.Server/Spawners/EntitySystems/SpawnerSystem.cs
Content.Server/Spawners/EntitySystems/TimedDespawnSystem.cs [deleted file]
Content.Server/StationEvents/Events/ImmovableRodRule.cs
Content.Server/StationEvents/Events/MeteorSwarmRule.cs
Content.Shared/Radiation/Components/RadiationPulseComponent.cs
Content.Shared/Radiation/Systems/RadiationPulseSystem.cs
Content.Shared/Spawners/Components/TimedDespawnComponent.cs [deleted file]
Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs [deleted file]
Content.Shared/Spawners/TimedDespawnEvent.cs [deleted file]

index 3803af1de92cec311a55c06c6e45d25edb30fa6e..33e3eb25b4e052c55744e41578e5c5fe27b84f2e 100644 (file)
@@ -1,9 +1,10 @@
 using System.Numerics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 using Robust.Shared.Animations;
 using Robust.Shared.Map;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Client.Animations
 {
index 5cef1db805c833bcf9ce41d71d9c5657f9aebb65..ec582ee0944a8ce157281f0e972e4ab244410073 100644 (file)
@@ -1,5 +1,5 @@
 using Content.Shared.Smoking;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 using Robust.Shared.Network;
index 257999b8c139a27c854e29273391828cfce8f8be..33ee0e0a34dec6a6e2b37b8748fe90d7617ea7e7 100644 (file)
@@ -23,6 +23,9 @@
     <ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
     <ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Spawners\" />
+  </ItemGroup>
   <Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
   <Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
 </Project>
index 07da813045faf177f7881c2660a599385e4d5175..2132256b1bd47263dd5549da8048402958b34e71 100644 (file)
@@ -1,9 +1,10 @@
 using Content.Shared.Projectiles;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Weapons.Ranged.Systems;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 using Robust.Shared.GameStates;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Client.Projectiles;
 
index 05e7dd12d98a937e07ac8238e2de0fc2fa042880..7e31fbb1808b666d95ba9da6ec0154420fccae90 100644 (file)
@@ -1,6 +1,6 @@
 using System.Numerics;
 using Content.Shared.Salvage.Fulton;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using JetBrains.Annotations;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
@@ -8,6 +8,7 @@ using Robust.Client.Graphics;
 using Robust.Shared.Animations;
 using Robust.Shared.Serialization.Manager;
 using Robust.Shared.Utility;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Client.Salvage;
 
diff --git a/Content.Client/Spawners/TimedDespawnSystem.cs b/Content.Client/Spawners/TimedDespawnSystem.cs
deleted file mode 100644 (file)
index 14e34dc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-using Content.Shared.Spawners.EntitySystems;
-
-namespace Content.Client.Spawners;
-
-public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
-{
-    protected override bool CanDelete(EntityUid uid)
-    {
-        return IsClientSide(uid);
-    }
-}
index 84284c9a506f41004078923878d23230bba4e922..72f0c2130bd23dad624f4d87654e7e89d7ea465b 100644 (file)
@@ -3,7 +3,7 @@ using Content.Client.Items;
 using Content.Client.Weapons.Ranged.Components;
 using Content.Shared.Camera;
 using Content.Shared.CombatMode;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Weapons.Ranged;
 using Content.Shared.Weapons.Ranged.Components;
 using Content.Shared.Weapons.Ranged.Events;
@@ -19,6 +19,7 @@ using Robust.Shared.Map;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 using SharedGunSystem = Content.Shared.Weapons.Ranged.Systems.SharedGunSystem;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Client.Weapons.Ranged.Systems;
 
index 8cff8a19cb6b1b7d1d08f6f710b1061dad34d4b1..d95490e9a01ae36a8b6bfcef5b2e07f5e47750d2 100644 (file)
@@ -6,7 +6,7 @@ using Content.Shared.Chemistry.Components;
 using Content.Shared.Chemistry.Reagent;
 using Content.Shared.FixedPoint;
 using Content.Shared.Physics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Throwing;
 using JetBrains.Annotations;
 using Robust.Shared.Map;
@@ -15,6 +15,7 @@ using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Physics.Systems;
 using Robust.Shared.Prototypes;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.Chemistry.EntitySystems
 {
index 1938831f7e1ac69fe50ef65e7bfd995c7280ee08..cce7050e3f436a994328b2bfe6aaf850ad8fdcf9 100644 (file)
@@ -9,7 +9,7 @@ using Content.Shared.Maps;
 using Content.Shared.Mind.Components;
 using Content.Shared.Physics;
 using Content.Shared.Projectiles;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Tag;
 using Robust.Shared.Map;
 using Robust.Shared.Map.Components;
@@ -18,6 +18,7 @@ using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Dynamics;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.Explosion.EntitySystems;
 
index ee0d16a7a2d5ca7e5b705c9b0a9d82e33317ef42..a192b39e560cd7855c8a460522ccff7f4e096531 100644 (file)
@@ -14,12 +14,13 @@ using Content.Shared.Coordinates.Helpers;
 using Content.Shared.Database;
 using Content.Shared.FixedPoint;
 using Content.Shared.Smoking;
-using Content.Shared.Spawners;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Spawners;
 using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.Fluids.EntitySystems;
 
index 5b990412d8a45192124fe3eee6923adfbda57e26..9cca5fa32cc2c4c9cdae4e91b33e4344ae6809de 100644 (file)
@@ -16,7 +16,7 @@ using Content.Shared.Magic;
 using Content.Shared.Magic.Events;
 using Content.Shared.Maps;
 using Content.Shared.Physics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Storage;
 using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
index 7bbe6ed1081c61eb123ab35f38d52dce3113cd20..19779c5cfeed838178620f86112930c325138968 100644 (file)
@@ -13,7 +13,7 @@ using Content.Shared.CCVar;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Movement.Components;
 using Content.Shared.Shuttles.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Content.Shared.Tiles;
 using Robust.Server.GameObjects;
 using Robust.Shared.Collections;
@@ -22,6 +22,7 @@ using Robust.Shared.Console;
 using Robust.Shared.Map;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.Shuttles.Systems;
 
index 1d0e4c397cfa9c1caddcfe3cef52d5ea33536a8d..c6e34c184847a73950e135e0b18ee752f8613d72 100644 (file)
@@ -12,6 +12,7 @@ public sealed class SpawnerSystem : EntitySystem
     {
         base.Initialize();
         SubscribeLocalEvent<TimedSpawnerComponent, ComponentInit>(OnSpawnerInit);
+        SubscribeLocalEvent<TimedSpawnerComponent, ComponentShutdown>(OnTimedSpawnerShutdown);
     }
 
     private void OnSpawnerInit(EntityUid uid, TimedSpawnerComponent component, ComponentInit args)
@@ -35,4 +36,9 @@ public sealed class SpawnerSystem : EntitySystem
             Spawn(entity, coordinates);
         }
     }
+
+    private void OnTimedSpawnerShutdown(EntityUid uid, TimedSpawnerComponent component, ComponentShutdown args)
+    {
+        component.TokenSource?.Cancel();
+    }
 }
diff --git a/Content.Server/Spawners/EntitySystems/TimedDespawnSystem.cs b/Content.Server/Spawners/EntitySystems/TimedDespawnSystem.cs
deleted file mode 100644 (file)
index cadad46..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-using Content.Server.Spawners.Components;
-using Content.Shared.Spawners.EntitySystems;
-
-namespace Content.Server.Spawners.EntitySystems;
-
-public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
-{
-    public override void Initialize()
-    {
-        base.Initialize();
-        SubscribeLocalEvent<TimedSpawnerComponent, ComponentShutdown>(OnTimedSpawnerShutdown);
-    }
-
-    private void OnTimedSpawnerShutdown(EntityUid uid, TimedSpawnerComponent component, ComponentShutdown args)
-    {
-        component.TokenSource?.Cancel();
-    }
-
-    protected override bool CanDelete(EntityUid uid)
-    {
-        return true;
-    }
-}
index b92ac917bc915bf578c529aa68b63d70c538abf7..a61c6b69e1a592ce27402910097e9cf2e1334260 100644 (file)
@@ -3,8 +3,9 @@ using Content.Server.GameTicking.Rules.Components;
 using Content.Server.ImmovableRod;
 using Content.Server.StationEvents.Components;
 using Content.Server.Weapons.Ranged.Systems;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Shared.Prototypes;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.StationEvents.Events;
 
index b5408ac982f65edaf3cea2a0555357414397e89b..5192eef69b1bb543d97fc44558bded48ea38ce5c 100644 (file)
@@ -1,10 +1,11 @@
 using System.Numerics;
 using Content.Server.GameTicking.Rules.Components;
 using Content.Server.StationEvents.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Systems;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
 
 namespace Content.Server.StationEvents.Events
 {
index a1cfa566bcfa3a6ed1a8d9ca68414af16b7dcb51..a11e8e3ee0e5a672633a12026537424eabfb91d5 100644 (file)
@@ -1,5 +1,4 @@
 using Content.Shared.Radiation.Systems;
-using Content.Shared.Spawners.Components;
 
 namespace Content.Shared.Radiation.Components;
 
@@ -18,7 +17,7 @@ public sealed partial class RadiationPulseComponent : Component
 
     /// <summary>
     ///     How long will animation play in seconds.
-    ///     Can be overridden by <see cref="TimedDespawnComponent"/>.
+    ///     Can be overridden by <see cref="Robust.Shared.Spawners.TimedDespawnComponent"/>.
     /// </summary>
     public float VisualDuration = 2f;
 
index 7991f331eefe43e05058ab11fe7403f6536705d3..9f280330257dbb02ac1fd6578998974737dc04e6 100644 (file)
@@ -1,5 +1,5 @@
 using Content.Shared.Radiation.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
 using Robust.Shared.Timing;
 
 namespace Content.Shared.Radiation.Systems;
@@ -25,7 +25,7 @@ public sealed class RadiationPulseSystem : EntitySystem
         }
         // try to get radiation range or keep default visual range
         if (TryComp<RadiationSourceComponent>(uid, out var radSource))
-        { 
+        {
             component.VisualRange = radSource.Intensity / radSource.Slope;
         }
     }
diff --git a/Content.Shared/Spawners/Components/TimedDespawnComponent.cs b/Content.Shared/Spawners/Components/TimedDespawnComponent.cs
deleted file mode 100644 (file)
index c66d481..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using Robust.Shared.GameStates;
-
-namespace Content.Shared.Spawners.Components;
-
-/// <summary>
-/// Put this component on something you would like to despawn after a certain amount of time
-/// </summary>
-[RegisterComponent]
-public sealed partial class TimedDespawnComponent : Component
-{
-    /// <summary>
-    /// How long the entity will exist before despawning
-    /// </summary>
-    [DataField("lifetime")]
-    public float Lifetime = 5f;
-}
diff --git a/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs b/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs
deleted file mode 100644 (file)
index b867737..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-using Content.Shared.Spawners.Components;
-using Robust.Shared.GameStates;
-using Robust.Shared.Serialization;
-using Robust.Shared.Timing;
-
-namespace Content.Shared.Spawners.EntitySystems;
-
-public abstract class SharedTimedDespawnSystem : EntitySystem
-{
-    [Dependency] private readonly IGameTiming _timing = default!;
-
-    public override void Initialize()
-    {
-        base.Initialize();
-        UpdatesOutsidePrediction = true;
-    }
-
-    public override void Update(float frameTime)
-    {
-        base.Update(frameTime);
-
-        // AAAAAAAAAAAAAAAAAAAAAAAAAAA
-        // Client both needs to predict this, but also can't properly handle prediction resetting.
-        if (!_timing.IsFirstTimePredicted)
-            return;
-
-        var query = EntityQueryEnumerator<TimedDespawnComponent>();
-
-        while (query.MoveNext(out var uid, out var comp))
-        {
-            comp.Lifetime -= frameTime;
-
-            if (!CanDelete(uid))
-                continue;
-
-            if (comp.Lifetime <= 0)
-            {
-                var ev = new TimedDespawnEvent();
-                RaiseLocalEvent(uid, ref ev);
-                QueueDel(uid);
-            }
-        }
-    }
-
-    protected abstract bool CanDelete(EntityUid uid);
-}
diff --git a/Content.Shared/Spawners/TimedDespawnEvent.cs b/Content.Shared/Spawners/TimedDespawnEvent.cs
deleted file mode 100644 (file)
index 26551d8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Content.Shared.Spawners;
-
-/// <summary>
-/// Raised directed on an entity when its timed despawn is over.
-/// </summary>
-[ByRefEvent]
-public readonly record struct TimedDespawnEvent;