mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Handle IPC charge icons client-side * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Yeag * Yeag² * Yeag³ --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using Content.Client.Alerts;
|
|
using Content.Shared._EE.Silicon.Components;
|
|
using Content.Shared._EE.Silicon.Systems;
|
|
|
|
namespace Content.Client._DV.Silicon.Charge;
|
|
|
|
public sealed class SiliconChargeSystem : SharedSiliconChargeSystem
|
|
{
|
|
[Dependency] private readonly ClientAlertsSystem _alerts = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SiliconComponent, ComponentInit>(OnSiliconInit);
|
|
SubscribeLocalEvent<SiliconComponent, SiliconChargeStateUpdateEvent>(OnSiliconChargeStateUpdate);
|
|
}
|
|
|
|
private void OnSiliconInit(EntityUid uid, SiliconComponent component, ComponentInit args)
|
|
{
|
|
if (!component.BatteryPowered)
|
|
return;
|
|
|
|
_alerts.ShowAlert(uid, component.BatteryAlert, component.ChargeState);
|
|
}
|
|
|
|
private void OnSiliconChargeStateUpdate(EntityUid uid, SiliconComponent component, SiliconChargeStateUpdateEvent ev)
|
|
{
|
|
_alerts.ShowAlert(uid, component.BatteryAlert, ev.ChargePercent);
|
|
}
|
|
}
|