Extend RgbLightController (#6179)

This commit is contained in:
Leon Friedrich
2022-01-19 11:18:16 +13:00
committed by GitHub
parent b89557bb49
commit ac36f15a70
4 changed files with 189 additions and 21 deletions

View File

@@ -1,21 +1,48 @@
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
namespace Content.Shared.Light.Component
namespace Content.Shared.Light.Component;
/// <summary>
/// Networked ~~solely for admemes~~ for completely legitimate reasons, like hacked energy swords.
/// </summary>
[NetworkedComponent]
[RegisterComponent]
[ComponentProtoName("RgbLightController")]
[Friend(typeof(SharedRgbLightControllerSystem))]
public sealed class RgbLightControllerComponent : Robust.Shared.GameObjects.Component
{
/// <summary>
/// Networked solely for admemes.
/// </summary>
[NetworkedComponent]
[RegisterComponent]
public class RgbLightControllerComponent : Robust.Shared.GameObjects.Component
{
public override string Name => "RgbLightController";
[DataField("cycleRate")]
public float CycleRate { get; set; } = 0.1f;
[DataField("cycleRate")]
[ViewVariables(VVAccess.ReadWrite)]
public float CycleRate { get; set; } = 10.0f;
/// <summary>
/// What layers of the sprite to modulate? If null, will affect the whole sprite.
/// </summary>
[DataField("layers")]
public List<int>? Layers;
// original colors when rgb was added. Used to revert Colors when removed.
public Color OriginalLightColor;
public Color OriginalItemColor;
public Color OriginalSpriteColor;
public Dictionary<int, Color>? OriginalLayerColors;
}
[Serializable, NetSerializable]
public class RgbLightControllerState : ComponentState
{
public readonly float CycleRate;
public readonly List<int>? Layers;
public RgbLightControllerState(float cycleRate, List<int>? layers)
{
CycleRate = cycleRate;
Layers = layers;
}
}