Inline GetComponentOrNull
This commit is contained in:
@@ -231,9 +231,9 @@ namespace Content.Server.Atmos.Components
|
||||
private InternalsComponent? GetInternalsComponent(IEntity? owner = null)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return null;
|
||||
if (owner != null) return owner.GetComponentOrNull<InternalsComponent>();
|
||||
if (owner != null) return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(owner.Uid);
|
||||
return Owner.TryGetContainer(out var container)
|
||||
? container.Owner.GetComponentOrNull<InternalsComponent>()
|
||||
? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(container.Owner.Uid)
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
var uid = barotrauma.Owner.Uid;
|
||||
|
||||
var status = barotrauma.Owner.GetComponentOrNull<ServerAlertsComponent>();
|
||||
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner.Uid);
|
||||
|
||||
var pressure = 1f;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnGasDualPortVentPumpUpdated(EntityUid uid, GasDualPortVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = vent.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(vent.Owner.Uid);
|
||||
|
||||
if (vent.Welded)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = pump.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(pump.Owner.Uid);
|
||||
|
||||
if (!pump.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = filter.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(filter.Owner.Uid);
|
||||
|
||||
if (!filter.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = thermoMachine.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(thermoMachine.Owner.Uid);
|
||||
|
||||
if (!thermoMachine.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = vent.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(vent.Owner.Uid);
|
||||
|
||||
if (vent.Welded)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = scrubber.Owner.GetComponentOrNull<AppearanceComponent>();
|
||||
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(scrubber.Owner.Uid);
|
||||
|
||||
if (scrubber.Welded)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user