Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Procedural;
|
||||
using Content.Shared.Salvage;
|
||||
using Content.Shared.Salvage.Expeditions;
|
||||
|
||||
namespace Content.Server.Salvage;
|
||||
@@ -24,34 +23,35 @@ public sealed partial class SalvageSystem
|
||||
UpdateConsoles(data);
|
||||
}
|
||||
|
||||
private void OnSalvageConsoleInit(EntityUid uid, SalvageExpeditionConsoleComponent component, ComponentInit args)
|
||||
private void OnSalvageConsoleInit(Entity<SalvageExpeditionConsoleComponent> console, ref ComponentInit args)
|
||||
{
|
||||
UpdateConsole(component);
|
||||
UpdateConsole(console);
|
||||
}
|
||||
|
||||
private void OnSalvageConsoleParent(EntityUid uid, SalvageExpeditionConsoleComponent component, ref EntParentChangedMessage args)
|
||||
private void OnSalvageConsoleParent(Entity<SalvageExpeditionConsoleComponent> console, ref EntParentChangedMessage args)
|
||||
{
|
||||
UpdateConsole(component);
|
||||
UpdateConsole(console);
|
||||
}
|
||||
|
||||
private void UpdateConsoles(SalvageExpeditionDataComponent component)
|
||||
{
|
||||
var state = GetState(component);
|
||||
|
||||
foreach (var (console, xform, uiComp) in EntityQuery<SalvageExpeditionConsoleComponent, TransformComponent, UserInterfaceComponent>(true))
|
||||
var query = AllEntityQuery<SalvageExpeditionConsoleComponent, UserInterfaceComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var uid, out _, out var uiComp, out var xform))
|
||||
{
|
||||
var station = _station.GetOwningStation(console.Owner, xform);
|
||||
var station = _station.GetOwningStation(uid, xform);
|
||||
|
||||
if (station != component.Owner)
|
||||
if (station != uid)
|
||||
continue;
|
||||
|
||||
_ui.TrySetUiState(console.Owner, SalvageConsoleUiKey.Expedition, state, ui: uiComp);
|
||||
_ui.TrySetUiState(uid, SalvageConsoleUiKey.Expedition, state, ui: uiComp);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateConsole(SalvageExpeditionConsoleComponent component)
|
||||
private void UpdateConsole(Entity<SalvageExpeditionConsoleComponent> component)
|
||||
{
|
||||
var station = _station.GetOwningStation(component.Owner);
|
||||
var station = _station.GetOwningStation(component);
|
||||
SalvageExpeditionConsoleState state;
|
||||
|
||||
if (TryComp<SalvageExpeditionDataComponent>(station, out var dataComponent))
|
||||
@@ -63,6 +63,6 @@ public sealed partial class SalvageSystem
|
||||
state = new SalvageExpeditionConsoleState(TimeSpan.Zero, false, true, 0, new List<SalvageMissionParams>());
|
||||
}
|
||||
|
||||
_ui.TrySetUiState(component.Owner, SalvageConsoleUiKey.Expedition, state);
|
||||
_ui.TrySetUiState(component, SalvageConsoleUiKey.Expedition, state);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user