Storage Standardization [Take 2] (#21270)
This commit is contained in:
@@ -180,14 +180,13 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
var user = message.Session.AttachedEntity;
|
||||
var maybeContainer = _itemSlotsSystem.GetItemOrNull(chemMaster, SharedChemMaster.OutputSlotName);
|
||||
if (maybeContainer is not { Valid: true } container
|
||||
|| !TryComp(container, out StorageComponent? storage)
|
||||
|| storage.Container is null)
|
||||
|| !TryComp(container, out StorageComponent? storage))
|
||||
{
|
||||
return; // output can't fit pills
|
||||
}
|
||||
|
||||
// Ensure the number is valid.
|
||||
if (message.Number == 0 || message.Number > storage.StorageCapacityMax - storage.StorageUsed)
|
||||
if (message.Number == 0 || !_storageSystem.HasSpace((container, storage)))
|
||||
return;
|
||||
|
||||
// Ensure the amount is valid.
|
||||
@@ -348,17 +347,14 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
if (!TryComp(container, out StorageComponent? storage))
|
||||
return null;
|
||||
|
||||
var pills = storage.Container?.ContainedEntities.Select((Func<EntityUid, (string, FixedPoint2 quantity)>) (pill =>
|
||||
var pills = storage.Container.ContainedEntities.Select((Func<EntityUid, (string, FixedPoint2 quantity)>) (pill =>
|
||||
{
|
||||
_solutionContainerSystem.TryGetSolution(pill, SharedChemMaster.PillSolutionName, out var solution);
|
||||
var quantity = solution?.Volume ?? FixedPoint2.Zero;
|
||||
return (Name(pill), quantity);
|
||||
})).ToList();
|
||||
|
||||
if (pills == null)
|
||||
return null;
|
||||
|
||||
return new ContainerInfo(name, storage.StorageUsed, storage.StorageCapacityMax)
|
||||
return new ContainerInfo(name, _storageSystem.GetCumulativeItemSizes(container.Value, storage), storage.MaxTotalWeight)
|
||||
{
|
||||
Entities = pills
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user