Show remaining liquid in a drink when you examine it (#8721)

* Show drink volume on examine

* Approximate measurement unless a beaker

* Changed percentage threshold and added subjectivity

* Update default switch case since it can never be 0 here

* Remove int cast from PercentFull method
This commit is contained in:
themias
2022-06-21 22:02:24 -04:00
committed by GitHub
parent af41a84410
commit d76ff66d3d
3 changed files with 55 additions and 0 deletions

View File

@@ -113,6 +113,14 @@ public sealed partial class SolutionContainerSystem
: solution.CurrentVolume;
}
public float PercentFull(EntityUid uid)
{
if (!TryGetDrainableSolution(uid, out var solution) || solution.MaxVolume.Equals(FixedPoint2.Zero))
return 0;
return ((solution.CurrentVolume.Float() / solution.MaxVolume.Float()) * 100);
}
public bool TryGetFitsInDispenser(EntityUid owner,
[NotNullWhen(true)] out Solution? solution,
FitsInDispenserComponent? dispenserFits = null,