From 159f7192dfba973f303d8409af0f2ee5f0ba80ef Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 23 Dec 2020 23:46:01 +0100 Subject: [PATCH] Add alert for low oxygen. --- .../Components/Metabolism/MetabolismComponent.cs | 12 ++++++++++++ Content.Shared/Alert/AlertType.cs | 2 ++ Resources/Prototypes/Alerts/alerts.yml | 10 +++++++++- .../Interface/Alerts/breathing.rsi/meta.json | 1 + .../Alerts/breathing.rsi/not_enough_co2.png | Bin 0 -> 430 bytes .../Alerts/breathing.rsi/not_enough_nitro.png | Bin 0 -> 402 bytes .../Alerts/breathing.rsi/not_enough_oxy.png | Bin 0 -> 395 bytes .../Alerts/breathing.rsi/not_enough_tox.png | Bin 0 -> 568 bytes .../Alerts/breathing.rsi/too_much_co2.png | Bin 0 -> 428 bytes .../Alerts/breathing.rsi/too_much_nitro.png | Bin 0 -> 388 bytes .../Alerts/breathing.rsi/too_much_oxy.png | Bin 0 -> 392 bytes .../Alerts/breathing.rsi/too_much_tox.png | Bin 0 -> 542 bytes 12 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/meta.json create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_co2.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_nitro.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_oxy.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_tox.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/too_much_co2.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/too_much_nitro.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/too_much_oxy.png create mode 100644 Resources/Textures/Interface/Alerts/breathing.rsi/too_much_tox.png diff --git a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs index 775dfa8cb6..180e73897b 100644 --- a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs @@ -5,7 +5,9 @@ using System.Linq; using Content.Server.Atmos; using Content.Server.GameObjects.Components.Body.Behavior; using Content.Server.GameObjects.Components.Body.Circulatory; +using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Temperature; +using Content.Shared.Alert; using Content.Shared.Atmos; using Content.Shared.Chemistry; using Content.Shared.Damage; @@ -389,6 +391,11 @@ namespace Content.Server.GameObjects.Components.Metabolism { Suffocating = true; + if (Owner.TryGetComponent(out ServerAlertsComponent? alertsComponent)) + { + alertsComponent.ShowAlert(AlertType.LowOxygen); + } + if (!Owner.TryGetComponent(out IDamageableComponent? damageable)) { return; @@ -400,6 +407,11 @@ namespace Content.Server.GameObjects.Components.Metabolism private void StopSuffocation() { Suffocating = false; + + if (Owner.TryGetComponent(out ServerAlertsComponent? alertsComponent)) + { + alertsComponent.ClearAlert(AlertType.LowOxygen); + } } public GasMixture Clean(BloodstreamComponent bloodstream) diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index 8c2afb48d8..95da080a50 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -7,6 +7,7 @@ { Pressure, Temperature, + Breathing, Buckled, Health, Piloting, @@ -22,6 +23,7 @@ public enum AlertType : byte { Error, + LowOxygen, LowPressure, HighPressure, Fire, diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 326ef60494..a12d8ccca7 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -10,12 +10,20 @@ - alertType: Pulling - category: Piloting - alertType: Stun + - category: Breathing # Vox gang not calling this oxygen - category: Pressure - category: Temperature - category: Hunger - category: Thirst - +- type: alert + alertType: LowOxygen + category: Breathing + icon: + sprite: /Textures/Interface/Alerts/breathing.rsi + state: not_enough_oxy + name: "[color=red]Low Oxygen[/color]" + description: "There is not [color=red]not enough oxygen[/color] in the air you are breathing. Put on [color=green]internals[/color]." - type: alert alertType: LowPressure diff --git a/Resources/Textures/Interface/Alerts/breathing.rsi/meta.json b/Resources/Textures/Interface/Alerts/breathing.rsi/meta.json new file mode 100644 index 0000000000..704f119830 --- /dev/null +++ b/Resources/Textures/Interface/Alerts/breathing.rsi/meta.json @@ -0,0 +1 @@ +{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA 3.0", "copyright": "https://github.com/tgstation/tgstation/blob/2f18e6232ce5897554351194082469a043c5ab06/icons/hud/screen_alert.dmi", "states": [{"name": "not_enough_co2", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "not_enough_nitro", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "not_enough_oxy", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "not_enough_tox", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "too_much_co2", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "too_much_nitro", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "too_much_oxy", "directions": 1, "delays": [[0.5, 0.5]]}, {"name": "too_much_tox", "directions": 1, "delays": [[0.5, 0.5]]}]} \ No newline at end of file diff --git a/Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_co2.png b/Resources/Textures/Interface/Alerts/breathing.rsi/not_enough_co2.png new file mode 100644 index 0000000000000000000000000000000000000000..179f6ffc517b5abf4cccb5348d4b2900a60d9bb7 GIT binary patch literal 430 zcmV;f0a5;mP)_u|9L6# zwe+_dkOG`3;ETTM008Iqi0$_w_T!xxhW(TXh;D#r%HNBs!>I)dyvLTXLQh&L6}|?{ zMPGGn5dhqxfMpF>)8v7PDWLNjxX*2h-|TAisBvzOQBq(W%EK@>@uoHkP6NhoR1mz* z`K?|9{_YK}1gJMU=5@|f_ffE>02R(AUNj{(yBeq0538ULrcQo%?OS{$Uk79ZxCg+E zYykHFxRDL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