Optimise flashlights (#2468)

Flashlights were calling dirty EVERY TICK so this just means they only call it when absoluetely necessary which saves a lot.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-11-01 07:56:46 +11:00
committed by GitHub
parent 87cb22838b
commit 2e65b1e5fa
6 changed files with 79 additions and 57 deletions

View File

@@ -11,18 +11,17 @@ namespace Content.Shared.GameObjects.Components
protected abstract bool HasCell { get; }
protected const int StatusLevels = 6;
[Serializable, NetSerializable]
protected sealed class HandheldLightComponentState : ComponentState
{
public HandheldLightComponentState(float? charge, bool hasCell) : base(ContentNetIDs.HANDHELD_LIGHT)
public byte? Charge { get; }
public HandheldLightComponentState(byte? charge) : base(ContentNetIDs.HANDHELD_LIGHT)
{
Charge = charge;
HasCell = hasCell;
}
public float? Charge { get; }
public bool HasCell { get; }
}
}