Atmospheric alerts computer (#25938)
* Atmospheric alerts computer * Moved components, restricted access to them * Minor tweaks * The screen will now turn off when the computer is not powered * Bug fix * Adjusted label * Updated to latest master version
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Monitor.Components;
|
||||
using Content.Server.Atmos.Piping.Components;
|
||||
using Content.Server.DeviceLinking.Systems;
|
||||
@@ -22,6 +21,7 @@ using Content.Shared.Power;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.Atmos.Monitor.Systems;
|
||||
|
||||
@@ -582,6 +582,20 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
? alarm.SensorData.Values.Select(v => v.Temperature).Average()
|
||||
: 0f;
|
||||
}
|
||||
public float CalculateGasMolarConcentrationAverage(AirAlarmComponent alarm, Gas gas, out float percentage)
|
||||
{
|
||||
percentage = 0f;
|
||||
|
||||
var data = alarm.SensorData.Values.SelectMany(v => v.Gases.Where(g => g.Key == gas));
|
||||
|
||||
if (data.Count() == 0)
|
||||
return 0f;
|
||||
|
||||
var averageMol = data.Select(kvp => kvp.Value).Average();
|
||||
percentage = data.Select(kvp => kvp.Value).Sum() / alarm.SensorData.Values.Select(v => v.TotalMoles).Sum();
|
||||
|
||||
return averageMol;
|
||||
}
|
||||
|
||||
public void UpdateUI(EntityUid uid, AirAlarmComponent? alarm = null, DeviceNetworkComponent? devNet = null, AtmosAlarmableComponent? alarmable = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user