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)
{
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)

View File

@@ -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);

View File

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

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
]
]
},
{
"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