ECS handheld lights (#5864)
This commit is contained in:
23
Content.Client/Light/HandheldLightSystem.cs
Normal file
23
Content.Client/Light/HandheldLightSystem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Client.Light.Components;
|
||||
using Content.Shared.Light.Component;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Light;
|
||||
|
||||
public sealed class HandheldLightSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<HandheldLightComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, HandheldLightComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not SharedHandheldLightComponent.HandheldLightComponentState state)
|
||||
return;
|
||||
|
||||
component.Level = state.Charge;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user