Files
tbd-station-14/Content.Client/GameObjects/Components/ExpendableLightVisualizer.cs
nuke c3630b7301 Glowsticks, flares and lighting behaviours (#1886)
* Assets

* LightingBehaviours, flares, and such.

* More changes

* More changes, more flare work.

* More work on flares + light behaviours

* another refactor

* missed

* Light behaviours refactor, added sfx, improved graphics, improved lighting effects for glowstick and flare.

* remove unneeded value

* nullables

* remove old code

* nullable

* one last push

* net id

* more work

* more colors for glowsticks

* Adjust flare so it fades in

* fix name

* sprite fix
2020-09-03 22:02:40 +02:00

40 lines
1.2 KiB
C#

using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using System;
namespace Content.Client.GameObjects.Components
{
[UsedImplicitly]
public class ExpendableLightVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
if (component.TryGetData(ExpendableLightVisuals.State, out string lightBehaviourID))
{
if (component.Owner.TryGetComponent<LightBehaviourComponent>(out var lightBehaviour))
{
lightBehaviour.StopLightBehaviour();
if (lightBehaviourID != string.Empty)
{
lightBehaviour.StartLightBehaviour(lightBehaviourID);
}
else if (component.Owner.TryGetComponent<PointLightComponent>(out var light))
{
light.Enabled = false;
}
}
}
}
}
}