]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Un-network TimedDespawnComponent (#20280)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 17 Sep 2023 07:18:52 +0000 (19:18 +1200)
committerGitHub <noreply@github.com>
Sun, 17 Sep 2023 07:18:52 +0000 (17:18 +1000)
Content.Shared/Spawners/Components/TimedDespawnComponent.cs
Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs

index 209e371c4695c1bd6a92d695f14678793b454388..c66d4810ad42d537a72e8d0a4bbb9e730f75d0d3 100644 (file)
@@ -5,7 +5,7 @@ namespace Content.Shared.Spawners.Components;
 /// <summary>
 /// Put this component on something you would like to despawn after a certain amount of time
 /// </summary>
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent]
 public sealed partial class TimedDespawnComponent : Component
 {
     /// <summary>
index bc9c41b93e06183b4fe1e794505e21772d815996..b867737cb69f2b31da3166ebd042c24deb9ee630 100644 (file)
@@ -13,30 +13,14 @@ public abstract class SharedTimedDespawnSystem : EntitySystem
     {
         base.Initialize();
         UpdatesOutsidePrediction = true;
-        SubscribeLocalEvent<TimedDespawnComponent, ComponentGetState>(OnDespawnGetState);
-        SubscribeLocalEvent<TimedDespawnComponent, ComponentHandleState>(OnDespawnHandleState);
-    }
-
-    private void OnDespawnGetState(EntityUid uid, TimedDespawnComponent component, ref ComponentGetState args)
-    {
-        args.State = new TimedDespawnComponentState()
-        {
-            Lifetime = component.Lifetime,
-        };
-    }
-
-    private void OnDespawnHandleState(EntityUid uid, TimedDespawnComponent component, ref ComponentHandleState args)
-    {
-        if (args.Current is not TimedDespawnComponentState state)
-            return;
-
-        component.Lifetime = state.Lifetime;
     }
 
     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;
 
@@ -59,10 +43,4 @@ public abstract class SharedTimedDespawnSystem : EntitySystem
     }
 
     protected abstract bool CanDelete(EntityUid uid);
-
-    [Serializable, NetSerializable]
-    private sealed class TimedDespawnComponentState : ComponentState
-    {
-        public float Lifetime;
-    }
 }