From 2e0121b21e6f5484df0e364dd32d3b08653ec004 Mon Sep 17 00:00:00 2001 From: Jezithyr Date: Sat, 14 Jan 2023 23:52:20 -0800 Subject: [PATCH] Fixing health alerts not properly updating when players are damaged (#13480) --- Content.Shared/Alert/AlertsSystem.cs | 2 +- .../Mobs/Systems/MobThresholdSystem.cs | 2 - Resources/Prototypes/Alerts/alerts.yml | 28 ++--- .../health0.png} | Bin .../health1.png} | Bin .../health2.png} | Bin .../health3.png} | Bin .../health4.png} | Bin .../meta.json | 107 +----------------- .../critical.png} | Bin .../Alerts/human_critical.rsi/meta.json | 46 ++++++++ .../health7.png => human_dead.rsi/dead.png} | Bin .../Interface/Alerts/human_dead.rsi/meta.json | 46 ++++++++ .../Alerts/human_health.rsi/health0.png | Bin 2311 -> 0 bytes 14 files changed, 105 insertions(+), 126 deletions(-) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health1.png => human_alive.rsi/health0.png} (100%) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health2.png => human_alive.rsi/health1.png} (100%) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health3.png => human_alive.rsi/health2.png} (100%) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health4.png => human_alive.rsi/health3.png} (100%) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health5.png => human_alive.rsi/health4.png} (100%) rename Resources/Textures/Interface/Alerts/{human_health.rsi => human_alive.rsi}/meta.json (64%) rename Resources/Textures/Interface/Alerts/{human_health.rsi/health6.png => human_critical.rsi/critical.png} (100%) create mode 100644 Resources/Textures/Interface/Alerts/human_critical.rsi/meta.json rename Resources/Textures/Interface/Alerts/{human_health.rsi/health7.png => human_dead.rsi/dead.png} (100%) create mode 100644 Resources/Textures/Interface/Alerts/human_dead.rsi/meta.json delete mode 100644 Resources/Textures/Interface/Alerts/human_health.rsi/health0.png diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index e2a2924630..8f780af46e 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -19,7 +19,7 @@ public abstract class AlertsSystem : EntitySystem public short GetSeverityRange(AlertType alertType) { var minSeverity = _typeToAlert[alertType].MinSeverity; - return (short)MathF.Min(minSeverity,_typeToAlert[alertType].MaxSeverity - minSeverity); + return (short)MathF.Max(minSeverity,_typeToAlert[alertType].MaxSeverity - minSeverity); } public short GetMaxSeverity(AlertType alertType) diff --git a/Content.Shared/Mobs/Systems/MobThresholdSystem.cs b/Content.Shared/Mobs/Systems/MobThresholdSystem.cs index 68583f5b81..c84fd097d9 100644 --- a/Content.Shared/Mobs/Systems/MobThresholdSystem.cs +++ b/Content.Shared/Mobs/Systems/MobThresholdSystem.cs @@ -301,8 +301,6 @@ public sealed class MobThresholdSystem : EntitySystem var severity = _alerts.GetMinSeverity(AlertType.HumanHealth); if (TryGetIncapPercentage(target, damageable.TotalDamage, out var percentage)) { - - severity = (short) MathF.Floor(percentage.Value.Float() * _alerts.GetSeverityRange(AlertType.HumanHealth)); severity += _alerts.GetMinSeverity(AlertType.HumanHealth); diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 218a583241..4a96d7a257 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -142,8 +142,8 @@ id: HumanCrit category: Health icons: - - sprite: /Textures/Interface/Alerts/human_health.rsi - state: health6 + - sprite: /Textures/Interface/Alerts/human_critical.rsi + state: critical name: alerts-crit-name description: alerts-crit-desc @@ -151,8 +151,8 @@ id: HumanDead category: Health icons: - - sprite: /Textures/Interface/Alerts/human_health.rsi - state: health7 + - sprite: /Textures/Interface/Alerts/human_dead.rsi + state: dead name: alerts-dead-name description: alerts-dead-desc @@ -160,26 +160,20 @@ id: HumanHealth category: Health icons: - - sprite: /Textures/Interface/Alerts/human_health.rsi + - sprite: /Textures/Interface/Alerts/human_alive.rsi state: health0 - - sprite: /Textures/Interface/Alerts/human_health.rsi + - sprite: /Textures/Interface/Alerts/human_alive.rsi state: health1 - - sprite: /Textures/Interface/Alerts/human_health.rsi + - sprite: /Textures/Interface/Alerts/human_alive.rsi state: health2 - - sprite: /Textures/Interface/Alerts/human_health.rsi + - sprite: /Textures/Interface/Alerts/human_alive.rsi state: health3 - - sprite: /Textures/Interface/Alerts/human_health.rsi + - sprite: /Textures/Interface/Alerts/human_alive.rsi state: health4 - - sprite: /Textures/Interface/Alerts/human_health.rsi - state: health5 - - sprite: /Textures/Interface/Alerts/human_health.rsi - state: health6 - - sprite: /Textures/Interface/Alerts/human_health.rsi - state: health7 name: alerts-health-name description: alerts-health-desc - minSeverity: 1 - maxSeverity: 6 + minSeverity: 0 + maxSeverity: 4 - type: alert id: Internals diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health1.png b/Resources/Textures/Interface/Alerts/human_alive.rsi/health0.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health1.png rename to Resources/Textures/Interface/Alerts/human_alive.rsi/health0.png diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health2.png b/Resources/Textures/Interface/Alerts/human_alive.rsi/health1.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health2.png rename to Resources/Textures/Interface/Alerts/human_alive.rsi/health1.png diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health3.png b/Resources/Textures/Interface/Alerts/human_alive.rsi/health2.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health3.png rename to Resources/Textures/Interface/Alerts/human_alive.rsi/health2.png diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health4.png b/Resources/Textures/Interface/Alerts/human_alive.rsi/health3.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health4.png rename to Resources/Textures/Interface/Alerts/human_alive.rsi/health3.png diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health5.png b/Resources/Textures/Interface/Alerts/human_alive.rsi/health4.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health5.png rename to Resources/Textures/Interface/Alerts/human_alive.rsi/health4.png diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/meta.json b/Resources/Textures/Interface/Alerts/human_alive.rsi/meta.json similarity index 64% rename from Resources/Textures/Interface/Alerts/human_health.rsi/meta.json rename to Resources/Textures/Interface/Alerts/human_alive.rsi/meta.json index 4a0b50c61d..3c954ddfdc 100644 --- a/Resources/Textures/Interface/Alerts/human_health.rsi/meta.json +++ b/Resources/Textures/Interface/Alerts/human_alive.rsi/meta.json @@ -181,111 +181,6 @@ 0.05 ] ] - }, - { - "name": "health5", - "delays": [ - [ - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05 - ] - ] - }, - { - "name": "health6", - "delays": [ - [ - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05, - 0.05 - ] - ] - }, - { - "name": "health7", - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] } ] -} \ No newline at end of file +} diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health6.png b/Resources/Textures/Interface/Alerts/human_critical.rsi/critical.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health6.png rename to Resources/Textures/Interface/Alerts/human_critical.rsi/critical.png diff --git a/Resources/Textures/Interface/Alerts/human_critical.rsi/meta.json b/Resources/Textures/Interface/Alerts/human_critical.rsi/meta.json new file mode 100644 index 0000000000..3cd822ca20 --- /dev/null +++ b/Resources/Textures/Interface/Alerts/human_critical.rsi/meta.json @@ -0,0 +1,46 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "https://github.com/tgstation/tgstation/commits/50689f89a40e5e7a2732a0c5fb38c787b69f7d28/icons/hud/screen_gen.dmi", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "critical", + "delays": [ + [ + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05 + ] + ] + } + ] +} diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health7.png b/Resources/Textures/Interface/Alerts/human_dead.rsi/dead.png similarity index 100% rename from Resources/Textures/Interface/Alerts/human_health.rsi/health7.png rename to Resources/Textures/Interface/Alerts/human_dead.rsi/dead.png diff --git a/Resources/Textures/Interface/Alerts/human_dead.rsi/meta.json b/Resources/Textures/Interface/Alerts/human_dead.rsi/meta.json new file mode 100644 index 0000000000..a2fbd00aa1 --- /dev/null +++ b/Resources/Textures/Interface/Alerts/human_dead.rsi/meta.json @@ -0,0 +1,46 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "https://github.com/tgstation/tgstation/commits/50689f89a40e5e7a2732a0c5fb38c787b69f7d28/icons/hud/screen_gen.dmi", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "dead", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + } + ] +} diff --git a/Resources/Textures/Interface/Alerts/human_health.rsi/health0.png b/Resources/Textures/Interface/Alerts/human_health.rsi/health0.png deleted file mode 100644 index 00b1893f179b793d98eb78d29d64f71725f53808..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2311 zcmbuB`#+T19>(z7?R6q7|e_@^UOTYd4|2u{sYbr>-&9PYpvIMUhDJzURJ^hH>dS# ze^XOXP+0Hc?C6g8N62VWU4z)zA1_5CZf&UZ*$4#%jd${a$}rd1te~J;>*DBe>e_?Z zJRoqhi$c6jY5}AUIu1A8D{A?Z~CI#r>owY+LtoAM^jzV8h!a~L+twu4?~Z* zQ_N`qmI}3&gc*;N2shZo2oX;uJv{zmFf3)U> zZDk;xy^F55VL5(`w-1%I_`Zni(nQcFFnm+rDl3~kGkxSqK0S)fq;JwJj3lgk=%vTG zX#qJbpG7$wnO9cN;g}JVmg6~?`&3URi96e}$a>@Y%@hTP%Hm{bhE;f9>PxJ(s@4W+ zi%`cHQ7aW=yxKV20bOaC&XX`lOGO>-6<%&T4 z5?OLxSfN1YbmwKgn!@11^+(HD+aeXPZty+^q6FbbZ}xo&vLSa}$PUZ#!7LzH-%NIh zH6B+wYkjoZ`b3(lv}G|uZ%v_N4i(~hPzgjz#ai9)W2qaZV(`}rYKMm*B$eqa(b6ZB z>lq9NJR#@|w_>HtPL@5%moW_Vdxbw}uC> z|4Q`0LSdlo8o64&T|;aYTONvPGtZN~tF&qa4(Pdb6A z8=t_iY^qTl-Uu3i*ujuxe_F{}aqgmbB?4DMT`nS@u}?jKwKxc@w;Otr+`$gW-7_RW zSu^t-$-j;U-GboY#%!j)W%B3ttQVMNVfZ*bukqiLA0A_-A4V3j@tmclsdh*fwYZ-k zyLtvklYv=jysv>VV6N?*85}oO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