Remove 700 usages of Component.Owner (#21100)

This commit is contained in:
DrSmugleaf
2023-10-19 12:34:31 -07:00
committed by GitHub
parent 5825ffb95c
commit f560f88eb5
261 changed files with 2291 additions and 2036 deletions

View File

@@ -166,7 +166,7 @@ namespace Content.Server.Pointing.EntitySystems
{
var arrowVisibility = EntityManager.EnsureComponent<VisibilityComponent>(arrow);
layer = playerVisibility.Layer;
_visibilitySystem.SetLayer(arrowVisibility, layer);
_visibilitySystem.SetLayer(arrow, arrowVisibility, layer);
}
// Get players that are in range and whose visibility layer matches the arrow's.
@@ -274,26 +274,28 @@ namespace Content.Server.Pointing.EntitySystems
{
var currentTime = _gameTiming.CurTime;
foreach (var component in EntityQuery<PointingArrowComponent>(true))
var query = AllEntityQuery<PointingArrowComponent>();
while (query.MoveNext(out var uid, out var component))
{
Update(component, currentTime);
Update((uid, component), currentTime);
}
}
private void Update(PointingArrowComponent component, TimeSpan currentTime)
private void Update(Entity<PointingArrowComponent> pointing, TimeSpan currentTime)
{
// TODO: That pause PR
var component = pointing.Comp;
if (component.EndTime > currentTime)
return;
if (component.Rogue)
{
RemComp<PointingArrowComponent>(component.Owner);
EnsureComp<RoguePointingArrowComponent>(component.Owner);
RemComp<PointingArrowComponent>(pointing);
EnsureComp<RoguePointingArrowComponent>(pointing);
return;
}
Del(component.Owner);
Del(pointing);
}
}
}