Cyborg health alert and damage examining (#20084)
* Option for alt health alert and no overlay * Fancy borg health indicator * Borg damage examine localization * EENENGHHHH ENNNGHHH * Requested code changes * Legal sound * Revert "Legal sound" This reverts commit 35715c88898aeb78dfe800319852c230395fdd7e. I misunderstood what Sloth meant * Annoying buzzer is back
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Content.Client.Alerts;
|
using Content.Client.Alerts;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
@@ -79,9 +79,15 @@ public sealed class DamageOverlayUiController : UIController
|
|||||||
damageable == null && !EntityManager.TryGetComponent(entity, out damageable))
|
damageable == null && !EntityManager.TryGetComponent(entity, out damageable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if (!_mobThresholdSystem.TryGetIncapThreshold(entity, out var foundThreshold, thresholds))
|
if (!_mobThresholdSystem.TryGetIncapThreshold(entity, out var foundThreshold, thresholds))
|
||||||
return; //this entity cannot die or crit!!
|
return; //this entity cannot die or crit!!
|
||||||
|
|
||||||
|
if (!thresholds.ShowOverlays)
|
||||||
|
{
|
||||||
|
ClearOverlay();
|
||||||
|
return; //this entity intentionally has no overlays
|
||||||
|
}
|
||||||
|
|
||||||
var critThreshold = foundThreshold.Value;
|
var critThreshold = foundThreshold.Value;
|
||||||
_overlay.State = mobState.CurrentState;
|
_overlay.State = mobState.CurrentState;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ namespace Content.Shared.Alert
|
|||||||
Debug4,
|
Debug4,
|
||||||
Debug5,
|
Debug5,
|
||||||
Debug6,
|
Debug6,
|
||||||
SuitPower
|
SuitPower,
|
||||||
|
BorgHealth
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.Alert;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -9,7 +10,7 @@ namespace Content.Shared.Mobs.Components;
|
|||||||
[Access(typeof(MobThresholdSystem))]
|
[Access(typeof(MobThresholdSystem))]
|
||||||
public sealed partial class MobThresholdsComponent : Component
|
public sealed partial class MobThresholdsComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("thresholds", required:true)]
|
[DataField("thresholds", required: true)]
|
||||||
public SortedDictionary<FixedPoint2, MobState> Thresholds = new();
|
public SortedDictionary<FixedPoint2, MobState> Thresholds = new();
|
||||||
|
|
||||||
[DataField("triggersAlerts")]
|
[DataField("triggersAlerts")]
|
||||||
@@ -18,6 +19,24 @@ public sealed partial class MobThresholdsComponent : Component
|
|||||||
[DataField("currentThresholdState")]
|
[DataField("currentThresholdState")]
|
||||||
public MobState CurrentThresholdState;
|
public MobState CurrentThresholdState;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The health alert that should be displayed for player controlled entities.
|
||||||
|
/// Used for alternate health alerts (silicons, for example)
|
||||||
|
/// </summary>
|
||||||
|
[DataField("stateAlertDict")]
|
||||||
|
public Dictionary<MobState, AlertType> StateAlertDict = new()
|
||||||
|
{
|
||||||
|
{MobState.Alive, AlertType.HumanHealth},
|
||||||
|
{MobState.Critical, AlertType.HumanCrit},
|
||||||
|
{MobState.Dead, AlertType.HumanDead},
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether or not this entity should display damage overlays (robots don't feel pain, black out etc.)
|
||||||
|
/// </summary>
|
||||||
|
[DataField("showOverlays")]
|
||||||
|
public bool ShowOverlays = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not this entity can be revived out of a dead state.
|
/// Whether or not this entity can be revived out of a dead state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -34,13 +53,25 @@ public sealed class MobThresholdsComponentState : ComponentState
|
|||||||
|
|
||||||
public MobState CurrentThresholdState;
|
public MobState CurrentThresholdState;
|
||||||
|
|
||||||
|
public Dictionary<MobState, AlertType> StateAlertDict = new()
|
||||||
|
{
|
||||||
|
{MobState.Alive, AlertType.HumanHealth},
|
||||||
|
{MobState.Critical, AlertType.HumanCrit},
|
||||||
|
{MobState.Dead, AlertType.HumanDead},
|
||||||
|
};
|
||||||
|
|
||||||
|
public bool ShowOverlays;
|
||||||
|
|
||||||
public bool AllowRevives;
|
public bool AllowRevives;
|
||||||
|
|
||||||
public MobThresholdsComponentState(Dictionary<FixedPoint2, MobState> unsortedThresholds, bool triggersAlerts, MobState currentThresholdState, bool allowRevives)
|
public MobThresholdsComponentState(Dictionary<FixedPoint2, MobState> unsortedThresholds, bool triggersAlerts, MobState currentThresholdState,
|
||||||
|
Dictionary<MobState, AlertType> stateAlertDict, bool showOverlays, bool allowRevives)
|
||||||
{
|
{
|
||||||
UnsortedThresholds = unsortedThresholds;
|
UnsortedThresholds = unsortedThresholds;
|
||||||
TriggersAlerts = triggersAlerts;
|
TriggersAlerts = triggersAlerts;
|
||||||
CurrentThresholdState = currentThresholdState;
|
CurrentThresholdState = currentThresholdState;
|
||||||
|
StateAlertDict = stateAlertDict;
|
||||||
|
ShowOverlays = showOverlays;
|
||||||
AllowRevives = allowRevives;
|
AllowRevives = allowRevives;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.Mobs.Systems;
|
namespace Content.Shared.Mobs.Systems;
|
||||||
|
|
||||||
@@ -34,6 +35,8 @@ public sealed class MobThresholdSystem : EntitySystem
|
|||||||
args.State = new MobThresholdsComponentState(thresholds,
|
args.State = new MobThresholdsComponentState(thresholds,
|
||||||
component.TriggersAlerts,
|
component.TriggersAlerts,
|
||||||
component.CurrentThresholdState,
|
component.CurrentThresholdState,
|
||||||
|
component.StateAlertDict,
|
||||||
|
component.ShowOverlays,
|
||||||
component.AllowRevives);
|
component.AllowRevives);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,28 +344,37 @@ public sealed class MobThresholdSystem : EntitySystem
|
|||||||
if (!threshold.TriggersAlerts)
|
if (!threshold.TriggersAlerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var dict = threshold.StateAlertDict;
|
||||||
|
var healthAlert = AlertType.HumanHealth;
|
||||||
|
var critAlert = AlertType.HumanCrit;
|
||||||
|
var deadAlert = AlertType.HumanDead;
|
||||||
|
|
||||||
|
dict.TryGetValue(MobState.Alive, out healthAlert);
|
||||||
|
dict.TryGetValue(MobState.Critical, out critAlert);
|
||||||
|
dict.TryGetValue(MobState.Dead, out deadAlert);
|
||||||
|
|
||||||
switch (currentMobState)
|
switch (currentMobState)
|
||||||
{
|
{
|
||||||
case MobState.Alive:
|
case MobState.Alive:
|
||||||
{
|
{
|
||||||
var severity = _alerts.GetMinSeverity(AlertType.HumanHealth);
|
var severity = _alerts.GetMinSeverity(healthAlert);
|
||||||
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(healthAlert));
|
||||||
severity += _alerts.GetMinSeverity(AlertType.HumanHealth);
|
severity += _alerts.GetMinSeverity(healthAlert);
|
||||||
}
|
}
|
||||||
_alerts.ShowAlert(target, AlertType.HumanHealth, severity);
|
_alerts.ShowAlert(target, healthAlert, severity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MobState.Critical:
|
case MobState.Critical:
|
||||||
{
|
{
|
||||||
_alerts.ShowAlert(target, AlertType.HumanCrit);
|
_alerts.ShowAlert(target, critAlert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MobState.Dead:
|
case MobState.Dead:
|
||||||
{
|
{
|
||||||
_alerts.ShowAlert(target, AlertType.HumanDead);
|
_alerts.ShowAlert(target, deadAlert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MobState.Invalid:
|
case MobState.Invalid:
|
||||||
|
|||||||
@@ -41,4 +41,9 @@
|
|||||||
- files: ["timer.ogg"]
|
- files: ["timer.ogg"]
|
||||||
license: "CC-BY-SA-3.0"
|
license: "CC-BY-SA-3.0"
|
||||||
copyright: "Taken from /tg/station"
|
copyright: "Taken from /tg/station"
|
||||||
source: "https://github.com/tgstation/tgstation/blob/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0/sound/items/timer.ogg"
|
source: "https://github.com/tgstation/tgstation/blob/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0/sound/items/timer.ogg"
|
||||||
|
|
||||||
|
- files: ["warning_buzzer.ogg"]
|
||||||
|
license: "CC-BY-SA-3.0"
|
||||||
|
copyright: "Taken from TG station."
|
||||||
|
source: "https://github.com/tgstation/tgstation/blob/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0/sound/machines/warning-buzzer.ogg"
|
||||||
BIN
Resources/Audio/Machines/warning_buzzer.ogg
Normal file
BIN
Resources/Audio/Machines/warning_buzzer.ogg
Normal file
Binary file not shown.
@@ -0,0 +1,18 @@
|
|||||||
|
health-examinable-silicon-none = There is no obvious damage to be seen.
|
||||||
|
|
||||||
|
health-examinable-silicon-Blunt-25 = [color=red]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } minor dents on { POSS-ADJ($target) } chassis.[/color]
|
||||||
|
health-examinable-silicon-Blunt-50 = [color=crimson]{ CAPITALIZE(POSS-ADJ($target)) } chassis is severely dented![/color]
|
||||||
|
health-examinable-silicon-Blunt-75 = [color=crimson]{ CAPITALIZE(POSS-ADJ($target)) } chassis is almost completely caved in![/color]
|
||||||
|
|
||||||
|
health-examinable-silicon-Slash-10 = [color=red]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } some minor scratches.[/color]
|
||||||
|
health-examinable-silicon-Slash-25 = [color=red]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } significant scratches on { POSS-ADJ($target) } chassis.[/color]
|
||||||
|
health-examinable-silicon-Slash-50 = [color=crimson]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } major gashes across { POSS-ADJ($target) } plating![/color]
|
||||||
|
health-examinable-silicon-Slash-75 = [color=crimson]{ CAPITALIZE(POSS-ADJ($target)) } chassis is torn up![/color]
|
||||||
|
|
||||||
|
health-examinable-silicon-Piercing-50 = [color=crimson]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } large holes all over { POSS-ADJ($target) } chassis![/color]
|
||||||
|
|
||||||
|
health-examinable-silicon-Heat-25 = [color=orange]{ CAPITALIZE(SUBJECT($target)) } { CONJUGATE-HAVE($target) } superficial burns across { POSS-ADJ($target) } chassis.[/color]
|
||||||
|
health-examinable-silicon-Heat-50 = [color=orange]{ CAPITALIZE(POSS-ADJ($target)) } chassis is significantly charred.[/color]
|
||||||
|
health-examinable-silicon-Heat-75 = [color=orange]{ CAPITALIZE(POSS-ADJ($target)) } chassis is partially melted![/color]
|
||||||
|
|
||||||
|
health-examinable-silicon-Shock-50 = [color=lightgoldenrodyellow]{ CAPITALIZE(POSS-ADJ($target)) } circuits seem partially fried![/color]
|
||||||
@@ -178,6 +178,25 @@
|
|||||||
minSeverity: 0
|
minSeverity: 0
|
||||||
maxSeverity: 4
|
maxSeverity: 4
|
||||||
|
|
||||||
|
- type: alert
|
||||||
|
id: BorgHealth
|
||||||
|
category: Health
|
||||||
|
icons:
|
||||||
|
- sprite: /Textures/Interface/Alerts/borg_alive.rsi
|
||||||
|
state: health0
|
||||||
|
- sprite: /Textures/Interface/Alerts/borg_alive.rsi
|
||||||
|
state: health1
|
||||||
|
- sprite: /Textures/Interface/Alerts/borg_alive.rsi
|
||||||
|
state: health2
|
||||||
|
- sprite: /Textures/Interface/Alerts/borg_alive.rsi
|
||||||
|
state: health3
|
||||||
|
- sprite: /Textures/Interface/Alerts/borg_alive.rsi
|
||||||
|
state: health4
|
||||||
|
name: alerts-health-name
|
||||||
|
description: alerts-health-desc
|
||||||
|
minSeverity: 0
|
||||||
|
maxSeverity: 4
|
||||||
|
|
||||||
- type: alert
|
- type: alert
|
||||||
id: BorgBattery
|
id: BorgBattery
|
||||||
category: Battery
|
category: Battery
|
||||||
|
|||||||
@@ -48,6 +48,18 @@
|
|||||||
- type: MobThresholds
|
- type: MobThresholds
|
||||||
thresholds:
|
thresholds:
|
||||||
0: Alive
|
0: Alive
|
||||||
|
100: Dead
|
||||||
|
stateAlertDict:
|
||||||
|
Alive: BorgHealth
|
||||||
|
showOverlays: false
|
||||||
|
- type: HealthExaminable
|
||||||
|
examinableTypes:
|
||||||
|
- Blunt
|
||||||
|
- Slash
|
||||||
|
- Piercing
|
||||||
|
- Heat
|
||||||
|
- Shock
|
||||||
|
locPrefix: silicon
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SiliconLawsUiKey.Key
|
- key: enum.SiliconLawsUiKey.Key
|
||||||
@@ -124,6 +136,15 @@
|
|||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
- type: Destructible
|
- type: Destructible
|
||||||
thresholds:
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 50
|
||||||
|
behaviors:
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Machines/warning_buzzer.ogg
|
||||||
|
params:
|
||||||
|
volume: 5
|
||||||
- trigger:
|
- trigger:
|
||||||
!type:DamageTrigger
|
!type:DamageTrigger
|
||||||
damage: 100
|
damage: 100
|
||||||
|
|||||||
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png
Normal file
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 331 B |
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png
Normal file
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 351 B |
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png
Normal file
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 379 B |
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png
Normal file
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png
Normal file
BIN
Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 484 B |
26
Resources/Textures/Interface/Alerts/borg_alive.rsi/meta.json
Normal file
26
Resources/Textures/Interface/Alerts/borg_alive.rsi/meta.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Original from https://github.com/tgstation/tgstation/blob/42ebbb4202b472cf94561974a30e00a0b00e11bc/icons/mob/screen1_robot.dmi, edited by @Doru991",
|
||||||
|
"size": {
|
||||||
|
"x": 32,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "health0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "health1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "health2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "health3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "health4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user