CatStation/Content.Shared/Decals/DecalChunkComponent.cs
metalgearsloth bd31e36f7b
Fix decal prediction (#45210)
* Fix decal prediction

Tried to do it the clever way in after state handler but didn't reset properly so we do it the stupid way.

* a

* also these fixes
2026-08-09 03:54:27 +00:00

34 lines
1.2 KiB
C#

using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
namespace Content.Shared.Decals;
/// <summary>
/// Networked decal data attached to a chunk entity.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(raiseAfterAutoHandleState: true, fieldDeltas: true)]
public sealed partial class DecalChunkComponent : Component
{
public const ushort PredictedDecalCount = 256;
public const ushort MaxServerDecalId = ushort.MaxValue - PredictedDecalCount;
public const ushort MinPredictedDecalId = MaxServerDecalId + 1;
/// <summary>
/// Client predicts entities from top of the chunk index down while server goes bottom-up.
/// This way we can minimize chances of overlap and be non-destructive to server states.
/// </summary>
public ushort NextPredictedDecal = ushort.MaxValue;
[AutoNetworkedField]
[DataField(customTypeSerializer: typeof(DecalChunkDecalsSerializer))]
public Dictionary<ushort, Decal> Decals = new();
/// <summary>
/// Highest authoritative decal ID allocated in this chunk.
/// </summary>
[DataField]
public ushort MaxDecalId;
public List<ushort> FreeDecalIds = new();
}