Solution rejig (#12428)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public sealed partial class ChemistrySystem
|
||||
{
|
||||
_solutions.TryGetSolution(uid, InjectorComponent.SolutionName, out var solution);
|
||||
|
||||
var currentVolume = solution?.CurrentVolume ?? FixedPoint2.Zero;
|
||||
var currentVolume = solution?.Volume ?? FixedPoint2.Zero;
|
||||
var maxVolume = solution?.MaxVolume ?? FixedPoint2.Zero;
|
||||
|
||||
args.State = new SharedInjectorComponent.InjectorComponentState(currentVolume, maxVolume, component.ToggleState);
|
||||
@@ -323,7 +323,7 @@ public sealed partial class ChemistrySystem
|
||||
removedSolution.DoEntityReaction(targetBloodstream.Owner, ReactionMethod.Injection);
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-inject-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("amount", removedSolution.Volume),
|
||||
("target", Identity.Entity(targetBloodstream.Owner, EntityManager))), component.Owner, user);
|
||||
|
||||
Dirty(component);
|
||||
@@ -333,7 +333,7 @@ public sealed partial class ChemistrySystem
|
||||
private void TryInject(InjectorComponent component, EntityUid targetEntity, Solution targetSolution, EntityUid user, bool asRefill)
|
||||
{
|
||||
if (!_solutions.TryGetSolution(component.Owner, InjectorComponent.SolutionName, out var solution)
|
||||
|| solution.CurrentVolume == 0)
|
||||
|| solution.Volume == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ public sealed partial class ChemistrySystem
|
||||
}
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-transfer-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("amount", removedSolution.Volume),
|
||||
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, user);
|
||||
|
||||
Dirty(component);
|
||||
@@ -374,7 +374,7 @@ public sealed partial class ChemistrySystem
|
||||
{
|
||||
// Automatically set syringe to draw after completely draining it.
|
||||
if (_solutions.TryGetSolution(component.Owner, InjectorComponent.SolutionName, out var solution)
|
||||
&& solution.CurrentVolume == 0)
|
||||
&& solution.Volume == 0)
|
||||
{
|
||||
component.ToggleState = SharedInjectorComponent.InjectorToggleMode.Draw;
|
||||
}
|
||||
@@ -399,7 +399,7 @@ public sealed partial class ChemistrySystem
|
||||
}
|
||||
|
||||
// Get transfer amount. May be smaller than _transferAmount if not enough room, also make sure there's room in the injector
|
||||
var realTransferAmount = FixedPoint2.Min(component.TransferAmount, targetSolution.DrawAvailable, solution.AvailableVolume);
|
||||
var realTransferAmount = FixedPoint2.Min(component.TransferAmount, targetSolution.Volume, solution.AvailableVolume);
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
@@ -424,7 +424,7 @@ public sealed partial class ChemistrySystem
|
||||
}
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-draw-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("amount", removedSolution.Volume),
|
||||
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, user);
|
||||
|
||||
Dirty(component);
|
||||
@@ -436,7 +436,7 @@ public sealed partial class ChemistrySystem
|
||||
var drawAmount = (float) transferAmount;
|
||||
var bloodAmount = drawAmount;
|
||||
var chemAmount = 0f;
|
||||
if (stream.ChemicalSolution.CurrentVolume > 0f) // If they have stuff in their chem stream, we'll draw some of that
|
||||
if (stream.ChemicalSolution.Volume > 0f) // If they have stuff in their chem stream, we'll draw some of that
|
||||
{
|
||||
bloodAmount = drawAmount * 0.85f;
|
||||
chemAmount = drawAmount * 0.15f;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
|
||||
_solutions.TryGetSolution(uid, component.SolutionName, out var hypoSpraySolution);
|
||||
|
||||
if (hypoSpraySolution == null || hypoSpraySolution.CurrentVolume == 0)
|
||||
if (hypoSpraySolution == null || hypoSpraySolution.Volume == 0)
|
||||
{
|
||||
_popup.PopupCursor(Loc.GetString("hypospray-component-empty-message"), user);
|
||||
return true;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Chemistry.Dispenser;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -62,7 +63,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
if (_solutionContainerSystem.TryGetFitsInDispenser(container.Value, out var solution))
|
||||
{
|
||||
var reagents = solution.Contents.Select(reagent => (reagent.ReagentId, reagent.Quantity)).ToList();
|
||||
return new ContainerInfo(Name(container.Value), true, solution.CurrentVolume, solution.MaxVolume, reagents);
|
||||
return new ContainerInfo(Name(container.Value), true, solution.Volume, solution.MaxVolume, reagents);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -110,7 +110,7 @@ public sealed partial class SolutionContainerSystem
|
||||
{
|
||||
return !TryGetDrainableSolution(uid, out var solution)
|
||||
? FixedPoint2.Zero
|
||||
: solution.CurrentVolume;
|
||||
: solution.Volume;
|
||||
}
|
||||
|
||||
public float PercentFull(EntityUid uid)
|
||||
@@ -118,7 +118,7 @@ public sealed partial class SolutionContainerSystem
|
||||
if (!TryGetDrainableSolution(uid, out var solution) || solution.MaxVolume.Equals(FixedPoint2.Zero))
|
||||
return 0;
|
||||
|
||||
return ((solution.CurrentVolume.Float() / solution.MaxVolume.Float()) * 100);
|
||||
return solution.FillFraction * 100;
|
||||
}
|
||||
|
||||
public bool TryGetFitsInDispenser(EntityUid owner,
|
||||
|
||||
@@ -51,13 +51,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
foreach (var (name, solutionHolder) in component.Solutions)
|
||||
{
|
||||
solutionHolder.Name = name;
|
||||
if (solutionHolder.MaxVolume == FixedPoint2.Zero)
|
||||
{
|
||||
solutionHolder.MaxVolume = solutionHolder.TotalVolume > solutionHolder.InitialMaxVolume
|
||||
? solutionHolder.TotalVolume
|
||||
: solutionHolder.InitialMaxVolume;
|
||||
}
|
||||
|
||||
solutionHolder.ValidateSolution();
|
||||
UpdateAppearance(uid, solutionHolder);
|
||||
}
|
||||
}
|
||||
@@ -70,14 +64,14 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
|| !solutionsManager.Solutions.TryGetValue(examinableComponent.Solution, out var solutionHolder))
|
||||
return;
|
||||
|
||||
if (solutionHolder.Contents.Count == 0)
|
||||
var primaryReagent = solutionHolder.GetPrimaryReagentId();
|
||||
|
||||
if (string.IsNullOrEmpty(primaryReagent))
|
||||
{
|
||||
args.PushText(Loc.GetString("shared-solution-container-component-on-examine-empty-container"));
|
||||
return;
|
||||
}
|
||||
|
||||
var primaryReagent = solutionHolder.GetPrimaryReagentId();
|
||||
|
||||
if (!_prototypeManager.TryIndex(primaryReagent, out ReagentPrototype? proto))
|
||||
{
|
||||
Logger.Error(
|
||||
@@ -85,7 +79,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var colorHex = solutionHolder.Color
|
||||
var colorHex = solutionHolder.GetColor(_prototypeManager)
|
||||
.ToHexNoAlpha(); //TODO: If the chem has a dark color, the examine text becomes black on a black background, which is unreadable.
|
||||
var messageString = "shared-solution-container-component-on-examine-main-text";
|
||||
|
||||
@@ -104,9 +98,9 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
|| !Resolve(uid, ref appearanceComponent, false))
|
||||
return;
|
||||
|
||||
var filledVolumePercent = Math.Min(1.0f, solution.CurrentVolume.Float() / solution.MaxVolume.Float());
|
||||
var filledVolumePercent = solution.FillFraction * 100;
|
||||
appearanceComponent.SetData(SolutionContainerVisuals.VisualState,
|
||||
new SolutionContainerVisualState(solution.Color, filledVolumePercent));
|
||||
new SolutionContainerVisualState(solution.GetColor(_prototypeManager), filledVolumePercent));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,7 +133,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
|
||||
public void RemoveAllSolution(EntityUid uid, Solution solutionHolder)
|
||||
{
|
||||
if (solutionHolder.CurrentVolume == 0)
|
||||
if (solutionHolder.Volume == 0)
|
||||
return;
|
||||
|
||||
solutionHolder.RemoveAllSolution();
|
||||
@@ -169,8 +163,8 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
targetSolution.MaxVolume = capacity;
|
||||
if (capacity < targetSolution.CurrentVolume)
|
||||
targetSolution.RemoveSolution(targetSolution.CurrentVolume - capacity);
|
||||
if (capacity < targetSolution.Volume)
|
||||
targetSolution.RemoveSolution(targetSolution.Volume - capacity);
|
||||
|
||||
UpdateChemicals(targetUid, targetSolution);
|
||||
}
|
||||
@@ -188,14 +182,20 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
out FixedPoint2 acceptedQuantity, float? temperature = null)
|
||||
{
|
||||
acceptedQuantity = targetSolution.AvailableVolume > quantity ? quantity : targetSolution.AvailableVolume;
|
||||
targetSolution.AddReagent(reagentId, acceptedQuantity, temperature);
|
||||
|
||||
if (acceptedQuantity > 0)
|
||||
UpdateChemicals(targetUid, targetSolution, true);
|
||||
if (acceptedQuantity <= 0)
|
||||
return quantity == 0;
|
||||
|
||||
if (temperature == null)
|
||||
targetSolution.AddReagent(reagentId, acceptedQuantity);
|
||||
else
|
||||
targetSolution.AddReagent(_prototypeManager.Index<ReagentPrototype>(reagentId), acceptedQuantity, temperature.Value, _prototypeManager);
|
||||
|
||||
UpdateChemicals(targetUid, targetSolution, true);
|
||||
return acceptedQuantity == quantity;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes reagent of an Id to the container.
|
||||
/// </summary>
|
||||
@@ -224,10 +224,10 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
public bool TryAddSolution(EntityUid targetUid, Solution? targetSolution, Solution addedSolution)
|
||||
{
|
||||
if (targetSolution == null
|
||||
|| !targetSolution.CanAddSolution(addedSolution) || addedSolution.TotalVolume == 0)
|
||||
|| !targetSolution.CanAddSolution(addedSolution) || addedSolution.Volume == 0)
|
||||
return false;
|
||||
|
||||
targetSolution.AddSolution(addedSolution);
|
||||
targetSolution.AddSolution(addedSolution, _prototypeManager);
|
||||
UpdateChemicals(targetUid, targetSolution, true);
|
||||
return true;
|
||||
}
|
||||
@@ -245,13 +245,13 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
if (quantity < 0)
|
||||
return TryTransferSolution(targetUid, sourceUid, target, source, -quantity);
|
||||
|
||||
quantity = FixedPoint2.Min(quantity, target.AvailableVolume, source.CurrentVolume);
|
||||
quantity = FixedPoint2.Min(quantity, target.AvailableVolume, source.Volume);
|
||||
if (quantity == 0)
|
||||
return false;
|
||||
|
||||
// TODO after #12428 is merged, this should be made into a function that directly transfers reagents.
|
||||
// currently this is quite inefficient.
|
||||
target.AddSolution(source.SplitSolution(quantity));
|
||||
// TODO This should be made into a function that directly transfers reagents. currently this is quite
|
||||
// inefficient.
|
||||
target.AddSolution(source.SplitSolution(quantity), _prototypeManager);
|
||||
|
||||
UpdateChemicals(sourceUid, source, false);
|
||||
UpdateChemicals(targetUid, target, true);
|
||||
@@ -294,16 +294,16 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
FixedPoint2 overflowThreshold,
|
||||
[NotNullWhen(true)] out Solution? overflowingSolution)
|
||||
{
|
||||
if (addedSolution.TotalVolume == 0 || overflowThreshold > targetSolution.MaxVolume)
|
||||
if (addedSolution.Volume == 0 || overflowThreshold > targetSolution.MaxVolume)
|
||||
{
|
||||
overflowingSolution = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
targetSolution.AddSolution(addedSolution);
|
||||
targetSolution.AddSolution(addedSolution, _prototypeManager);
|
||||
UpdateChemicals(targetUid, targetSolution, true);
|
||||
overflowingSolution = targetSolution.SplitSolution(FixedPoint2.Max(FixedPoint2.Zero,
|
||||
targetSolution.CurrentVolume - overflowThreshold));
|
||||
targetSolution.Volume - overflowThreshold));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -320,14 +320,16 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
return solutionsMgr.Solutions.TryGetValue(name, out solution);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Will ensure a solution is added to given entity even if it's missing solutionContainerManager
|
||||
/// </summary>
|
||||
/// <param name="uid">EntityUid to which to add solution</param>
|
||||
/// <param name="name">name for the solution</param>
|
||||
/// <param name="solutionsMgr">solution components used in resolves</param>
|
||||
/// <param name="existed">true if the solution already existed</param>
|
||||
/// <returns>solution</returns>
|
||||
public Solution EnsureSolution(EntityUid uid, string name,
|
||||
public Solution EnsureSolution(EntityUid uid, string name, out bool existed,
|
||||
SolutionContainerManagerComponent? solutionsMgr = null)
|
||||
{
|
||||
if (!Resolve(uid, ref solutionsMgr, false))
|
||||
@@ -335,15 +337,76 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
solutionsMgr = EntityManager.EnsureComponent<SolutionContainerManagerComponent>(uid);
|
||||
}
|
||||
|
||||
if (!solutionsMgr.Solutions.ContainsKey(name))
|
||||
if (!solutionsMgr.Solutions.TryGetValue(name, out var existing))
|
||||
{
|
||||
var newSolution = new Solution() { Name = name };
|
||||
solutionsMgr.Solutions.Add(name, newSolution);
|
||||
existed = false;
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
return solutionsMgr.Solutions[name];
|
||||
existed = true;
|
||||
return existing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will ensure a solution is added to given entity even if it's missing solutionContainerManager
|
||||
/// </summary>
|
||||
/// <param name="uid">EntityUid to which to add solution</param>
|
||||
/// <param name="name">name for the solution</param>
|
||||
/// <param name="solutionsMgr">solution components used in resolves</param>
|
||||
/// <returns>solution</returns>
|
||||
public Solution EnsureSolution(EntityUid uid, string name, SolutionContainerManagerComponent? solutionsMgr = null)
|
||||
=> EnsureSolution(uid, name, out _, solutionsMgr);
|
||||
|
||||
/// <summary>
|
||||
/// Will ensure a solution is added to given entity even if it's missing solutionContainerManager
|
||||
/// </summary>
|
||||
/// <param name="uid">EntityUid to which to add solution</param>
|
||||
/// <param name="name">name for the solution</param>
|
||||
/// <param name="minVol">Ensures that the solution's maximum volume is larger than this value./param>
|
||||
/// <param name="solutionsMgr">solution components used in resolves</param>
|
||||
/// <returns>solution</returns>
|
||||
public Solution EnsureSolution(EntityUid uid, string name, FixedPoint2 minVol, out bool existed,
|
||||
SolutionContainerManagerComponent? solutionsMgr = null)
|
||||
{
|
||||
if (!Resolve(uid, ref solutionsMgr, false))
|
||||
{
|
||||
solutionsMgr = EntityManager.EnsureComponent<SolutionContainerManagerComponent>(uid);
|
||||
}
|
||||
|
||||
if (!solutionsMgr.Solutions.TryGetValue(name, out var existing))
|
||||
{
|
||||
var newSolution = new Solution() { Name = name };
|
||||
solutionsMgr.Solutions.Add(name, newSolution);
|
||||
existed = false;
|
||||
newSolution.MaxVolume = minVol;
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
existed = true;
|
||||
existing.MaxVolume = FixedPoint2.Max(existing.MaxVolume, minVol);
|
||||
return existing;
|
||||
}
|
||||
|
||||
public Solution EnsureSolution(EntityUid uid, string name,
|
||||
IEnumerable<Solution.ReagentQuantity> reagents,
|
||||
bool setMaxVol = true,
|
||||
SolutionContainerManagerComponent? solutionsMgr = null)
|
||||
{
|
||||
if (!Resolve(uid, ref solutionsMgr, false))
|
||||
solutionsMgr = EntityManager.EnsureComponent<SolutionContainerManagerComponent>(uid);
|
||||
|
||||
if (!solutionsMgr.Solutions.TryGetValue(name, out var existing))
|
||||
{
|
||||
var newSolution = new Solution(reagents, setMaxVol);
|
||||
solutionsMgr.Solutions.Add(name, newSolution);
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
existing.SetContents(reagents, setMaxVol);
|
||||
return existing;
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes an amount from all reagents in a solution, adding it to a new solution.
|
||||
/// </summary>
|
||||
@@ -446,10 +509,8 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
/// <param name="thermalEnergy">The new value to set the thermal energy to.</param>
|
||||
public void SetThermalEnergy(EntityUid owner, Solution solution, float thermalEnergy)
|
||||
{
|
||||
if (thermalEnergy == solution.ThermalEnergy)
|
||||
return;
|
||||
|
||||
solution.ThermalEnergy = thermalEnergy;
|
||||
var heatCap = solution.GetHeatCapacity(_prototypeManager);
|
||||
solution.Temperature = heatCap == 0 ? 0 : thermalEnergy / heatCap;
|
||||
UpdateChemicals(owner, solution, true);
|
||||
}
|
||||
|
||||
@@ -464,7 +525,8 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
if (thermalEnergy == 0.0f)
|
||||
return;
|
||||
|
||||
solution.ThermalEnergy += thermalEnergy;
|
||||
var heatCap = solution.GetHeatCapacity(_prototypeManager);
|
||||
solution.Temperature += heatCap == 0 ? 0 : thermalEnergy / heatCap;
|
||||
UpdateChemicals(owner, solution, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
}
|
||||
|
||||
var solRemoved = solution.SplitSolution(component.TransferAmount);
|
||||
var solRemovedVol = solRemoved.TotalVolume;
|
||||
var solRemovedVol = solRemoved.Volume;
|
||||
|
||||
var solToInject = solRemoved.SplitSolution(solRemovedVol * component.TransferEfficiency);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetSolution.CurrentVolume == 0 && !spikableSource.IgnoreEmpty)
|
||||
if (targetSolution.Volume == 0 && !spikableSource.IgnoreEmpty)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user);
|
||||
return;
|
||||
@@ -66,7 +66,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
|
||||
targetSolution.MaxVolume,
|
||||
out var overflow))
|
||||
{
|
||||
if (overflow.TotalVolume > 0)
|
||||
if (overflow.Volume > 0)
|
||||
{
|
||||
RaiseLocalEvent(target, new SolutionSpikeOverflowEvent(overflow));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
if (source.DrainAvailable == 0)
|
||||
if (source.Volume == 0)
|
||||
{
|
||||
sourceEntity.PopupMessage(user,
|
||||
Loc.GetString("comp-solution-transfer-is-empty", ("target", sourceEntity)));
|
||||
@@ -178,7 +178,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
var actualAmount = FixedPoint2.Min(amount, FixedPoint2.Min(source.DrainAvailable, target.AvailableVolume));
|
||||
var actualAmount = FixedPoint2.Min(amount, FixedPoint2.Min(source.Volume, target.AvailableVolume));
|
||||
|
||||
var solutionSystem = Get<SolutionContainerSystem>();
|
||||
var solution = solutionSystem.Drain(sourceEntity, source, actualAmount);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
|
||||
internal bool TryAddSolution(VaporComponent vapor, Solution solution)
|
||||
{
|
||||
if (solution.TotalVolume == 0)
|
||||
if (solution.Volume == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
if (contents.CurrentVolume == 0)
|
||||
if (contents.Volume == 0)
|
||||
{
|
||||
// Delete this
|
||||
EntityManager.QueueDeleteEntity(entity);
|
||||
|
||||
Reference in New Issue
Block a user