Fix tanks being empty on round start (#4696)
* Fix tanks being empty on round start * Fix test. Co-authored-by: Vera Aguilera Puerto <gradientvera@outlook.com>
This commit is contained in:
@@ -148,6 +148,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
|
||||
float sEvaporateTime = default;
|
||||
PuddleComponent sPuddle = null;
|
||||
Solution solution = null;
|
||||
ReagentUnit sPuddleStartingVolume = default;
|
||||
|
||||
// Spawn a puddle
|
||||
@@ -213,14 +214,8 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
// Check that the puddle is unpaused
|
||||
Assert.False(sPuddle.Owner.Paused);
|
||||
|
||||
// Check that the puddle has evaporated some of its volume
|
||||
Assert.That(sPuddle.CurrentVolume, Is.LessThan(sPuddleStartingVolume));
|
||||
|
||||
// If its new volume is zero it should have been deleted
|
||||
if (sPuddle.CurrentVolume == ReagentUnit.Zero)
|
||||
{
|
||||
// By now, the puddle should have evaporated and deleted.
|
||||
Assert.True(sPuddle.Deleted);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -37,14 +36,16 @@ namespace Content.Shared.Chemistry.Components
|
||||
[DataField("maxSpillRefill")]
|
||||
public ReagentUnit MaxSpillRefill { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initially set <see cref="MaxVolume"/>. If empty will be calculated based
|
||||
/// on sum of <see cref="Contents"/> reagent units.
|
||||
/// </summary>
|
||||
[DataField("maxVol")] public ReagentUnit InitialMaxVolume;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("maxVol")]
|
||||
public ReagentUnit MaxVolume { get; set; } = ReagentUnit.Zero;
|
||||
|
||||
[ViewVariables]
|
||||
public ReagentUnit CurrentVolume => TotalVolume;
|
||||
|
||||
// [ViewVariables]
|
||||
// public EntityUid OwnerUid { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +50,9 @@ namespace Content.Shared.Chemistry.EntitySystems
|
||||
foreach (var keyValue in component.Solutions)
|
||||
{
|
||||
var solutionHolder = keyValue.Value;
|
||||
// solutionHolder.OwnerUid = component.Owner.Uid;
|
||||
if (solutionHolder.MaxVolume == ReagentUnit.Zero && solutionHolder.TotalVolume > solutionHolder.MaxVolume)
|
||||
{
|
||||
solutionHolder.MaxVolume = solutionHolder.TotalVolume;
|
||||
}
|
||||
solutionHolder.MaxVolume = solutionHolder.TotalVolume > solutionHolder.InitialMaxVolume
|
||||
? solutionHolder.TotalVolume
|
||||
: solutionHolder.InitialMaxVolume;
|
||||
|
||||
UpdateAppearance(uid, solutionHolder);
|
||||
}
|
||||
|
||||
@@ -431,10 +431,6 @@ entities:
|
||||
pos: -19.463,-9.482748
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
food:
|
||||
maxVol: 5
|
||||
type: SolutionContainerManager
|
||||
- uid: 47
|
||||
type: FoodBanana
|
||||
components:
|
||||
@@ -442,10 +438,6 @@ entities:
|
||||
pos: -19.603624,-9.388998
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
food:
|
||||
maxVol: 5
|
||||
type: SolutionContainerManager
|
||||
- uid: 48
|
||||
type: FoodBanana
|
||||
components:
|
||||
@@ -453,10 +445,6 @@ entities:
|
||||
pos: -19.728624,-9.576498
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
food:
|
||||
maxVol: 5
|
||||
type: SolutionContainerManager
|
||||
- uid: 49
|
||||
type: Poweredlight
|
||||
components:
|
||||
@@ -901,10 +889,6 @@ entities:
|
||||
pos: -1.5,-11.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 107
|
||||
type: WaterTankFull
|
||||
components:
|
||||
@@ -912,10 +896,6 @@ entities:
|
||||
pos: 0.5,-11.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 108
|
||||
type: Basketball
|
||||
components:
|
||||
@@ -6408,10 +6388,6 @@ entities:
|
||||
- pos: 19.54588,-0.4289844
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
plasma:
|
||||
maxVol: 10
|
||||
type: SolutionContainerManager
|
||||
- canCollide: False
|
||||
type: Physics
|
||||
- uid: 608
|
||||
@@ -8456,10 +8432,6 @@ entities:
|
||||
- pos: -19.5,-4.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
toilet:
|
||||
maxVol: 200
|
||||
type: SolutionContainerManager
|
||||
- containers:
|
||||
stash: !type:ContainerSlot {}
|
||||
type: ContainerContainer
|
||||
@@ -16624,10 +16596,6 @@ entities:
|
||||
pos: -17.5,1.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 1151
|
||||
type: VendingMachineMedical
|
||||
components:
|
||||
@@ -18981,10 +18949,6 @@ entities:
|
||||
pos: 35.5,-3.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 1391
|
||||
type: WaterTankFull
|
||||
components:
|
||||
@@ -18992,10 +18956,6 @@ entities:
|
||||
pos: -19.5,7.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 1392
|
||||
type: ReinforcedWindow
|
||||
components:
|
||||
@@ -20085,10 +20045,6 @@ entities:
|
||||
- pos: 33.5,12.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 1544
|
||||
type: MedicalScanner
|
||||
components:
|
||||
@@ -20902,10 +20858,6 @@ entities:
|
||||
pos: 10.5,-18.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 1655
|
||||
type: WallReinforced
|
||||
components:
|
||||
@@ -26433,10 +26385,6 @@ entities:
|
||||
pos: -26.5,11.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 2440
|
||||
type: WeldingFuelTankFull
|
||||
components:
|
||||
@@ -26444,10 +26392,6 @@ entities:
|
||||
pos: 35.5,-4.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 2441
|
||||
type: VendingBarDrobe
|
||||
components:
|
||||
@@ -48493,10 +48437,6 @@ entities:
|
||||
- pos: -15.5,-12.5
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
tank:
|
||||
maxVol: 1500
|
||||
type: SolutionContainerManager
|
||||
- uid: 4883
|
||||
type: WallSolid
|
||||
components:
|
||||
@@ -50146,10 +50086,6 @@ entities:
|
||||
- pos: 19.561504,-0.1164844
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
plasma:
|
||||
maxVol: 10
|
||||
type: SolutionContainerManager
|
||||
- canCollide: False
|
||||
type: Physics
|
||||
- uid: 5102
|
||||
@@ -50158,10 +50094,6 @@ entities:
|
||||
- pos: 19.54588,0.1647656
|
||||
parent: 853
|
||||
type: Transform
|
||||
- solutions:
|
||||
plasma:
|
||||
maxVol: 10
|
||||
type: SolutionContainerManager
|
||||
- canCollide: False
|
||||
type: Physics
|
||||
- uid: 5103
|
||||
|
||||
Reference in New Issue
Block a user