Files
OldThink/Content.Shared/Light/Components/RgbLightControllerComponent.cs

58 lines
1.9 KiB
C#
Raw Normal View History

2021-11-30 08:54:51 -06:00
using Robust.Shared.GameStates;
2022-01-19 11:18:16 +13:00
using Robust.Shared.Serialization;
2021-11-30 08:54:51 -06:00
namespace Content.Shared.Light.Components;
2022-01-19 11:18:16 +13:00
/// <summary>
/// Makes the color of lights on an entity fluctuate. Will update point-light color and modulate some or all of the
/// sprite layers. Will also modulate the color of any unshaded layers that this entity contributes to a wearer or holder.
2022-01-19 11:18:16 +13:00
/// </summary>
/// <remarks>
/// Networked ~~solely for admemes~~ for completely legitimate reasons, like hacked energy swords.
/// </remarks>
[NetworkedComponent, RegisterComponent, Access(typeof(SharedRgbLightControllerSystem))]
public sealed partial class RgbLightControllerComponent : Component
2021-11-30 08:54:51 -06:00
{
2022-01-19 11:18:16 +13:00
[DataField("cycleRate")]
public float CycleRate { get; set; } = 0.1f;
2021-11-30 08:54:51 -06:00
/// <summary>
/// What layers of the sprite to modulate? If null, will affect only unshaded layers.
2021-11-30 08:54:51 -06:00
/// </summary>
2022-01-19 11:18:16 +13:00
[DataField("layers")]
public List<int>? Layers;
/// <summary>
/// Original light color from befor the rgb was aded. Used to revert colors when removed.
/// </summary>
2022-01-19 11:18:16 +13:00
public Color OriginalLightColor;
/// <summary>
/// Original colors of the sprite layersfrom before the rgb was added. Used to revert colors when removed.
/// </summary>
2022-01-19 11:18:16 +13:00
public Dictionary<int, Color>? OriginalLayerColors;
/// <summary>
/// User that is holding or wearing this entity
/// </summary>
public EntityUid? Holder;
/// <summary>
/// List of unshaded layers on the holder/wearer that are being modulated.
/// </summary>
public List<string>? HolderLayers;
2022-01-19 11:18:16 +13:00
}
[Serializable, NetSerializable]
public sealed class RgbLightControllerState : ComponentState
2022-01-19 11:18:16 +13:00
{
public readonly float CycleRate;
public List<int>? Layers;
2021-11-30 08:54:51 -06:00
2022-01-19 11:18:16 +13:00
public RgbLightControllerState(float cycleRate, List<int>? layers)
{
CycleRate = cycleRate;
Layers = layers;
2021-11-30 08:54:51 -06:00
}
}