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,5 +1,4 @@
using Content.Server.Chemistry.Components.DeleteOnSolutionEmptyComponent;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
@@ -13,27 +12,27 @@ namespace Content.Server.Chemistry.EntitySystems.DeleteOnSolutionEmptySystem
{
base.Initialize();
SubscribeLocalEvent<DeleteOnSolutionEmptyComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<DeleteOnSolutionEmptyComponent, SolutionContainerChangedEvent>(OnSolutionChange);
SubscribeLocalEvent<DeleteOnSolutionEmptyComponent, SolutionChangedEvent>(OnSolutionChange);
}
public void OnStartup(Entity<DeleteOnSolutionEmptyComponent> entity, ref ComponentStartup args)
public void OnStartup(EntityUid uid, DeleteOnSolutionEmptyComponent component, ComponentStartup args)
{
CheckSolutions(entity);
CheckSolutions(uid, component);
}
public void OnSolutionChange(Entity<DeleteOnSolutionEmptyComponent> entity, ref SolutionContainerChangedEvent args)
public void OnSolutionChange(EntityUid uid, DeleteOnSolutionEmptyComponent component, SolutionChangedEvent args)
{
CheckSolutions(entity);
CheckSolutions(uid, component);
}
public void CheckSolutions(Entity<DeleteOnSolutionEmptyComponent> entity)
public void CheckSolutions(EntityUid uid, DeleteOnSolutionEmptyComponent component)
{
if (!TryComp(entity, out SolutionContainerManagerComponent? solutions))
if (!EntityManager.HasComponent<SolutionContainerManagerComponent>(uid))
return;
if (_solutionContainerSystem.TryGetSolution((entity.Owner, solutions), entity.Comp.Solution, out _, out var solution))
if (_solutionContainerSystem.TryGetSolution(uid, component.Solution, out var solution))
if (solution.Volume <= 0)
EntityManager.QueueDeleteEntity(entity);
EntityManager.QueueDeleteEntity(uid);
}
}
}