Atmos device performance improvements (#26493)

* Atmos device performance improvements

* AtmosDirection perf improvements

* Fix errors

* Add GasTileOverlayComponent arguments

* Make excite no longer invalidate a tile
This commit is contained in:
Leon Friedrich
2024-03-30 17:17:53 +13:00
committed by GitHub
parent aa96baeb5f
commit 888a3bda51
51 changed files with 373 additions and 324 deletions

View File

@@ -4,7 +4,7 @@
public sealed partial class CableVisComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("node")]
public string? Node;
[DataField("node", required:true)]
public string Node;
}
}

View File

@@ -23,10 +23,7 @@ namespace Content.Server.Power.EntitySystems
private void UpdateAppearance(EntityUid uid, CableVisComponent cableVis, ref NodeGroupsRebuilt args)
{
if (!TryComp(uid, out NodeContainerComponent? nodeContainer) || !TryComp(uid, out AppearanceComponent? appearance))
return;
if (!_nodeContainer.TryGetNode<CableNode>(nodeContainer, cableVis.Node, out var node))
if (!_nodeContainer.TryGetNode(uid, cableVis.Node, out CableNode? node))
return;
var transform = Transform(uid);
@@ -55,7 +52,7 @@ namespace Content.Server.Power.EntitySystems
};
}
_appearance.SetData(uid, WireVisVisuals.ConnectedMask, mask, appearance);
_appearance.SetData(uid, WireVisVisuals.ConnectedMask, mask);
}
}
}

View File

@@ -26,12 +26,8 @@ public sealed class GasPowerReceiverSystem : EntitySystem
{
var timeDelta = args.dt;
if (!HasComp<AtmosDeviceComponent>(uid)
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|| !_nodeContainer.TryGetNode<PipeNode>(nodeContainer, "pipe", out var pipe))
{
if (!_nodeContainer.TryGetNode(uid, "pipe", out PipeNode? pipe))
return;
}
// if we're below the max temperature, then we are simply consuming our target gas
if (pipe.Air.Temperature <= component.MaxTemperature)
@@ -57,7 +53,7 @@ public sealed class GasPowerReceiverSystem : EntitySystem
if (component.OffVentGas)
{
// eject the gas into the atmosphere
var mix = _atmosphereSystem.GetContainingMixture(uid, false, true);
var mix = _atmosphereSystem.GetContainingMixture(uid, args.Grid, args.Map, false, true);
if (mix is not null)
_atmosphereSystem.Merge(res, mix);
}