Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -78,7 +78,7 @@ public sealed partial class BuckleComponent : Component
[Serializable, NetSerializable]
public sealed class BuckleComponentState : ComponentState
{
public BuckleComponentState(bool buckled, EntityUid? buckledTo, EntityUid? lastEntityBuckledTo,
public BuckleComponentState(bool buckled, NetEntity? buckledTo, NetEntity? lastEntityBuckledTo,
bool dontCollide)
{
Buckled = buckled;
@@ -88,8 +88,8 @@ public sealed class BuckleComponentState : ComponentState
}
public readonly bool Buckled;
public readonly EntityUid? BuckledTo;
public readonly EntityUid? LastEntityBuckledTo;
public readonly NetEntity? BuckledTo;
public readonly NetEntity? LastEntityBuckledTo;
public readonly bool DontCollide;
}

View File

@@ -125,10 +125,10 @@ public sealed class StrapComponentState : ComponentState
public readonly StrapPosition Position;
public readonly float MaxBuckleDistance;
public readonly Vector2 BuckleOffsetClamped;
public readonly HashSet<EntityUid> BuckledEntities;
public readonly HashSet<NetEntity> BuckledEntities;
public readonly int OccupiedSize;
public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<EntityUid> buckled,
public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<NetEntity> buckled,
float maxBuckleDistance, int occupiedSize)
{
Position = position;

View File

@@ -59,7 +59,7 @@ public abstract partial class SharedBuckleSystem
private void OnBuckleComponentGetState(EntityUid uid, BuckleComponent component, ref ComponentGetState args)
{
args.State = new BuckleComponentState(component.Buckled, component.BuckledTo, component.LastEntityBuckledTo, component.DontCollide);
args.State = new BuckleComponentState(component.Buckled, GetNetEntity(component.BuckledTo), GetNetEntity(component.LastEntityBuckledTo), component.DontCollide);
}
private void OnBuckleMove(EntityUid uid, BuckleComponent component, ref MoveEvent ev)

View File

@@ -52,7 +52,7 @@ public abstract partial class SharedBuckleSystem
private void OnStrapGetState(EntityUid uid, StrapComponent component, ref ComponentGetState args)
{
args.State = new StrapComponentState(component.Position, component.BuckleOffset, component.BuckledEntities, component.MaxBuckleDistance, component.OccupiedSize);
args.State = new StrapComponentState(component.Position, component.BuckleOffset, GetNetEntitySet(component.BuckledEntities), component.MaxBuckleDistance, component.OccupiedSize);
}
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
@@ -63,7 +63,7 @@ public abstract partial class SharedBuckleSystem
component.Position = state.Position;
component.BuckleOffsetUnclamped = state.BuckleOffsetClamped;
component.BuckledEntities.Clear();
component.BuckledEntities.UnionWith(state.BuckledEntities);
component.BuckledEntities.UnionWith(EnsureEntitySet<StrapComponent>(state.BuckledEntities, uid));
component.MaxBuckleDistance = state.MaxBuckleDistance;
component.OccupiedSize = state.OccupiedSize;
}