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

@@ -14,7 +14,6 @@ using Content.Shared.Interaction;
using Content.Shared.Popups;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
{
@@ -60,16 +59,16 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|| !_nodeContainer.TryGetNode(nodeContainer, filter.OutletName, out PipeNode? outletNode)
|| outletNode.Air.Pressure >= Atmospherics.MaxOutputPressure) // No need to transfer if target is full.
{
_ambientSoundSystem.SetAmbience(filter.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
var transferVol = (float)(filter.TransferRate * args.dt);
var transferVol = filter.TransferRate * args.dt;
if (transferVol <= 0)
{
_ambientSoundSystem.SetAmbience(filter.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
@@ -84,7 +83,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
var target = filterNode.Air.Pressure < Atmospherics.MaxOutputPressure ? filterNode : inletNode;
_atmosphereSystem.Merge(target.Air, filteredOut);
_ambientSoundSystem.SetAmbience(filter.Owner, filteredOut.TotalMoles > 0f);
_ambientSoundSystem.SetAmbience(uid, filteredOut.TotalMoles > 0f);
}
_atmosphereSystem.Merge(outletNode.Air, removed);
@@ -95,7 +94,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
filter.Enabled = false;
UpdateAppearance(uid, filter);
_ambientSoundSystem.SetAmbience(filter.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
DirtyUI(uid, filter);
_userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key);
@@ -106,7 +105,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
if (EntityManager.GetComponent<TransformComponent>(filter.Owner).Anchored)
if (EntityManager.GetComponent<TransformComponent>(uid).Anchored)
{
_userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession);
DirtyUI(uid, filter);
@@ -125,7 +124,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
return;
_userInterfaceSystem.TrySetUiState(uid, GasFilterUiKey.Key,
new GasFilterBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(filter.Owner).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas));
new GasFilterBoundUserInterfaceState(MetaData(uid).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas));
}
private void UpdateAppearance(EntityUid uid, GasFilterComponent? filter = null)

View File

@@ -7,7 +7,6 @@ using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping;
using Content.Shared.Audio;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
{
@@ -40,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|| !_nodeContainer.TryGetNode(nodeContainer, comp.ControlName, out PipeNode? controlNode)
|| !_nodeContainer.TryGetNode(nodeContainer, comp.OutletName, out PipeNode? outletNode))
{
_ambientSoundSystem.SetAmbience(comp.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
comp.Enabled = false;
return;
}
@@ -68,14 +67,14 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
UpdateAppearance(uid, comp);
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
var transferVolume = (float)(transferRate * args.dt);
var transferVolume = transferRate * args.dt;
if (transferVolume <= 0)
{
_ambientSoundSystem.SetAmbience(comp.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
_ambientSoundSystem.SetAmbience(comp.Owner, true);
_ambientSoundSystem.SetAmbience(uid, true);
var removed = inletNode.Air.RemoveVolume(transferVolume);
_atmosphereSystem.Merge(outletNode.Air, removed);
}
@@ -84,7 +83,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
{
comp.Enabled = false;
UpdateAppearance(uid, comp);
_ambientSoundSystem.SetAmbience(comp.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
}
private void UpdateAppearance(EntityUid uid, PressureControlledValveComponent? comp = null, AppearanceComponent? appearance = null)