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

@@ -1,13 +1,12 @@
using Content.Server.Physics.Components;
using Content.Shared.Follower.Components;
using Content.Shared.Throwing;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Controllers;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Content.Server.Physics.Components;
using Content.Shared.Follower.Components;
using Content.Shared.Throwing;
namespace Content.Server.Physics.Controllers;
/// <summary>
@@ -39,16 +38,17 @@ internal sealed class RandomWalkController : VirtualController
{
base.UpdateBeforeSolve(prediction, frameTime);
foreach(var (randomWalk, physics) in EntityManager.EntityQuery<RandomWalkComponent, PhysicsComponent>())
var query = EntityQueryEnumerator<RandomWalkComponent, PhysicsComponent>();
while (query.MoveNext(out var uid, out var randomWalk, out var physics))
{
if (EntityManager.HasComponent<ActorComponent>(randomWalk.Owner)
|| EntityManager.HasComponent<ThrownItemComponent>(randomWalk.Owner)
|| EntityManager.HasComponent<FollowerComponent>(randomWalk.Owner))
if (EntityManager.HasComponent<ActorComponent>(uid)
|| EntityManager.HasComponent<ThrownItemComponent>(uid)
|| EntityManager.HasComponent<FollowerComponent>(uid))
continue;
var curTime = _timing.CurTime;
if (randomWalk.NextStepTime <= curTime)
Update(randomWalk.Owner, randomWalk, physics);
Update(uid, randomWalk, physics);
}
}
@@ -65,7 +65,7 @@ internal sealed class RandomWalkController : VirtualController
var curTime = _timing.CurTime;
randomWalk.NextStepTime = curTime + TimeSpan.FromSeconds(_random.NextDouble(randomWalk.MinStepCooldown.TotalSeconds, randomWalk.MaxStepCooldown.TotalSeconds));
if(!Resolve(randomWalk.Owner, ref physics))
if(!Resolve(uid, ref physics))
return;
var pushAngle = _random.NextAngle();