-using Content.Client.Alerts;
+using Content.Client.Alerts;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs;
damageable == null && !EntityManager.TryGetComponent(entity, out damageable))
return;
-
if (!_mobThresholdSystem.TryGetIncapThreshold(entity, out var foundThreshold, thresholds))
return; //this entity cannot die or crit!!
+
+ if (!thresholds.ShowOverlays)
+ {
+ ClearOverlay();
+ return; //this entity intentionally has no overlays
+ }
+
var critThreshold = foundThreshold.Value;
_overlay.State = mobState.CurrentState;
Debug4,
Debug5,
Debug6,
- SuitPower
+ SuitPower,
+ BorgHealth
}
}
-using Content.Shared.FixedPoint;
+using Content.Shared.Alert;
+using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
[Access(typeof(MobThresholdSystem))]
public sealed partial class MobThresholdsComponent : Component
{
- [DataField("thresholds", required:true)]
+ [DataField("thresholds", required: true)]
public SortedDictionary<FixedPoint2, MobState> Thresholds = new();
[DataField("triggersAlerts")]
[DataField("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>
/// Whether or not this entity can be revived out of a dead state.
/// </summary>
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 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;
TriggersAlerts = triggersAlerts;
CurrentThresholdState = currentThresholdState;
+ StateAlertDict = stateAlertDict;
+ ShowOverlays = showOverlays;
AllowRevives = allowRevives;
}
}
-using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.Alert;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Components;
using Robust.Shared.GameStates;
+using Robust.Shared.Utility;
namespace Content.Shared.Mobs.Systems;
args.State = new MobThresholdsComponentState(thresholds,
component.TriggersAlerts,
component.CurrentThresholdState,
+ component.StateAlertDict,
+ component.ShowOverlays,
component.AllowRevives);
}
if (!threshold.TriggersAlerts)
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)
{
case MobState.Alive:
{
- var severity = _alerts.GetMinSeverity(AlertType.HumanHealth);
+ var severity = _alerts.GetMinSeverity(healthAlert);
if (TryGetIncapPercentage(target, damageable.TotalDamage, out var percentage))
{
severity = (short) MathF.Floor(percentage.Value.Float() *
- _alerts.GetSeverityRange(AlertType.HumanHealth));
- severity += _alerts.GetMinSeverity(AlertType.HumanHealth);
+ _alerts.GetSeverityRange(healthAlert));
+ severity += _alerts.GetMinSeverity(healthAlert);
}
- _alerts.ShowAlert(target, AlertType.HumanHealth, severity);
+ _alerts.ShowAlert(target, healthAlert, severity);
break;
}
case MobState.Critical:
{
- _alerts.ShowAlert(target, AlertType.HumanCrit);
+ _alerts.ShowAlert(target, critAlert);
break;
}
case MobState.Dead:
{
- _alerts.ShowAlert(target, AlertType.HumanDead);
+ _alerts.ShowAlert(target, deadAlert);
break;
}
case MobState.Invalid:
- files: ["timer.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Taken from /tg/station"
- source: "https://github.com/tgstation/tgstation/blob/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0/sound/items/timer.ogg"
\ No newline at end of file
+ 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"
\ No newline at end of file
--- /dev/null
+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]
minSeverity: 0
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
id: BorgBattery
category: Battery
- type: MobThresholds
thresholds:
0: Alive
+ 100: Dead
+ stateAlertDict:
+ Alive: BorgHealth
+ showOverlays: false
+ - type: HealthExaminable
+ examinableTypes:
+ - Blunt
+ - Slash
+ - Piercing
+ - Heat
+ - Shock
+ locPrefix: silicon
- type: UserInterface
interfaces:
- key: enum.SiliconLawsUiKey.Key
damageContainer: Inorganic
- type: Destructible
thresholds:
+ - trigger:
+ !type:DamageTrigger
+ damage: 50
+ behaviors:
+ - !type:PlaySoundBehavior
+ sound:
+ path: /Audio/Machines/warning_buzzer.ogg
+ params:
+ volume: 5
- trigger:
!type:DamageTrigger
damage: 100
--- /dev/null
+{
+ "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"
+ }
+ ]
+}