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

@@ -19,12 +19,14 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
private void OnBoxEffect(PlayBoxEffectMessage msg)
{
if (!TryComp<CardboardBoxComponent>(msg.Source, out var box))
var source = GetEntity(msg.Source);
if (!TryComp<CardboardBoxComponent>(source, out var box))
return;
var xformQuery = GetEntityQuery<TransformComponent>();
if (!xformQuery.TryGetComponent(msg.Source, out var xform))
if (!xformQuery.TryGetComponent(source, out var xform))
return;
var sourcePos = xform.MapPosition;
@@ -32,12 +34,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
//Any mob that can move should be surprised?
//God mind rework needs to come faster so it can just check for mind
//TODO: Replace with Mind Query when mind rework is in.
var mobMoverEntities = new HashSet<EntityUid>();
var mobMoverEntities = new List<EntityUid>();
var mover = GetEntity(msg.Mover);
//Filter out entities in range to see that they're a mob and add them to the mobMoverEntities hash for faster lookup
foreach (var moverComp in _entityLookup.GetComponentsInRange<MobMoverComponent>(xform.Coordinates, box.Distance))
{
if (moverComp.Owner == msg.Mover)
if (moverComp.Owner == mover)
continue;
mobMoverEntities.Add(moverComp.Owner);
@@ -57,5 +60,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
sprite.Offset = new Vector2(0, 1);
entTransform.AttachParent(mob);
}
}
}