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,6 +1,5 @@
using Content.Server.Popups;
using Content.Server.Tabletop.Components;
using Content.Shared.Examine;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Item;
@@ -178,20 +177,19 @@ namespace Content.Server.Tabletop
{
base.Update(frameTime);
foreach (var gamer in EntityManager.EntityQuery<TabletopGamerComponent>())
var query = EntityQueryEnumerator<TabletopGamerComponent>();
while (query.MoveNext(out var uid, out var gamer))
{
if (!EntityManager.EntityExists(gamer.Tabletop))
if (!Exists(gamer.Tabletop))
continue;
if (!EntityManager.TryGetComponent(gamer.Owner, out ActorComponent? actor))
if (!TryComp(uid, out ActorComponent? actor))
{
EntityManager.RemoveComponent<TabletopGamerComponent>(gamer.Owner);
EntityManager.RemoveComponent<TabletopGamerComponent>(uid);
return;
}
var gamerUid = (gamer).Owner;
if (actor.PlayerSession.Status != SessionStatus.InGame || !CanSeeTable(gamerUid, gamer.Tabletop))
if (actor.PlayerSession.Status != SessionStatus.InGame || !CanSeeTable(uid, gamer.Tabletop))
CloseSessionFor(actor.PlayerSession, gamer.Tabletop);
}
}