Un-network TimedDespawnComponent (#20280)

This commit is contained in:
Leon Friedrich
2023-09-17 19:18:52 +12:00
committed by GitHub
parent 93ccd1b77d
commit 3be88f4680
2 changed files with 3 additions and 25 deletions

View 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;
}
}