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 7/9 #1762

Merged
merged 133 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
74f8ce0
Remove always false checks (#31708)
Winkarst-cpu Sep 1, 2024
64fbd1d
Remove calls to FormattedMessage obsolete methods (#31706)
Winkarst-cpu Sep 1, 2024
f1530eb
remove misinformation from tip 26 (#31705)
Ilya246 Sep 1, 2024
5953ede
Automatic changelog update
PJBot Sep 1, 2024
db1ba0c
Replace obsolete code in AnomalySystem.Generator.cs (#31718)
Errant-4 Sep 1, 2024
61cc9a6
Added cursor indicator for space dragon fire breath ability (#31725)
godisdeadLOL Sep 1, 2024
c5e4707
Automatic changelog update
PJBot Sep 1, 2024
7420d48
small yml cleanup (#31720)
lzk228 Sep 1, 2024
3c36fa3
Updates descriptions of station specific jobs. (#31713)
Boaz1111 Sep 1, 2024
78eb844
Remove unused IoC dependency references. (#31704)
Mervill Sep 1, 2024
924ef34
cleanup filing cabinets yml (#31211)
lzk228 Sep 1, 2024
72fc223
Move IgnitionEvent to shared (#30985)
DrSmugleaf Sep 2, 2024
7d7d1a7
Cleanup railings yml (#31618)
lzk228 Sep 2, 2024
b223df5
Roundstart Grappling Gun (#31737)
EmoGarbage404 Sep 2, 2024
3fcf4d2
Automatic changelog update
PJBot Sep 2, 2024
da4e005
Added in-hand sprite for Smile the Slime (#31731)
godisdeadLOL Sep 2, 2024
52f4002
Lite Magnet Rebalancing (#31726)
EmoGarbage404 Sep 2, 2024
a933a32
unnerf fishops
Sep 7, 2024
50354e6
Devmap crew monitor fix (#31677)
Errant-4 Sep 2, 2024
2af1b3e
Automatic changelog update
PJBot Sep 2, 2024
727c614
Add ERT time stats (#31629)
poeMota Sep 2, 2024
8c349c4
Automatic changelog update
PJBot Sep 2, 2024
61e373e
Fix CS0642 - Possible mistaken empty statement (#31740)
Mervill Sep 2, 2024
58efbc0
Throw the book at em! The space law book now does 1 blunt projectile …
Moomoobeef Sep 2, 2024
d98555b
Replace instances of SolutionContainerSystem with SharedSolutionConta…
Cojoke-dot Sep 2, 2024
aeb2f75
Add Donk Co. microwave board to Combat Bakery Kit (#31239)
themias Sep 2, 2024
c81f1bc
Automatic changelog update
PJBot Sep 2, 2024
2bd20ac
Actions bar dynamic resizing (#31759)
godisdeadLOL Sep 2, 2024
574406d
Automatic changelog update
PJBot Sep 2, 2024
1ce9276
Fix warnings related to non-exhaustive pattern matching. (#31763)
Mervill Sep 2, 2024
c7b8ab1
ats update (#31766)
Emisse Sep 3, 2024
1802f5c
Ninja throwing star ability fix (#31684)
godisdeadLOL Sep 3, 2024
1dc25f0
Automatic changelog update
PJBot Sep 3, 2024
768cc21
Remove duplicate using from FoodSystem (#31769)
Mervill Sep 3, 2024
69e12da
vox voices revamp (#31679)
Errant-4 Sep 3, 2024
591f767
fixed broken pipe sprites (#31773)
Moomoobeef Sep 3, 2024
981a957
Return Long2 and Long3 hairstyles (#30963)
JustArt1m Sep 3, 2024
cef6df4
Automatic changelog update
PJBot Sep 3, 2024
0f0a3b6
Added many old ion lawsets for borgs and AI. (#31664)
ScarKy0 Sep 3, 2024
10a5e6a
Add Snails (#30765)
IProduceWidgets Sep 3, 2024
c05e7f5
Automatic changelog update
PJBot Sep 3, 2024
7889397
Remove testbed command (#31793)
metalgearsloth Sep 3, 2024
00dcbd3
feat: now when research is unlocked in console, approver of reasearch…
Fildrance Sep 3, 2024
0f5d2fa
Automatic changelog update
PJBot Sep 3, 2024
3c4c040
New chemical based artifact nodes (#30873)
Lyroth001 Sep 3, 2024
4e49bba
Automatic changelog update
PJBot Sep 3, 2024
d604008
Add Red Neck Gaiter To Secdrobe (#30106)
DieselMohawk Sep 3, 2024
461bc5f
Automatic changelog update
PJBot Sep 3, 2024
f34de9b
Fixed typos (#31811)
ScarKy0 Sep 3, 2024
01951ab
Automatic changelog update
PJBot Sep 3, 2024
f44c35f
Station AI has their name displayed in announcements now. (#31802)
ScarKy0 Sep 3, 2024
4777d34
Automatic changelog update
PJBot Sep 3, 2024
96079d8
Add disabled station anchors version (#31794)
lzk228 Sep 4, 2024
891bcc1
add structural damage taken to a lot of prototypes (#30790)
Ilya246 Sep 4, 2024
60d8f72
Automatic changelog update
PJBot Sep 4, 2024
6a634fc
No Mr.Snail, I expect you to die! (fix sprite) (#31834)
IProduceWidgets Sep 4, 2024
32cfd04
Allow some mobs to walk slowly (#31360)
lzk228 Sep 4, 2024
cfcc188
Automatic changelog update
PJBot Sep 4, 2024
cb027c2
Delete nonsense solar assembly construction through the Construction …
Hreno Sep 4, 2024
73ee308
Improvements to hand labeler UI (#31833)
eoineoineoin Sep 4, 2024
ef4d236
make tesla brighter (#31357)
qwerltaz Sep 4, 2024
98e1713
Automatic changelog update
PJBot Sep 4, 2024
6be80f5
CorrectContraband levels on each type of magboots (#30960)
TyAshley Sep 4, 2024
d4dc86f
Automatic changelog update
PJBot Sep 4, 2024
5da5a68
Morgue system refactor remove unused VVs and into Entity (#31835)
TokenStyle Sep 4, 2024
60f7246
Make midround zombie outbreaks much rarer (#30266)
Blackern5000 Sep 4, 2024
c92b0d9
Automatic changelog update
PJBot Sep 4, 2024
8ba7d38
Teleporting while pulling crash fix (#31787)
godisdeadLOL Sep 4, 2024
ea253f7
Automatic changelog update
PJBot Sep 4, 2024
87604b0
quietify stealthbox (#30741)
Ilya246 Sep 4, 2024
0eaf355
Automatic changelog update
PJBot Sep 4, 2024
2c12159
Atmospheric alerts computer (#25938)
chromiumboy Sep 5, 2024
8d4998b
Automatic changelog update
PJBot Sep 5, 2024
ba7a95c
Day 0 bug fix for atmos alerts computer (#31858)
chromiumboy Sep 5, 2024
cc830be
Basically every electronic device can now be used by the AI. (#31730)
ScarKy0 Sep 5, 2024
44206e5
Automatic changelog update
PJBot Sep 5, 2024
79e182d
Fix a typo in the 10 commandments (#31856)
Psychpsyo Sep 5, 2024
79b2a48
feat: #26107 uplink discounts for traitors (no nukies for now) (#26297)
Fildrance Sep 5, 2024
ebfa7de
Automatic changelog update
PJBot Sep 5, 2024
e0d78bc
Fixed AI Actions (#31823)
ScarKy0 Sep 5, 2024
55e4d53
Automatic changelog update
PJBot Sep 5, 2024
4d0c659
add wireless net to evac shuttles
ScarKy0 Sep 5, 2024
ddde558
Automatic changelog update
PJBot Sep 5, 2024
042fd7b
A kit to help new botanists discover chemistry (#31738)
drakewill-CRL Sep 5, 2024
3eeb067
Automatic changelog update
PJBot Sep 5, 2024
f20ae81
Board for the AI upload console (#31867)
Nimfar11 Sep 5, 2024
55c6d56
Automatic changelog update
PJBot Sep 5, 2024
2d19f13
Fix typo in agri-chem manual (#31869)
perryprog Sep 5, 2024
a8c83d7
Cleanup books.yml (#31838)
lzk228 Sep 6, 2024
f053f0b
Vox sign/N2 locker update (#31845)
PJB3005 Sep 6, 2024
dec6d59
Automatic changelog update
PJBot Sep 6, 2024
466320e
Pizza boxes now have a chance to contain cotton pizza (#31883)
Ekkosangen Sep 6, 2024
d104896
Automatic changelog update
PJBot Sep 6, 2024
bfe3025
Tech Anomaly (#31764)
TheShuEd Sep 6, 2024
720ebdc
Automatic changelog update
PJBot Sep 6, 2024
c0d5376
Fixed throngler name inconsistencies (#31889)
Chubbicous Sep 6, 2024
dc62a01
I have spent more time today cleaning up garbage than coding new shit…
PJB3005 Sep 6, 2024
3f418c7
Mineral Scanner (#31390)
EmoGarbage404 Sep 6, 2024
f782282
Automatic changelog update
PJBot Sep 6, 2024
a5af32d
Fix ai upload console itemslot whitelist (#31900)
lzk228 Sep 6, 2024
3a436d8
Automatic changelog update
PJBot Sep 6, 2024
142a669
improved vox laugh (#31798)
Errant-4 Sep 6, 2024
72c1a07
fix pump shotgun wielded sprite (#31885)
ps3moira Sep 6, 2024
8620384
fix: Snail event wasnt tabled (#31884)
IProduceWidgets Sep 6, 2024
ca3622a
Automatic changelog update
PJBot Sep 6, 2024
3eac1a4
Force stop pulling when fall asleep (#31893)
godisdeadLOL Sep 6, 2024
8589fd7
Automatic changelog update
PJBot Sep 6, 2024
ecd15e3
Energy Shotgun Change 2 - Narrow Nerf + instances from NoSpawn --> ca…
Boaz1111 Sep 7, 2024
ff2e718
Automatic changelog update
PJBot Sep 7, 2024
c61d84f
Add justice helm (#31905)
themias Sep 7, 2024
c814cd0
Automatic changelog update
PJBot Sep 7, 2024
e9d6aa9
Quiver Crafting Recipe (#27198)
FungiFellow Apr 26, 2024
30c9600
Delete RDs binary encryption key (#31909)
Futuristic-OK Sep 7, 2024
59a3c5d
undelete rd key
Sep 7, 2024
c7f09ad
Automatic changelog update
PJBot Sep 7, 2024
0d5a049
split temperature protection into heating and cooling (#30662)
EmoGarbage404 Sep 7, 2024
da7574f
update TemperatureProtection for stuff
Sep 7, 2024
81d0339
Automatic changelog update
PJBot Sep 7, 2024
7b1ffa4
makes the maple wing marking have a primary and a secondary color (#3…
Boaz1111 Sep 7, 2024
9b47871
Automatic changelog update
PJBot Sep 7, 2024
158b2e6
Remake bottles and syringes names to use labels (#29956)
lzk228 Sep 7, 2024
0368992
Automatic changelog update
PJBot Sep 7, 2024
3b6ec3b
guide on agrichem and botanicals guidebook update (#31896)
Ian321 Sep 7, 2024
2a1cc5c
Automatic changelog update
PJBot Sep 7, 2024
3d1f572
Automatic changelog update
PJBot Sep 7, 2024
6f658b7
Lost evac pod thing tiny fan (#31915)
Emisse Sep 7, 2024
1dee6a8
:trollface:
Sep 7, 2024
aae7d86
untroll
Sep 7, 2024
1e312b9
Ghostrole rule updates (#29249)
TsjipTsjip Jun 21, 2024
33a272b
:trollface:
Sep 7, 2024
9662668
:trollface:
Sep 7, 2024
2debf19
:trollface:
Sep 7, 2024
ae2e039
pro
Sep 8, 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
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Administration.Notes;
using Content.Shared.Administration.Notes;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
Expand All @@ -13,7 +13,7 @@ public AdminMessagePopupMessage(AdminMessageEuiState.Message message)
{
RobustXamlLoader.Load(this);

Admin.SetMessage(FormattedMessage.FromMarkup(Loc.GetString(
Admin.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString(
"admin-notes-message-admin",
("admin", message.AdminName),
("date", message.AddedOn.ToLocalTime()))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void SetState(AdminMessageEuiState state)
MessageContainer.AddChild(new AdminMessagePopupMessage(message));
}

Description.SetMessage(FormattedMessage.FromMarkup(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length))));
Description.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length))));
}

private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void ReceiveLine(SharedBwoinkSystem.BwoinkTextMessage message)
Unread++;

var formatted = new FormattedMessage(1);
formatted.AddMarkup($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}");
formatted.AddMarkupOrThrow($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}");
TextOutput.AddMessage(formatted);
LastMessage = message.SentAt;
}
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