Add test for adding each component individually to an entity (#1870)
* Add test for adding each component individually to entities * Put one-to-one test before all-at-once test
This commit is contained in:
@@ -60,11 +60,18 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return false;
|
||||
}
|
||||
|
||||
var mopContents = mopComponent.Contents;
|
||||
|
||||
if (mopContents == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let's fill 'er up
|
||||
// If this is called the mop should be empty but just in case we'll do Max - Current
|
||||
var transferAmount = ReagentUnit.Min(mopComponent.MaxVolume - mopComponent.CurrentVolume, CurrentVolume);
|
||||
var solution = contents.SplitSolution(transferAmount);
|
||||
if (!mopComponent.Contents.TryAddSolution(solution) || mopComponent.CurrentVolume == 0)
|
||||
if (!mopContents.TryAddSolution(solution) || mopComponent.CurrentVolume == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -109,7 +116,14 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return false;
|
||||
}
|
||||
|
||||
var solution = mopComponent.Contents.SplitSolution(transferAmount);
|
||||
var mopContents = mopComponent.Contents;
|
||||
|
||||
if (mopContents == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var solution = mopContents.SplitSolution(transferAmount);
|
||||
if (!contents.TryAddSolution(solution))
|
||||
{
|
||||
//This really shouldn't happen
|
||||
@@ -127,7 +141,6 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity(_sound, Owner);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user