Fixing health alerts not properly updating when players are damaged (#13480)

This commit is contained in:
Jezithyr
2023-01-14 23:52:20 -08:00
committed by GitHub
parent 6b2a132ceb
commit 2e0121b21e
14 changed files with 105 additions and 126 deletions

View File

@@ -19,7 +19,7 @@ public abstract class AlertsSystem : EntitySystem
public short GetSeverityRange(AlertType alertType) public short GetSeverityRange(AlertType alertType)
{ {
var minSeverity = _typeToAlert[alertType].MinSeverity; 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) public short GetMaxSeverity(AlertType alertType)

View File

@@ -301,8 +301,6 @@ public sealed class MobThresholdSystem : EntitySystem
var severity = _alerts.GetMinSeverity(AlertType.HumanHealth); var severity = _alerts.GetMinSeverity(AlertType.HumanHealth);
if (TryGetIncapPercentage(target, damageable.TotalDamage, out var percentage)) if (TryGetIncapPercentage(target, damageable.TotalDamage, out var percentage))
{ {
severity = (short) MathF.Floor(percentage.Value.Float() * severity = (short) MathF.Floor(percentage.Value.Float() *
_alerts.GetSeverityRange(AlertType.HumanHealth)); _alerts.GetSeverityRange(AlertType.HumanHealth));
severity += _alerts.GetMinSeverity(AlertType.HumanHealth); severity += _alerts.GetMinSeverity(AlertType.HumanHealth);

View File

@@ -142,8 +142,8 @@
id: HumanCrit id: HumanCrit
category: Health category: Health
icons: icons:
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_critical.rsi
state: health6 state: critical
name: alerts-crit-name name: alerts-crit-name
description: alerts-crit-desc description: alerts-crit-desc
@@ -151,8 +151,8 @@
id: HumanDead id: HumanDead
category: Health category: Health
icons: icons:
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_dead.rsi
state: health7 state: dead
name: alerts-dead-name name: alerts-dead-name
description: alerts-dead-desc description: alerts-dead-desc
@@ -160,26 +160,20 @@
id: HumanHealth id: HumanHealth
category: Health category: Health
icons: icons:
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_alive.rsi
state: health0 state: health0
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_alive.rsi
state: health1 state: health1
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_alive.rsi
state: health2 state: health2
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_alive.rsi
state: health3 state: health3
- sprite: /Textures/Interface/Alerts/human_health.rsi - sprite: /Textures/Interface/Alerts/human_alive.rsi
state: health4 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 name: alerts-health-name
description: alerts-health-desc description: alerts-health-desc
minSeverity: 1 minSeverity: 0
maxSeverity: 6 maxSeverity: 4
- type: alert - type: alert
id: Internals id: Internals

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -181,111 +181,6 @@
0.05 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
]
]
} }
] ]
} }

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -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
]
]
}
]
}

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -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
]
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB