mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
* Sync PointLight data * ECS GetComponentState * Nothing to see here
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Robust.Shared.GameStates;
|
|
|
|
namespace Robust.Shared.GameObjects
|
|
{
|
|
public abstract class SharedPointLightSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<SharedPointLightComponent, ComponentGetState>(GetCompState);
|
|
SubscribeLocalEvent<SharedPointLightComponent, ComponentHandleState>(HandleCompState);
|
|
}
|
|
|
|
private void GetCompState(EntityUid uid, SharedPointLightComponent component, ref ComponentGetState args)
|
|
{
|
|
args.State = new PointLightComponentState(component.Enabled, component.Color, component.Radius, component.Offset);
|
|
}
|
|
|
|
private void HandleCompState(EntityUid uid, SharedPointLightComponent component, ref ComponentHandleState args)
|
|
{
|
|
if (args.Current is not PointLightComponentState newState) return;
|
|
component.Enabled = newState.Enabled;
|
|
component.Radius = newState.Radius;
|
|
component.Offset = newState.Offset;
|
|
component.Color = newState.Color;
|
|
}
|
|
}
|
|
}
|