fish-station/Content.Client/_Sunrise/DamageOverlay/DamageOverlaySystem.cs
ThereDrD d07cbcda6e
Красивые циферки урона (#993)
* damage overlay refactor: new visuals and ignored damage types feature

* remove unused popup types

* add horizontal direction movement

* fix default popup type

* fix fix

* fix fix fix

* add damage overlay to structures

* comments + better implementation

* add ui dropdown option

* better values

* fix missing disabled sessions check

* asdasdadasd new commit on my pr

* ЧЕ БЛЯДЬ СЛОЖНО ДА

* ы

---------

Co-authored-by: Vigers Ray <vigersray@gmail.com>
2025-01-05 14:51:20 +03:00

36 lines
1.4 KiB
C#

using Content.Shared._Sunrise.DamageOverlay;
using Content.Shared._Sunrise.SunriseCCVars;
using Robust.Shared.Configuration;
namespace Content.Client._Sunrise.DamageOverlay;
public sealed class DamageOverlaySystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
public override void Initialize()
{
base.Initialize();
_cfg.OnValueChanged(SunriseCCVars.DamageOverlayEnable, OnDamageOverlayOptionChanged, true);
_cfg.OnValueChanged(SunriseCCVars.DamageOverlaySelf, OnDamageOverlayOptionChanged, true);
_cfg.OnValueChanged(SunriseCCVars.DamageOverlayStructures, OnDamageOverlayOptionChanged, true);
}
public override void Shutdown()
{
base.Shutdown();
_cfg.UnsubValueChanged(SunriseCCVars.DamageOverlayEnable, OnDamageOverlayOptionChanged);
_cfg.UnsubValueChanged(SunriseCCVars.DamageOverlaySelf, OnDamageOverlayOptionChanged);
_cfg.UnsubValueChanged(SunriseCCVars.DamageOverlayStructures, OnDamageOverlayOptionChanged);
}
private void OnDamageOverlayOptionChanged(bool option)
{
var enable = _cfg.GetCVar(SunriseCCVars.DamageOverlayEnable);
var enableSelf = _cfg.GetCVar(SunriseCCVars.DamageOverlaySelf);
var enableStructures = _cfg.GetCVar(SunriseCCVars.DamageOverlayStructures);
RaiseNetworkEvent(new DamageOverlayOptionEvent(enable, enableSelf, enableStructures));
}
}