Files
tbd-station-14/Content.Client/Radiation/Systems/GeigerSystem.cs

30 lines
910 B
C#

using Content.Client.Items;
using Content.Client.Radiation.UI;
using Content.Shared.Radiation.Components;
using Content.Shared.Radiation.Systems;
namespace Content.Client.Radiation.Systems;
public sealed class GeigerSystem : SharedGeigerSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GeigerComponent, AfterAutoHandleStateEvent>(OnHandleState);
SubscribeLocalEvent<GeigerComponent, ItemStatusCollectMessage>(OnGetStatusMessage);
}
private void OnHandleState(EntityUid uid, GeigerComponent component, ref AfterAutoHandleStateEvent args)
{
component.UiUpdateNeeded = true;
}
private void OnGetStatusMessage(EntityUid uid, GeigerComponent component, ItemStatusCollectMessage args)
{
if (!component.ShowControl)
return;
args.Controls.Add(new GeigerItemControl(component));
}
}