From 3be88f46803fabad09df94aa59509be0e44ab77d Mon Sep 17 00:00:00 2001
From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Date: Sun, 17 Sep 2023 19:18:52 +1200
Subject: [PATCH] Un-network TimedDespawnComponent (#20280)
---
.../Components/TimedDespawnComponent.cs | 2 +-
.../EntitySystems/SharedTimedDespawnSystem.cs | 26 ++-----------------
2 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/Content.Shared/Spawners/Components/TimedDespawnComponent.cs b/Content.Shared/Spawners/Components/TimedDespawnComponent.cs
index 209e371c46..c66d4810ad 100644
--- a/Content.Shared/Spawners/Components/TimedDespawnComponent.cs
+++ b/Content.Shared/Spawners/Components/TimedDespawnComponent.cs
@@ -5,7 +5,7 @@ namespace Content.Shared.Spawners.Components;
///
/// Put this component on something you would like to despawn after a certain amount of time
///
-[RegisterComponent, NetworkedComponent]
+[RegisterComponent]
public sealed partial class TimedDespawnComponent : Component
{
///
diff --git a/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs b/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs
index bc9c41b93e..b867737cb6 100644
--- a/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs
+++ b/Content.Shared/Spawners/EntitySystems/SharedTimedDespawnSystem.cs
@@ -13,30 +13,14 @@ public abstract class SharedTimedDespawnSystem : EntitySystem
{
base.Initialize();
UpdatesOutsidePrediction = true;
- SubscribeLocalEvent(OnDespawnGetState);
- SubscribeLocalEvent(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;
- }
}
--
2.51.2