Files
RobustToolbox/Robust.Shared/GameObjects/Systems/SharedPointLightSystem.cs
T
Matz05andGitHub 384f672eec Engine changes for more server-pushed lighting variables (#2367)
* Engine changes for more server-pushed lighting variables, but apparently this is a deprecated way of doing things anyway

* Removed two unecessary uses of virtual
2022-01-05 02:57:49 +11:00

31 lines
1.2 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, component.Energy, component.Softness);
}
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;
component.Energy = newState.Energy;
component.Softness = newState.Softness;
}
}
}