Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -10,14 +10,15 @@ public sealed partial class NPCPerceptionSystem
|
||||
/// <param name="frameTime"></param>
|
||||
private void UpdateRecentlyInjected(float frameTime)
|
||||
{
|
||||
foreach (var entity in EntityQuery<NPCRecentlyInjectedComponent>())
|
||||
var query = EntityQueryEnumerator<NPCRecentlyInjectedComponent>();
|
||||
while (query.MoveNext(out var uid, out var entity))
|
||||
{
|
||||
entity.Accumulator += frameTime;
|
||||
if (entity.Accumulator < entity.RemoveTime.TotalSeconds)
|
||||
continue;
|
||||
entity.Accumulator = 0;
|
||||
|
||||
RemComp<NPCRecentlyInjectedComponent>(entity.Owner);
|
||||
RemComp<NPCRecentlyInjectedComponent>(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
var compZero = comps[0];
|
||||
comps.RemoveAt(0);
|
||||
|
||||
foreach (var comp in _lookup.GetComponentsInRange(compZero.Component.GetType(), mapPos, vision))
|
||||
foreach (var comp in _lookup.GetEntitiesInRange(compZero.Component.GetType(), mapPos, vision))
|
||||
{
|
||||
var ent = comp.Owner;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.NPC.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using Content.Server.NPC.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.NPC.Systems;
|
||||
|
||||
@@ -160,15 +160,15 @@ public sealed partial class NpcFactionSystem : EntitySystem
|
||||
if (!xformQuery.TryGetComponent(entity, out var entityXform))
|
||||
yield break;
|
||||
|
||||
foreach (var comp in _lookup.GetComponentsInRange<NpcFactionMemberComponent>(entityXform.MapPosition, range))
|
||||
foreach (var ent in _lookup.GetEntitiesInRange<NpcFactionMemberComponent>(entityXform.MapPosition, range))
|
||||
{
|
||||
if (comp.Owner == entity)
|
||||
if (ent.Owner == entity)
|
||||
continue;
|
||||
|
||||
if (!factions.Overlaps(comp.Factions))
|
||||
if (!factions.Overlaps(ent.Comp.Factions))
|
||||
continue;
|
||||
|
||||
yield return comp.Owner;
|
||||
yield return ent.Owner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user