ECS handheld lights (#5864)

This commit is contained in:
metalgearsloth
2021-12-27 18:15:16 +11:00
committed by GitHub
parent b3b171da7f
commit 0705f16898
6 changed files with 325 additions and 321 deletions

View 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;
}
}