Refactor Resolve and IEntity in SolutionContainerSystem (#5083)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Ygg01
2021-11-02 02:03:23 +01:00
committed by GitHub
parent a13e23528c
commit fc5fa67a56
30 changed files with 141 additions and 170 deletions

View File

@@ -29,19 +29,19 @@ namespace Content.Server.Fluids.Components
public ReagentUnit MaxVolume
{
get =>
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
? solution.MaxVolume
: ReagentUnit.Zero;
set
{
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution))
{
solution.MaxVolume = value;
}
}
}
public ReagentUnit CurrentVolume => EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
public ReagentUnit CurrentVolume => EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
? solution.CurrentVolume
: ReagentUnit.Zero;
@@ -52,7 +52,7 @@ namespace Content.Server.Fluids.Components
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) ||
if (!solutionsSys.TryGetSolution(Owner.Uid, SolutionName, out var contents) ||
_currentlyUsing.Contains(eventArgs.Using.Uid) ||
!eventArgs.Using.TryGetComponent(out MopComponent? mopComponent) ||
mopComponent.Mopping)

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Fluids.Components
{
get
{
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution);
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution);
return solution;
}
}
@@ -81,7 +81,7 @@ namespace Content.Server.Fluids.Components
* will spill some of the mop's solution onto the puddle which will evaporate eventually.
*/
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var contents ) ||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var contents ) ||
Mopping ||
!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
{
@@ -156,7 +156,7 @@ namespace Content.Server.Fluids.Components
}
else
{
if (solutionSystem.TryGetSolution(eventArgs.Target, puddleComponent.SolutionName, out var puddleSolution))
if (solutionSystem.TryGetSolution(eventArgs.Target.Uid, puddleComponent.SolutionName, out var puddleSolution))
solutionSystem.SplitSolution(eventArgs.Target.Uid, puddleSolution, transferAmount);
}

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Fluids.Components
void IDropped.Dropped(DroppedEventArgs eventArgs)
{
if (!eventArgs.Intentional
&& EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solutionComponent))
&& EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solutionComponent))
{
EntitySystem.Get<SolutionContainerSystem>()
.Drain(Owner.Uid, solutionComponent, solutionComponent.DrainAvailable)

View File

@@ -78,7 +78,7 @@ namespace Content.Server.Fluids.Components
public ReagentUnit CurrentVolume {
get
{
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution);
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution);
return solution?.CurrentVolume ?? ReagentUnit.Zero;
}
}
@@ -105,7 +105,7 @@ namespace Content.Server.Fluids.Components
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
return true;
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var contents))
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var contents))
return true;
var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized;