Files
crystall-punk-14/Content.Shared/Chemistry/SolutionVisuals.cs

49 lines
1.3 KiB
C#
Raw Normal View History

using Robust.Shared.Serialization;
namespace Content.Shared.Chemistry
{
[Serializable, NetSerializable]
public enum SolutionContainerVisuals : byte
{
VisualState
}
[Serializable, NetSerializable]
2022-02-10 04:08:59 +13:00
public sealed class SolutionContainerVisualState : ICloneable
{
public readonly Color Color;
public readonly byte FilledVolumeFraction;
// do we really need this just to save three bytes?
2022-02-10 04:08:59 +13:00
// This does seem silly
public float FilledVolumePercent => (float) FilledVolumeFraction / byte.MaxValue;
/// <summary>
/// Sets the solution state of a container.
/// </summary>
2022-02-10 04:08:59 +13:00
public SolutionContainerVisualState(Color color, float filledVolumePercent)
{
Color = color;
FilledVolumeFraction = (byte) (byte.MaxValue * filledVolumePercent);
}
public SolutionContainerVisualState(Color color, byte filledVolumeFraction)
{
Color = color;
2022-02-10 04:08:59 +13:00
FilledVolumeFraction = filledVolumeFraction;
}
public object Clone()
{
return new SolutionContainerVisualState(Color, FilledVolumeFraction);
}
}
public enum SolutionContainerLayers : byte
{
Fill,
Base
}
}