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,18 +1,10 @@
using System.Linq;
using Content.Server.Chat.Systems;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Server.Wires;
using Content.Shared.Interaction;
using Content.Shared.Speech;
using Content.Shared.SurveillanceCamera;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server.SurveillanceCamera;
@@ -42,21 +34,22 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
public override void Update(float frameTime)
{
foreach (var (_, monitor) in EntityQuery<ActiveSurveillanceCameraMonitorComponent, SurveillanceCameraMonitorComponent>())
var query = EntityQueryEnumerator<ActiveSurveillanceCameraMonitorComponent, SurveillanceCameraMonitorComponent>();
while (query.MoveNext(out var uid, out _, out var monitor))
{
if (Paused(monitor.Owner))
if (Paused(uid))
{
continue;
}
monitor.LastHeartbeatSent += frameTime;
SendHeartbeat(monitor.Owner, monitor);
SendHeartbeat(uid, monitor);
monitor.LastHeartbeat += frameTime;
if (monitor.LastHeartbeat > _maxHeartbeatTime)
{
DisconnectCamera(monitor.Owner, true, monitor);
EntityManager.RemoveComponent<ActiveSurveillanceCameraMonitorComponent>(monitor.Owner);
DisconnectCamera(uid, true, monitor);
EntityManager.RemoveComponent<ActiveSurveillanceCameraMonitorComponent>(uid);
}
}
}