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

@@ -60,11 +60,11 @@ public sealed class StepTriggerComponentState : ComponentState
{
public float IntersectRatio { get; }
public float RequiredTriggerSpeed { get; }
public readonly HashSet<EntityUid> CurrentlySteppedOn;
public readonly HashSet<EntityUid> Colliding;
public readonly HashSet<NetEntity> CurrentlySteppedOn;
public readonly HashSet<NetEntity> Colliding;
public readonly bool Active;
public StepTriggerComponentState(float intersectRatio, HashSet<EntityUid> currentlySteppedOn, HashSet<EntityUid> colliding, float requiredTriggerSpeed, bool active)
public StepTriggerComponentState(float intersectRatio, HashSet<NetEntity> currentlySteppedOn, HashSet<NetEntity> colliding, float requiredTriggerSpeed, bool active)
{
IntersectRatio = intersectRatio;
CurrentlySteppedOn = currentlySteppedOn;

View File

@@ -171,18 +171,14 @@ public sealed class StepTriggerSystem : EntitySystem
component.RequiredTriggerSpeed = state.RequiredTriggerSpeed;
component.IntersectRatio = state.IntersectRatio;
component.Active = state.Active;
var stepped = EnsureEntitySet<StepTriggerComponent>(state.CurrentlySteppedOn, uid);
var colliding = EnsureEntitySet<StepTriggerComponent>(state.CurrentlySteppedOn, uid);
if (!component.CurrentlySteppedOn.SetEquals(state.CurrentlySteppedOn))
{
component.CurrentlySteppedOn.Clear();
component.CurrentlySteppedOn.UnionWith(state.CurrentlySteppedOn);
}
component.CurrentlySteppedOn.Clear();
component.CurrentlySteppedOn.UnionWith(stepped);
if (!component.Colliding.SetEquals(state.Colliding))
{
component.Colliding.Clear();
component.Colliding.UnionWith(state.Colliding);
}
component.Colliding.Clear();
component.Colliding.UnionWith(colliding);
if (component.Colliding.Count > 0)
{
@@ -194,12 +190,12 @@ public sealed class StepTriggerSystem : EntitySystem
}
}
private static void TriggerGetState(EntityUid uid, StepTriggerComponent component, ref ComponentGetState args)
private void TriggerGetState(EntityUid uid, StepTriggerComponent component, ref ComponentGetState args)
{
args.State = new StepTriggerComponentState(
component.IntersectRatio,
component.CurrentlySteppedOn,
component.Colliding,
GetNetEntitySet(component.CurrentlySteppedOn),
GetNetEntitySet(component.Colliding),
component.RequiredTriggerSpeed,
component.Active);
}