Revert "Solution Entities" (#23160)

Revert "Solution Entities (#21916)"

This reverts commit d75e743dd7.
This commit is contained in:
Emisse
2023-12-28 20:45:42 -07:00
committed by GitHub
parent c2c76c2035
commit 938d6d9945
180 changed files with 2959 additions and 3543 deletions

View File

@@ -1,9 +1,9 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Organ;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
@@ -37,15 +37,15 @@ namespace Content.Server.Body.Systems
SubscribeLocalEvent<MetabolizerComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
}
private void OnMetabolizerInit(Entity<MetabolizerComponent> entity, ref ComponentInit args)
private void OnMetabolizerInit(EntityUid uid, MetabolizerComponent component, ComponentInit args)
{
if (!entity.Comp.SolutionOnBody)
if (!component.SolutionOnBody)
{
_solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.SolutionName);
_solutionContainerSystem.EnsureSolution(uid, component.SolutionName);
}
else if (_organQuery.CompOrNull(entity)?.Body is { } body)
else if (_organQuery.CompOrNull(uid)?.Body is { } body)
{
_solutionContainerSystem.EnsureSolution(body, entity.Comp.SolutionName);
_solutionContainerSystem.EnsureSolution(body, component.SolutionName);
}
}
@@ -95,7 +95,6 @@ namespace Content.Server.Body.Systems
// First step is get the solution we actually care about
Solution? solution = null;
Entity<SolutionComponent>? soln = default!;
EntityUid? solutionEntityUid = null;
SolutionContainerManagerComponent? manager = null;
@@ -107,7 +106,7 @@ namespace Content.Server.Body.Systems
if (!_solutionQuery.Resolve(body, ref manager, false))
return;
_solutionContainerSystem.TryGetSolution((body, manager), meta.SolutionName, out soln, out solution);
_solutionContainerSystem.TryGetSolution(body, meta.SolutionName, out solution, manager);
solutionEntityUid = body;
}
}
@@ -116,11 +115,11 @@ namespace Content.Server.Body.Systems
if (!_solutionQuery.Resolve(uid, ref manager, false))
return;
_solutionContainerSystem.TryGetSolution((uid, manager), meta.SolutionName, out soln, out solution);
_solutionContainerSystem.TryGetSolution(uid, meta.SolutionName, out solution, manager);
solutionEntityUid = uid;
}
if (solutionEntityUid == null || soln is null || solution is null || solution.Contents.Count == 0)
if (solutionEntityUid == null || solution == null || solution.Contents.Count == 0)
return;
// randomize the reagent list so we don't have any weird quirks
@@ -139,7 +138,8 @@ namespace Content.Server.Body.Systems
{
if (meta.RemoveEmpty)
{
solution.RemoveReagent(reagent, FixedPoint2.New(1));
_solutionContainerSystem.RemoveReagent(solutionEntityUid.Value, solution, reagent,
FixedPoint2.New(1));
}
continue;
@@ -198,14 +198,12 @@ namespace Content.Server.Body.Systems
// remove a certain amount of reagent
if (mostToRemove > FixedPoint2.Zero)
{
solution.RemoveReagent(reagent, mostToRemove);
_solutionContainerSystem.RemoveReagent(solutionEntityUid.Value, solution, reagent, mostToRemove);
// We have processed a reagant, so count it towards the cap
reagents += 1;
}
}
_solutionContainerSystem.UpdateChemicals(soln.Value);
}
}