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:
@@ -53,11 +53,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, ref AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
if (!filter.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, filter.InletName, out PipeNode? inletNode)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, filter.FilterName, out PipeNode? filterNode)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, filter.OutletName, out PipeNode? outletNode)
|
||||
|| !_nodeContainer.TryGetNodes(uid, filter.InletName, filter.OutletName, filter.FilterName, out PipeNode? inletNode, out PipeNode? filterNode, out PipeNode? outletNode)
|
||||
|| outletNode.Air.Pressure >= Atmospherics.MaxOutputPressure) // No need to transfer if target is full.
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
@@ -187,16 +183,15 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
||||
return;
|
||||
|
||||
var gasMixDict = new Dictionary<string, GasMixture?>();
|
||||
args.GasMixtures ??= new Dictionary<string, GasMixture?>();
|
||||
|
||||
if(_nodeContainer.TryGetNode(nodeContainer, component.InletName, out PipeNode? inlet))
|
||||
gasMixDict.Add(Loc.GetString("gas-analyzer-window-text-inlet"), inlet.Air);
|
||||
args.GasMixtures.Add(Loc.GetString("gas-analyzer-window-text-inlet"), inlet.Air);
|
||||
if(_nodeContainer.TryGetNode(nodeContainer, component.FilterName, out PipeNode? filterNode))
|
||||
gasMixDict.Add(Loc.GetString("gas-analyzer-window-text-filter"), filterNode.Air);
|
||||
args.GasMixtures.Add(Loc.GetString("gas-analyzer-window-text-filter"), filterNode.Air);
|
||||
if(_nodeContainer.TryGetNode(nodeContainer, component.OutletName, out PipeNode? outlet))
|
||||
gasMixDict.Add(Loc.GetString("gas-analyzer-window-text-outlet"), outlet.Air);
|
||||
args.GasMixtures.Add(Loc.GetString("gas-analyzer-window-text-outlet"), outlet.Air);
|
||||
|
||||
args.GasMixtures = gasMixDict;
|
||||
args.DeviceFlipped = inlet != null && filterNode != null && inlet.CurrentPipeDirection.ToDirection() == filterNode.CurrentPipeDirection.ToDirection().GetClockwise90Degrees();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,18 +54,8 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
{
|
||||
// TODO ATMOS: Cache total moles since it's expensive.
|
||||
|
||||
if (!mixer.Enabled)
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
||||
return;
|
||||
|
||||
if (!_nodeContainer.TryGetNode(nodeContainer, mixer.InletOneName, out PipeNode? inletOne)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, mixer.InletTwoName, out PipeNode? inletTwo)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, mixer.OutletName, out PipeNode? outlet))
|
||||
if (!mixer.Enabled
|
||||
|| !_nodeContainer.TryGetNodes(uid, mixer.InletOneName, mixer.InletTwoName, mixer.OutletName, out PipeNode? inletOne, out PipeNode? inletTwo, out PipeNode? outlet))
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
return;
|
||||
|
||||
@@ -33,11 +33,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
private void OnUpdate(EntityUid uid, PressureControlledValveComponent comp, ref AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, comp.InletName, out PipeNode? inletNode)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, comp.ControlName, out PipeNode? controlNode)
|
||||
|| !_nodeContainer.TryGetNode(nodeContainer, comp.OutletName, out PipeNode? outletNode))
|
||||
if (!_nodeContainer.TryGetNodes(uid, comp.InletName, comp.ControlName, comp.OutletName, out PipeNode? inletNode, out PipeNode? controlNode, out PipeNode? outletNode))
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
comp.Enabled = false;
|
||||
|
||||
Reference in New Issue
Block a user