Files
tbd-station-14/Content.Client/Radiation/Systems/GeigerSystem.cs
c4llv07e 1b4373d567 Fix radiation sound not working (#18282)
* Fix radiation sound not working

Signed-off-by: c4llv07e <kseandi@gmail.com>

* Make Geiger sound local

Signed-off-by: c4llv07e <kseandi@gmail.com>

---------

Signed-off-by: c4llv07e <kseandi@gmail.com>
2023-07-25 18:35:19 -06:00

44 lines
1.4 KiB
C#

using Content.Client.Items;
using Content.Client.Radiation.UI;
using Content.Shared.Radiation.Components;
using Content.Shared.Radiation.Systems;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.GameStates;
using Robust.Shared.Player;
namespace Content.Client.Radiation.Systems;
public sealed class GeigerSystem : SharedGeigerSystem
{
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GeigerComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<GeigerComponent, ItemStatusCollectMessage>(OnGetStatusMessage);
}
private void OnHandleState(EntityUid uid, GeigerComponent component, ref ComponentHandleState args)
{
if (args.Current is not GeigerComponentState state)
return;
component.CurrentRadiation = state.CurrentRadiation;
component.DangerLevel = state.DangerLevel;
component.IsEnabled = state.IsEnabled;
component.User = state.User;
component.UiUpdateNeeded = true;
}
private void OnGetStatusMessage(EntityUid uid, GeigerComponent component, ItemStatusCollectMessage args)
{
if (!component.ShowControl)
return;
args.Controls.Add(new GeigerItemControl(component));
}
}