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