Un-network TimedDespawnComponent (#20280)
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Content.Shared.Spawners.Components;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Put this component on something you would like to despawn after a certain amount of time
|
/// Put this component on something you would like to despawn after a certain amount of time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class TimedDespawnComponent : Component
|
public sealed partial class TimedDespawnComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -13,30 +13,14 @@ public abstract class SharedTimedDespawnSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
UpdatesOutsidePrediction = true;
|
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)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|
||||||
|
// AAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
// Client both needs to predict this, but also can't properly handle prediction resetting.
|
||||||
if (!_timing.IsFirstTimePredicted)
|
if (!_timing.IsFirstTimePredicted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -59,10 +43,4 @@ public abstract class SharedTimedDespawnSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract bool CanDelete(EntityUid uid);
|
protected abstract bool CanDelete(EntityUid uid);
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
private sealed class TimedDespawnComponentState : ComponentState
|
|
||||||
{
|
|
||||||
public float Lifetime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user