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
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
namespace Content.Shared.Light.Components;
|
2022-01-19 11:18:16 +13:00
|
|
|
|
|
|
|
|
/// <summary>
|
2022-03-30 18:57:35 +13:00
|
|
|
/// 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>
|
2022-03-30 18:57:35 +13:00
|
|
|
/// <remarks>
|
|
|
|
|
/// Networked ~~solely for admemes~~ for completely legitimate reasons, like hacked energy swords.
|
|
|
|
|
/// </remarks>
|
2023-09-04 06:31:10 +01:00
|
|
|
[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>
|
2022-03-30 18:57:35 +13:00
|
|
|
/// 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;
|
|
|
|
|
|
2022-03-30 18:57:35 +13:00
|
|
|
/// <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;
|
2022-03-30 18:57:35 +13:00
|
|
|
|
|
|
|
|
/// <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;
|
2022-03-30 18:57:35 +13:00
|
|
|
|
|
|
|
|
/// <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]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class RgbLightControllerState : ComponentState
|
2022-01-19 11:18:16 +13:00
|
|
|
{
|
|
|
|
|
public readonly float CycleRate;
|
2022-03-30 18:57:35 +13:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|