mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* AAAAAAAAadds skia * Added to the spawn options table * Fix EOR, Added shatter ability, Fix Reroll popup * Fixed the death of the Skia * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed taco's silly mistake * Skia need pry-ability * Adds Goob Nightvision * Added some missing Protos * Appease the Yaml gods * Did the Delta Fixes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Lathes fix * Update attributions.yml * More yaml fixes * The Yaml Linter shall never be sated * More fixes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed objective reroll * Bring up to date * aaaaaaaaaaa * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed damageset, removed unneeded point light * I'm so sorry Deltandas * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: William Lemon <William.Lemon2@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
using Content.Client._DV.Light;
|
|
using Content.Shared._DV.Body;
|
|
using Content.Shared.Alert;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client._DV.Body;
|
|
|
|
public sealed class LightLevelHealthSystem : SharedLightLevelHealthSystem
|
|
{
|
|
[Dependency] private readonly AlertsSystem _alerts = default!;
|
|
[Dependency] private readonly IPlayerManager _player = default!;
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
[Dependency] private readonly LightReactiveSystem _lightReactive = default!;
|
|
|
|
private ProtoId<AlertPrototype> _lightLevelDarkIcon = "LightLevelDarkIcon";
|
|
private ProtoId<AlertPrototype> _lightLevelNeutralIcon = "LightLevelNeutralIcon";
|
|
private ProtoId<AlertPrototype> _lightLevelBrightIcon = "LightLevelBrightIcon";
|
|
private ProtoId<AlertCategoryPrototype> _lightAlertCategory = "Light";
|
|
|
|
private int _lastThreshold = 0;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
// If we're a LightLevelHealthComponent client, update our alerts.
|
|
if (_player.LocalSession?.AttachedEntity is not { } ent)
|
|
return;
|
|
|
|
if (!TryComp<LightLevelHealthComponent>(ent, out var lightLevelHealth))
|
|
return;
|
|
|
|
var currentThreshold = CurrentThreshold(_lightReactive.GetLightLevelForPoint(ent), lightLevelHealth);
|
|
var alertIcon = currentThreshold switch
|
|
{
|
|
-1 => _lightLevelDarkIcon,
|
|
1 => _lightLevelBrightIcon,
|
|
_ => _lightLevelNeutralIcon,
|
|
};
|
|
|
|
if (currentThreshold != _lastThreshold)
|
|
{
|
|
var alertCategory = _prototype.Index(_lightAlertCategory);
|
|
_alerts.ClearAlertCategory(ent, alertCategory);
|
|
}
|
|
_lastThreshold = currentThreshold;
|
|
|
|
var alertProto = _prototype.Index(alertIcon);
|
|
_alerts.ShowAlert(ent, alertProto);
|
|
}
|
|
}
|