Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream Merge 2024-09-14 #190

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
1cef2e4
Hotfix shortconstructionmenu radius becoming infinite
Mnemotechnician Sep 8, 2024
f8027b5
Fix Maps Missing Assistants (#838)
VMSolidus Sep 9, 2024
06771ea
Nerf Default Power Attack (#866)
VMSolidus Sep 9, 2024
d82aa20
Automatic Changelog Update (#838)
SimpleStation14 Sep 9, 2024
874f4f7
Update Clothing Assignments of Suit/Skirt (#857)
Tirochora Sep 9, 2024
d37c7ee
Re-Enable Arrivals (#871)
VMSolidus Sep 9, 2024
aec137a
Automatic Changelog Update (#866)
SimpleStation14 Sep 9, 2024
058650e
Americanize Contests System (#814)
VMSolidus Sep 9, 2024
d0c5110
Step Trigger Minor Refactor (#884)
VMSolidus Sep 9, 2024
7bdec1c
Automatic Changelog Update (#871)
SimpleStation14 Sep 9, 2024
ff1dc64
Automatic Changelog Update (#884)
SimpleStation14 Sep 9, 2024
cd3c598
Fix Logic Requirements Not Checking Inversion (#891)
DEATHB4DEFEAT Sep 9, 2024
a0c225d
Split Arm And Leg Markings (#870)
VMSolidus Sep 9, 2024
bb8df4d
Automatic Changelog Update (#870)
SimpleStation14 Sep 9, 2024
182f9a3
Revert Revert Antag Refactor With Fixes (#794)
VMSolidus Sep 9, 2024
eeaf639
Automatic Changelog Update (#794)
SimpleStation14 Sep 9, 2024
88451f1
Hotfix Linter (#894)
VMSolidus Sep 9, 2024
1dcb1c2
Food Recipe Guidebook (#783)
Mnemotechnician Sep 11, 2024
2384e9c
Automatic Changelog Update (#783)
SimpleStation14 Sep 11, 2024
c83c55e
Uncomment Rat King (#903)
VMSolidus Sep 11, 2024
2e80ed4
Jetpack Server Configuration (#901)
VMSolidus Sep 11, 2024
6a40446
Automatic Changelog Update (#903)
SimpleStation14 Sep 11, 2024
ea88caf
Medical Loadout Groups (#902)
VMSolidus Sep 11, 2024
fdd00e7
Automatic Changelog Update (#901)
SimpleStation14 Sep 11, 2024
4d82754
Penlight-Fixes (#900)
SleepyScarecrow Sep 11, 2024
0fa1fbf
Automatic Changelog Update (#902)
SimpleStation14 Sep 11, 2024
2a59ad3
Fix Languages Again (#893)
Mnemotechnician Sep 11, 2024
9fe62d8
Automatic Changelog Update (#900)
SimpleStation14 Sep 11, 2024
6143cc2
Automatic Changelog Update (#893)
SimpleStation14 Sep 11, 2024
601073c
Cargo Loadout Groups (#909)
gluesniffler Sep 11, 2024
fb6b08a
Automatic Changelog Update (#909)
SimpleStation14 Sep 11, 2024
349d9b7
Security Loadout Groups (#908)
gluesniffler Sep 11, 2024
3334564
Automatic Changelog Update (#908)
SimpleStation14 Sep 11, 2024
069c187
Service & Instrument Loadout Groups (#906)
gluesniffler Sep 11, 2024
82997f9
Automatic Changelog Update (#906)
SimpleStation14 Sep 11, 2024
cda8a79
Engineering Loadout Groups (#907)
gluesniffler Sep 11, 2024
8b3534a
Automatic Changelog Update (#907)
SimpleStation14 Sep 11, 2024
d14ec7b
Reverse Engineering Update Pr Port/ Board Cost Balance (#910)
Squishy77 Sep 12, 2024
871d723
Automatic Changelog Update (#910)
SimpleStation14 Sep 12, 2024
2ba9c9c
Alcohol Ethanol Content Fix (#911)
SleepyScarecrow Sep 12, 2024
ebb4b2e
Automatic Changelog Update (#911)
SimpleStation14 Sep 12, 2024
67a17ae
Port Delta-V Jukebox Additions (#912)
Mnemotechnician Sep 12, 2024
093ab48
Make Blood Deficiency Bloodloss Consistent (#895)
angelofallars Sep 12, 2024
1482e54
Automatic Changelog Update (#912)
SimpleStation14 Sep 12, 2024
61bb6ea
Automatic Changelog Update (#895)
SimpleStation14 Sep 12, 2024
97e7f1e
Add Access Wire to Airlocks (#916)
stellar-novas Sep 14, 2024
ea22022
Automatic Changelog Update (#916)
SimpleStation14 Sep 14, 2024
5e4e4b1
Science Loadout Groups + Command Cost Adjustments (#914)
gluesniffler Sep 14, 2024
4f601f5
Automatic Changelog Update (#914)
SimpleStation14 Sep 14, 2024
b35e63b
Bartender Loadout Groups (Also Item Group Localizations) (#915)
VMSolidus Sep 14, 2024
ca4ea41
Automatic Changelog Update (#915)
SimpleStation14 Sep 14, 2024
8b93cec
Cherry-Pick #28077 (#898)
VMSolidus Sep 14, 2024
9b7d531
Slight Starting Gear Changes. (#897)
CilliePaint Sep 14, 2024
c0ca58b
Automatic Changelog Update (#897)
SimpleStation14 Sep 14, 2024
c49ce78
User-Friendly Sprinting (#889)
Mnemotechnician Sep 14, 2024
53fdceb
Automatic Changelog Update (#889)
SimpleStation14 Sep 14, 2024
5f7475d
Chemical Moodlets (And Drug Addictions!) (#896)
VMSolidus Sep 14, 2024
8824b51
Automatic Changelog Update (#896)
SimpleStation14 Sep 14, 2024
4b3cde2
Merge remote-tracking branch 'refs/remotes/real-ee/master' into feat/…
Mnemotechnician Sep 14, 2024
25b5496
Update loadouts
Mnemotechnician Sep 14, 2024
12472b4
Merge branch 'patch-1' of https://github.com/Mnemotechnician/Einstein…
Mnemotechnician Sep 14, 2024
63ec69b
Fix #864 and Rehydratable System Doing Client-Side Spawn (#888)
Mnemotechnician Sep 14, 2024
8adc3b9
Automatic Changelog Update (#888)
SimpleStation14 Sep 14, 2024
fbc4698
Hotfix Shortconstructionmenu Radius Becoming Infinite (#890)
Mnemotechnician Sep 14, 2024
4419aaa
Nerf Uncloneable (#868)
VMSolidus Sep 14, 2024
956b334
Automatic Changelog Update (#868)
SimpleStation14 Sep 14, 2024
41a8b1b
Weather Block Marker, Rad Markers and Invisible Walls (#862)
Peptide90 Sep 14, 2024
a6a4411
Merge branch 'master' of https://github.com/Fansana/floofstation1 int…
Mnemotechnician Sep 15, 2024
841a49c
Merge branch 'master' of https://github.com/simple-station/einstein-e…
Mnemotechnician Sep 15, 2024
82deba4
Harpy Flight System (#919)
gluesniffler Sep 16, 2024
2f5e697
Automatic Changelog Update (#919)
SimpleStation14 Sep 16, 2024
5004cf8
Physical Pulling (#883)
Mnemotechnician Sep 17, 2024
b65a5d8
Core Fullsize (Underfueled) AME (#927)
VMSolidus Sep 17, 2024
3dc28cf
Automatic Changelog Update (#883)
SimpleStation14 Sep 17, 2024
0079259
Automatic Changelog Update (#927)
SimpleStation14 Sep 17, 2024
2f8d9e8
Fixes to Bench and Barber Chair Rotation (#925)
Flybik Sep 17, 2024
34d9e0d
Re-Adds Fireaxe Prying (#921)
zelezniciar1 Sep 17, 2024
ff618e9
Automatic Changelog Update (#925)
SimpleStation14 Sep 17, 2024
f5275e2
9 More Traits (#918)
VMSolidus Sep 17, 2024
3dd57ca
Open Market Tacsuits (#845)
VMSolidus Sep 17, 2024
9e293ea
Psionic Power Rolling Rework (#830)
VMSolidus Sep 17, 2024
a553909
IPC Refactor (#771)
VMSolidus Sep 17, 2024
ca88477
Automatic Changelog Update (#921)
SimpleStation14 Sep 17, 2024
46cbafa
Filespace ContestsSystem.cs (#931)
VMSolidus Sep 18, 2024
364b237
Fix Uncloneable Feedback Message (#926)
VMSolidus Sep 18, 2024
4d4afb6
Automatic Changelog Update (#926)
SimpleStation14 Sep 18, 2024
d5f0c55
Better Lying Down System (From White Dream) (#815)
VMSolidus Sep 19, 2024
a8e435c
Automatic Changelog Update (#815)
SimpleStation14 Sep 19, 2024
2bfbc72
Remove DeltaV Options (#928)
FoxxoTrystan Sep 19, 2024
0cf7803
Automatic Changelog Update (#928)
SimpleStation14 Sep 19, 2024
d6dd2ea
Fix SpawnAndDeleteAllEntities (#932)
VMSolidus Sep 19, 2024
dee5a40
[Port] StepTriggerGroup From WhiteDream (#929)
VMSolidus Sep 19, 2024
6d1aae9
Automatic Changelog Update (#929)
SimpleStation14 Sep 19, 2024
0aa49c1
Fix Laying Down Bugs (#933)
VMSolidus Sep 19, 2024
7bce1e9
Automatic Changelog Update (#933)
SimpleStation14 Sep 19, 2024
8b5dcd6
Non-Destructive Universal Language (#899)
VMSolidus Sep 20, 2024
80daa94
Automatic Changelog Update (#899)
SimpleStation14 Sep 20, 2024
7119dd0
NyanoCombat Part 4: MeleeSystem Refactor Part 2, Electric Boogaloo (#…
VMSolidus Sep 20, 2024
c1aef1b
Automatic Changelog Update (#934)
SimpleStation14 Sep 20, 2024
b01ae70
Allow Crawling Entities To Go Under Tables (#939)
gluesniffler Sep 20, 2024
7ff002a
Automatic Changelog Update (#939)
SimpleStation14 Sep 20, 2024
14d8f81
Melee Part 5: Less Exhaustion (#938)
OldDanceJacket Sep 20, 2024
6a653c5
Automatic Changelog Update (#938)
SimpleStation14 Sep 20, 2024
104ee3e
Variable NPC Juke Aggression (#935)
VMSolidus Sep 20, 2024
68772a8
Automatic Changelog Update (#935)
SimpleStation14 Sep 20, 2024
981c4f6
Update SetOutfitCommand.cs (#941)
VMSolidus Sep 20, 2024
81bbf6b
Longarms Require Wielding (#913)
VMSolidus Sep 20, 2024
82f4971
Automatic Changelog Update (#913)
SimpleStation14 Sep 20, 2024
328d71a
Ports Atmospheric Alerts Computer (#922)
zelezniciar1 Sep 20, 2024
def63b6
Basic Language Menu (#936)
VMSolidus Sep 20, 2024
20158ff
Automatic Changelog Update (#922)
SimpleStation14 Sep 20, 2024
5247c97
Remove Become Psionic Objective (#940)
VMSolidus Sep 20, 2024
cce7e3f
Automatic Changelog Update (#936)
SimpleStation14 Sep 20, 2024
75c39d5
Automatic Changelog Update (#940)
SimpleStation14 Sep 20, 2024
47bea5a
Merge branch 'master' of https://github.com/simple-station/einstein-e…
Mnemotechnician Sep 20, 2024
0010ffc
Re-add scugsign
Mnemotechnician Sep 21, 2024
1bc78b7
Disable midround zombos again
Mnemotechnician Sep 21, 2024
d4d2ee4
GalacticCommon -> TauCetiBasic
Mnemotechnician Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Content.Benchmarks/SpawnEquipDeleteBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ await _pair.Server.WaitPost(() =>
for (var i = 0; i < N; i++)
{
_entity = server.EntMan.SpawnAttachedTo(Mob, _coords);
_spawnSys.EquipStartingGear(_entity, _gear, null);
_spawnSys.EquipStartingGear(_entity, _gear);
server.EntMan.DeleteEntity(_entity);
}
});
Expand Down
81 changes: 81 additions & 0 deletions Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:Content.Client.Stylesheets"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Orientation="Vertical" HorizontalExpand ="True" Margin="0 0 0 3">

<!-- Device selection button -->
<Button Name="FocusButton" HorizontalExpand="True" SetHeight="32" Margin="12 0 0 0" StyleClasses="OpenBoth" Access="Public">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Horizontal">

<!-- Alarm state -->
<TextureRect Stretch="Keep" HorizontalAlignment="Left" Margin="-20 -2 0 0" ModulateSelfOverride="#25252a" TexturePath="/Textures/Interface/AtmosMonitoring/status_bg.png">
<BoxContainer VerticalExpand="True" HorizontalExpand="True" Orientation="Horizontal" Margin="8 0">
<TextureRect Name="ArrowTexture" VerticalAlignment="Center" SetSize="12 12" Stretch="KeepAspectCentered" Margin="3 0" TexturePath="/Textures/Interface/Nano/triangle_right.png"></TextureRect>
<Label Name="AlarmStateLabel" HorizontalExpand="True" HorizontalAlignment="Center" FontColorOverride="#5A5A5A" Text="{Loc 'atmos-alerts-window-invalid-state'}"></Label>
</BoxContainer>
</TextureRect>

<!-- Alarm name -->
<Label Name="AlarmNameLabel" Text="???" HorizontalExpand="True" HorizontalAlignment="Center" Margin="5 0"></Label>
</BoxContainer>
</Button>

<!-- Panel that appears on selecting the device -->
<PanelContainer Name="FocusContainer" HorizontalExpand="True" Margin="1 -1 1 0" ReservesSpace="False" Visible="False" Access="Public">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#25252a"/>
</PanelContainer.PanelOverride>
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">

<!-- Atmosphere status -->
<Control>

<!-- Main container for displaying atmospheric data -->
<BoxContainer Name="MainDataContainer" HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical" ReservesSpace="False" Visible="False">
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
<Label Name="TemperatureHeaderLabel" Text="{Loc 'atmos-alerts-window-temperature-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="PressureHeaderLabel" Text="{Loc 'atmos-alerts-window-pressure-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="OxygenationHeaderLabel" Text="{Loc 'atmos-alerts-window-oxygenation-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
</BoxContainer>
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#202023"/>
</PanelContainer.PanelOverride>
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
<Label Name="TemperatureLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#5A5A5A" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="PressureLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#5A5A5A" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="OxygenationLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#5A5A5A" Margin="0 2 0 0" SetHeight="24"></Label>
</BoxContainer>
</PanelContainer>
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
<Label Name="GasesHeaderLabel" Text="{Loc 'atmos-alerts-window-other-gases-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 4 0 0" SetHeight="24"></Label>
</BoxContainer>
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#202023"/>
</PanelContainer.PanelOverride>

<!-- Gas entries added via C# code -->
<GridContainer Name="GasGridContainer" HorizontalExpand="True" Columns = "4"></GridContainer>
</PanelContainer>
</BoxContainer>

<!-- If the alarm is inactive, this is label is diplayed instead -->
<Label Name="NoDataLabel" Text="{Loc 'atmos-alerts-window-no-data-available'}" HorizontalAlignment="Center" Margin="0 15" FontColorOverride="#a9a9a9" ReservesSpace="False" Visible="False"></Label>

<!-- Silencing progress bar -->
<controls:StripeBack Name="SilenceAlarmProgressBar" ReservesSpace="False" Visible="False" Access="Public">
<PanelContainer>
<Label Text="{Loc 'atmos-alerts-window-alerts-being-silenced'}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5 5 5 5"/>
</PanelContainer>
</controls:StripeBack>
</Control>

<!-- Check box for silencing this alarm -->
<CheckBox Name="SilenceCheckBox" Text="{Loc 'atmos-alerts-window-silence-alerts'}" HorizontalAlignment="Left" Margin="5 5 5 5" Access="Public"></CheckBox>
</BoxContainer>
</PanelContainer>

</BoxContainer>
215 changes: 215 additions & 0 deletions Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
using Content.Client.Stylesheets;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.FixedPoint;
using Content.Shared.Temperature;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map;
using System.Linq;

namespace Content.Client.Atmos.Consoles;

[GenerateTypedNameReferences]
public sealed partial class AtmosAlarmEntryContainer : BoxContainer
{
public NetEntity NetEntity;
public EntityCoordinates? Coordinates;

private readonly IEntityManager _entManager;
private readonly IResourceCache _cache;

private Dictionary<AtmosAlarmType, string> _alarmStrings = new Dictionary<AtmosAlarmType, string>()
{
[AtmosAlarmType.Invalid] = "atmos-alerts-window-invalid-state",
[AtmosAlarmType.Normal] = "atmos-alerts-window-normal-state",
[AtmosAlarmType.Warning] = "atmos-alerts-window-warning-state",
[AtmosAlarmType.Danger] = "atmos-alerts-window-danger-state",
};

private Dictionary<Gas, string> _gasShorthands = new Dictionary<Gas, string>()
{
[Gas.Ammonia] = "NH₃",
[Gas.CarbonDioxide] = "CO₂",
[Gas.Frezon] = "F",
[Gas.Nitrogen] = "N₂",
[Gas.NitrousOxide] = "N₂O",
[Gas.Oxygen] = "O₂",
[Gas.Plasma] = "P",
[Gas.Tritium] = "T",
[Gas.WaterVapor] = "H₂O",
};

public AtmosAlarmEntryContainer(NetEntity uid, EntityCoordinates? coordinates)
{
RobustXamlLoader.Load(this);

_entManager = IoCManager.Resolve<IEntityManager>();
_cache = IoCManager.Resolve<IResourceCache>();

NetEntity = uid;
Coordinates = coordinates;

// Load fonts
var headerFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"), 11);
var normalFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf"), 11);
var smallFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);

// Set fonts
TemperatureHeaderLabel.FontOverride = headerFont;
PressureHeaderLabel.FontOverride = headerFont;
OxygenationHeaderLabel.FontOverride = headerFont;
GasesHeaderLabel.FontOverride = headerFont;

TemperatureLabel.FontOverride = normalFont;
PressureLabel.FontOverride = normalFont;
OxygenationLabel.FontOverride = normalFont;

NoDataLabel.FontOverride = headerFont;

SilenceCheckBox.Label.FontOverride = smallFont;
SilenceCheckBox.Label.FontColorOverride = Color.DarkGray;
}

public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlertsFocusDeviceData? focusData = null)
{
NetEntity = entry.NetEntity;
Coordinates = _entManager.GetCoordinates(entry.Coordinates);

// Load fonts
var normalFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf"), 11);

// Update alarm state
if (!_alarmStrings.TryGetValue(entry.AlarmState, out var alarmString))
alarmString = "atmos-alerts-window-invalid-state";

AlarmStateLabel.Text = Loc.GetString(alarmString);
AlarmStateLabel.FontColorOverride = GetAlarmStateColor(entry.AlarmState);

// Update alarm name
AlarmNameLabel.Text = Loc.GetString("atmos-alerts-window-alarm-label", ("name", entry.EntityName), ("address", entry.Address));

// Focus updates
FocusContainer.Visible = isFocus;

if (isFocus)
SetAsFocus();
else
RemoveAsFocus();

if (isFocus && entry.Group == AtmosAlertsComputerGroup.AirAlarm)
{
MainDataContainer.Visible = (entry.AlarmState != AtmosAlarmType.Invalid);
NoDataLabel.Visible = (entry.AlarmState == AtmosAlarmType.Invalid);

if (focusData != null)
{
// Update temperature
var tempK = (FixedPoint2)focusData.Value.TemperatureData.Item1;
var tempC = (FixedPoint2)TemperatureHelpers.KelvinToCelsius(tempK.Float());

TemperatureLabel.Text = Loc.GetString("atmos-alerts-window-temperature-value", ("valueInC", tempC), ("valueInK", tempK));
TemperatureLabel.FontColorOverride = GetAlarmStateColor(focusData.Value.TemperatureData.Item2);

// Update pressure
PressureLabel.Text = Loc.GetString("atmos-alerts-window-pressure-value", ("value", (FixedPoint2)focusData.Value.PressureData.Item1));
PressureLabel.FontColorOverride = GetAlarmStateColor(focusData.Value.PressureData.Item2);

// Update oxygenation
var oxygenPercent = (FixedPoint2)0f;
var oxygenAlert = AtmosAlarmType.Invalid;

if (focusData.Value.GasData.TryGetValue(Gas.Oxygen, out var oxygenData))
{
oxygenPercent = oxygenData.Item2 * 100f;
oxygenAlert = oxygenData.Item3;
}

OxygenationLabel.Text = Loc.GetString("atmos-alerts-window-oxygenation-value", ("value", oxygenPercent));
OxygenationLabel.FontColorOverride = GetAlarmStateColor(oxygenAlert);

// Update other present gases
GasGridContainer.RemoveAllChildren();

var gasData = focusData.Value.GasData.Where(g => g.Key != Gas.Oxygen);

if (gasData.Count() == 0)
{
// No other gases
var gasLabel = new Label()
{
Text = Loc.GetString("atmos-alerts-window-other-gases-value-nil"),
FontOverride = normalFont,
FontColorOverride = StyleNano.DisabledFore,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Margin = new Thickness(0, 2, 0, 0),
SetHeight = 24f,
};

GasGridContainer.AddChild(gasLabel);
}

else
{
// Add an entry for each gas
foreach ((var gas, (var mol, var percent, var alert)) in gasData)
{
var gasPercent = (FixedPoint2)0f;
gasPercent = percent * 100f;

if (!_gasShorthands.TryGetValue(gas, out var gasShorthand))
gasShorthand = "X";

var gasLabel = new Label()
{
Text = Loc.GetString("atmos-alerts-window-other-gases-value", ("shorthand", gasShorthand), ("value", gasPercent)),
FontOverride = normalFont,
FontColorOverride = GetAlarmStateColor(alert),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Margin = new Thickness(0, 2, 0, 0),
SetHeight = 24f,
};

GasGridContainer.AddChild(gasLabel);
}
}
}
}
}

public void SetAsFocus()
{
FocusButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
ArrowTexture.TexturePath = "/Textures/Interface/Nano/inverted_triangle.svg.png";
}

public void RemoveAsFocus()
{
FocusButton.RemoveStyleClass(StyleNano.StyleClassButtonColorGreen);
ArrowTexture.TexturePath = "/Textures/Interface/Nano/triangle_right.png";
FocusContainer.Visible = false;
}

private Color GetAlarmStateColor(AtmosAlarmType alarmType)
{
switch (alarmType)
{
case AtmosAlarmType.Normal:
return StyleNano.GoodGreenFore;
case AtmosAlarmType.Warning:
return StyleNano.ConcerningOrangeFore;
case AtmosAlarmType.Danger:
return StyleNano.DangerousRedFore;
}

return StyleNano.DisabledFore;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Shared.Atmos.Components;

namespace Content.Client.Atmos.Consoles;

public sealed class AtmosAlertsComputerBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private AtmosAlertsComputerWindow? _menu;

public AtmosAlertsComputerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { }

protected override void Open()
{
_menu = new AtmosAlertsComputerWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;

EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

var castState = (AtmosAlertsComputerBoundInterfaceState) state;

if (castState == null)
return;

EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu?.UpdateUI(xform?.Coordinates, castState.AirAlarms, castState.FireAlarms, castState.FocusData);
}

public void SendFocusChangeMessage(NetEntity? netEntity)
{
SendMessage(new AtmosAlertsComputerFocusChangeMessage(netEntity));
}

public void SendDeviceSilencedMessage(NetEntity netEntity, bool silenceDevice)
{
SendMessage(new AtmosAlertsComputerDeviceSilencedMessage(netEntity, silenceDevice));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

_menu?.Dispose();
}
}
Loading
Loading