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

@@ -146,7 +146,7 @@ namespace Content.Server.Chemistry.Components
}
else if (ToggleState == InjectorToggleMode.Draw)
{
if (solutionsSys.TryGetDrawableSolution(targetEntity, out var drawableSolution))
if (solutionsSys.TryGetDrawableSolution(targetEntity.Uid, out var drawableSolution))
{
TryDraw(targetEntity, drawableSolution, eventArgs.User);
}
@@ -175,7 +175,7 @@ namespace Content.Server.Chemistry.Components
private void TryInjectIntoBloodstream(BloodstreamComponent targetBloodstream, IEntity user)
{
if (!EntitySystem.Get<SolutionContainerSystem>()
.TryGetSolution(user, SharedBloodstreamComponent.DefaultSolutionName, out var bloodstream)
.TryGetSolution(user.Uid, SharedBloodstreamComponent.DefaultSolutionName, out var bloodstream)
|| bloodstream.CurrentVolume == 0)
return;
@@ -216,7 +216,7 @@ namespace Content.Server.Chemistry.Components
private void TryInject(IEntity targetEntity, Solution targetSolution, IEntity user, bool asRefill)
{
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
|| solution.CurrentVolume == 0)
{
return;
@@ -259,7 +259,7 @@ namespace Content.Server.Chemistry.Components
private void AfterInject()
{
// Automatically set syringe to draw after completely draining it.
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
&& solution.CurrentVolume == 0)
{
ToggleState = InjectorToggleMode.Draw;
@@ -269,7 +269,7 @@ namespace Content.Server.Chemistry.Components
private void AfterDraw()
{
// Automatically set syringe to inject after completely filling it.
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
&& solution.AvailableVolume == 0)
{
ToggleState = InjectorToggleMode.Inject;
@@ -278,7 +278,7 @@ namespace Content.Server.Chemistry.Components
private void TryDraw(IEntity targetEntity, Solution targetSolution, IEntity user)
{
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solution)
|| solution.AvailableVolume == 0)
{
return;
@@ -315,7 +315,7 @@ namespace Content.Server.Chemistry.Components
public override ComponentState GetComponentState(ICommonSession player)
{
Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
.TryGetSolution(Owner, SolutionName, out var solution);
.TryGetSolution(Owner.Uid, SolutionName, out var solution);
var currentVolume = solution?.CurrentVolume ?? ReagentUnit.Zero;
var maxVolume = solution?.MaxVolume ?? ReagentUnit.Zero;