Fix Injector (#6585)

This commit is contained in:
Leon Friedrich
2022-02-10 04:08:59 +13:00
committed by GitHub
parent b806980c07
commit 212c27cd6f
3 changed files with 21 additions and 27 deletions

View File

@@ -1,5 +1,3 @@
using System;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Chemistry
@@ -11,27 +9,29 @@ namespace Content.Shared.Chemistry
}
[Serializable, NetSerializable]
public class SolutionContainerVisualState : ICloneable
public sealed class SolutionContainerVisualState : ICloneable
{
public readonly Color Color;
/// <summary>
/// Represents how full the container is, as a fraction equivalent to <see cref="FilledVolumeFraction"/>/<see cref="byte.MaxValue"/>.
/// </summary>
public readonly byte FilledVolumeFraction;
// do we really need this just to save three bytes?
// This does seem silly
public float FilledVolumePercent => (float) FilledVolumeFraction / byte.MaxValue;
/// <summary>
/// Sets the solution state of a container.
/// </summary>
/// <param name="color"></param>
/// <param name="filledVolumeFraction">The fraction of the container's volume that is filled.</param>
public SolutionContainerVisualState(Color color, float filledVolumeFraction)
public SolutionContainerVisualState(Color color, float filledVolumePercent)
{
Color = color;
FilledVolumeFraction = (byte) (byte.MaxValue * filledVolumeFraction);
FilledVolumeFraction = (byte) (byte.MaxValue * filledVolumePercent);
}
public SolutionContainerVisualState(Color color, byte filledVolumeFraction)
{
Color = color;
FilledVolumeFraction = filledVolumeFraction;
}
public object Clone()