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

@@ -79,12 +79,12 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
gate.FlowRate = a*dV/tau + (1-a)*gate.FlowRate; // in L/sec
}
private void OnExamined(EntityUid uid, GasPassiveGateComponent gate, ExaminedEvent args)
private void OnExamined(Entity<GasPassiveGateComponent> gate, ref ExaminedEvent args)
{
if (!EntityManager.GetComponent<TransformComponent>(gate.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
if (!Comp<TransformComponent>(gate).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
return;
var str = Loc.GetString("gas-passive-gate-examined", ("flowRate", $"{gate.FlowRate:0.#}"));
var str = Loc.GetString("gas-passive-gate-examined", ("flowRate", $"{gate.Comp.FlowRate:0.#}"));
args.PushMarkup(str);
}
}

View File

@@ -1,5 +1,4 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos.Piping;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Construction;
@@ -7,6 +6,7 @@ using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping;
using Content.Shared.Audio;
using Content.Shared.Examine;
using JetBrains.Annotations;
@@ -38,12 +38,13 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
UpdateAppearance(uid, comp);
}
private void OnExamined(EntityUid uid, GasRecyclerComponent comp, ExaminedEvent args)
private void OnExamined(Entity<GasRecyclerComponent> ent, ref ExaminedEvent args)
{
if (!EntityManager.GetComponent<TransformComponent>(comp.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
var comp = ent.Comp;
if (!EntityManager.GetComponent<TransformComponent>(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
return;
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
if (!EntityManager.TryGetComponent(ent, out NodeContainerComponent? nodeContainer)
|| !_nodeContainer.TryGetNode(nodeContainer, comp.InletName, out PipeNode? inlet)
|| !_nodeContainer.TryGetNode(nodeContainer, comp.OutletName, out PipeNode? _))
{
@@ -68,13 +69,14 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
}
}
private void OnUpdate(EntityUid uid, GasRecyclerComponent comp, AtmosDeviceUpdateEvent args)
private void OnUpdate(Entity<GasRecyclerComponent> ent, ref AtmosDeviceUpdateEvent args)
{
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
var comp = ent.Comp;
if (!EntityManager.TryGetComponent(ent, out NodeContainerComponent? nodeContainer)
|| !_nodeContainer.TryGetNode(nodeContainer, comp.InletName, out PipeNode? inlet)
|| !_nodeContainer.TryGetNode(nodeContainer, comp.OutletName, out PipeNode? outlet))
{
_ambientSoundSystem.SetAmbience(comp.Owner, false);
_ambientSoundSystem.SetAmbience(ent, false);
return;
}
@@ -92,8 +94,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
}
_atmosphereSystem.Merge(outlet.Air, removed);
UpdateAppearance(uid, comp);
_ambientSoundSystem.SetAmbience(comp.Owner, true);
UpdateAppearance(ent, comp);
_ambientSoundSystem.SetAmbience(ent, true);
}
public float PassiveTransferVol(GasMixture inlet, GasMixture outlet)

View File

@@ -7,7 +7,6 @@ using Content.Shared.Audio;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Player;
@@ -29,9 +28,10 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
SubscribeLocalEvent<GasValveComponent, ExaminedEvent>(OnExamined);
}
private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args)
private void OnExamined(Entity<GasValveComponent> ent, ref ExaminedEvent args)
{
if (!Comp<TransformComponent>(valve.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
var valve = ent.Comp;
if (!Comp<TransformComponent>(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
return;
if (Loc.TryGetString("gas-valve-system-examined", out var str,
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args)
{
Toggle(uid, component);
SoundSystem.Play(component.ValveSound.GetSound(), Filter.Pvs(component.Owner), component.Owner, AudioHelpers.WithVariation(0.25f));
SoundSystem.Play(component.ValveSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.25f));
}
public void Set(EntityUid uid, GasValveComponent component, bool value)
@@ -60,7 +60,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
&& _nodeContainer.TryGetNode(nodeContainer, component.InletName, out PipeNode? inlet)
&& _nodeContainer.TryGetNode(nodeContainer, component.OutletName, out PipeNode? outlet))
{
if (TryComp<AppearanceComponent>(component.Owner,out var appearance))
if (TryComp<AppearanceComponent>(uid, out var appearance))
{
_appearance.SetData(uid, FilterVisuals.Enabled, component.Open, appearance);
}
@@ -68,13 +68,13 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
{
inlet.AddAlwaysReachable(outlet);
outlet.AddAlwaysReachable(inlet);
_ambientSoundSystem.SetAmbience(component.Owner, true);
_ambientSoundSystem.SetAmbience(uid, true);
}
else
{
inlet.RemoveAlwaysReachable(outlet);
outlet.RemoveAlwaysReachable(inlet);
_ambientSoundSystem.SetAmbience(component.Owner, false);
_ambientSoundSystem.SetAmbience(uid, false);
}
}
}