Solution rejig (#12428)

This commit is contained in:
Leon Friedrich
2023-01-12 16:41:40 +13:00
committed by GitHub
parent 38504f6412
commit 466384b081
61 changed files with 873 additions and 619 deletions

View File

@@ -66,7 +66,7 @@ namespace Content.Server.Chemistry.EntitySystems
var outputContainer = _itemSlotsSystem.GetItemOrNull(chemMaster.Owner, SharedChemMaster.OutputSlotName);
var bufferReagents = bufferSolution.Contents;
var bufferCurrentVolume = bufferSolution.CurrentVolume;
var bufferCurrentVolume = bufferSolution.Volume;
var state = new ChemMasterBoundUserInterfaceState(
chemMaster.Mode, BuildInputContainerInfo(inputContainer), BuildOutputContainerInfo(outputContainer),
@@ -288,7 +288,7 @@ namespace Content.Server.Chemistry.EntitySystems
return false;
}
if (solution.TotalVolume == 0)
if (solution.Volume == 0)
{
if (user.HasValue)
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-empty-text"), user.Value);
@@ -296,7 +296,7 @@ namespace Content.Server.Chemistry.EntitySystems
}
// ReSharper disable once InvertIf
if (neededVolume > solution.CurrentVolume)
if (neededVolume > solution.Volume)
{
if (user.HasValue)
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-low-text"), user.Value);
@@ -343,12 +343,12 @@ namespace Content.Server.Chemistry.EntitySystems
if (!TryComp(container, out ServerStorageComponent? storage))
return null;
var pills = storage.Storage?.ContainedEntities.Select(pill =>
var pills = storage.Storage?.ContainedEntities.Select((Func<EntityUid, (string, FixedPoint2 quantity)>) (pill =>
{
_solutionContainerSystem.TryGetSolution(pill, SharedChemMaster.PillSolutionName, out var solution);
var quantity = solution?.CurrentVolume ?? FixedPoint2.Zero;
return (Name(pill), quantity);
}).ToList();
var quantity = solution?.Volume ?? FixedPoint2.Zero;
return ((string, FixedPoint2 quantity))(Name(pill), quantity:(FixedPoint2) quantity);
})).ToList();
return pills is null
? null
@@ -360,7 +360,7 @@ namespace Content.Server.Chemistry.EntitySystems
var reagents = solution.Contents
.Select(reagent => (reagent.ReagentId, reagent.Quantity)).ToList();
return new ContainerInfo(name, true, solution.CurrentVolume, solution.MaxVolume, reagents);
return new ContainerInfo(name, true, solution.Volume, solution.MaxVolume, reagents);
}
}
}