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,10 +1,11 @@
|
||||
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;
|
||||
|
||||
@@ -34,6 +35,8 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
args.State = new MobThresholdsComponentState(thresholds,
|
||||
component.TriggersAlerts,
|
||||
component.CurrentThresholdState,
|
||||
component.StateAlertDict,
|
||||
component.ShowOverlays,
|
||||
component.AllowRevives);
|
||||
}
|
||||
|
||||
@@ -341,28 +344,37 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user