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,8 +1,9 @@
using System.Numerics;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Physics;
@@ -15,7 +16,6 @@ using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Spawners;
using System.Numerics;
namespace Content.Server.Chemistry.EntitySystems
{
@@ -40,20 +40,19 @@ namespace Content.Server.Chemistry.EntitySystems
SubscribeLocalEvent<VaporComponent, StartCollideEvent>(HandleCollide);
}
private void HandleCollide(Entity<VaporComponent> entity, ref StartCollideEvent args)
private void HandleCollide(EntityUid uid, VaporComponent component, ref StartCollideEvent args)
{
if (!EntityManager.TryGetComponent(entity.Owner, out SolutionContainerManagerComponent? contents)) return;
if (!EntityManager.TryGetComponent(uid, out SolutionContainerManagerComponent? contents)) return;
foreach (var (_, soln) in _solutionContainerSystem.EnumerateSolutions((entity.Owner, contents)))
foreach (var value in contents.Solutions.Values)
{
var solution = soln.Comp.Solution;
_reactive.DoEntityReaction(args.OtherEntity, solution, ReactionMethod.Touch);
_reactive.DoEntityReaction(args.OtherEntity, value, ReactionMethod.Touch);
}
// Check for collision with a impassable object (e.g. wall) and stop
if ((args.OtherFixture.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && args.OtherFixture.Hard)
{
EntityManager.QueueDeleteEntity(entity);
EntityManager.QueueDeleteEntity(uid);
}
}
@@ -84,27 +83,28 @@ namespace Content.Server.Chemistry.EntitySystems
return false;
}
if (!_solutionContainerSystem.TryGetSolution(vapor.Owner, VaporComponent.SolutionName, out var vaporSolution))
if (!_solutionContainerSystem.TryGetSolution(vapor, VaporComponent.SolutionName,
out var vaporSolution))
{
return false;
}
return _solutionContainerSystem.TryAddSolution(vaporSolution.Value, solution);
return _solutionContainerSystem.TryAddSolution(vapor, vaporSolution, solution);
}
public override void Update(float frameTime)
{
var query = EntityQueryEnumerator<VaporComponent, SolutionContainerManagerComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var vaporComp, out var container, out var xform))
while (query.MoveNext(out var uid, out var vaporComp, out var solution, out var xform))
{
foreach (var (_, soln) in _solutionContainerSystem.EnumerateSolutions((uid, container)))
foreach (var (_, value) in solution.Solutions)
{
Update(frameTime, (uid, vaporComp), soln, xform);
Update(frameTime, (uid, vaporComp), value, xform);
}
}
}
private void Update(float frameTime, Entity<VaporComponent> ent, Entity<SolutionComponent> soln, TransformComponent xform)
private void Update(float frameTime, Entity<VaporComponent> ent, Solution contents, TransformComponent xform)
{
var (entity, vapor) = ent;
if (!vapor.Active)
@@ -112,7 +112,6 @@ namespace Content.Server.Chemistry.EntitySystems
vapor.ReactTimer += frameTime;
var contents = soln.Comp.Solution;
if (vapor.ReactTimer >= ReactTime && TryComp(xform.GridUid, out MapGridComponent? gridComp))
{
vapor.ReactTimer = 0;
@@ -132,7 +131,7 @@ namespace Content.Server.Chemistry.EntitySystems
reaction = reagentQuantity.Quantity;
}
_solutionContainerSystem.RemoveReagent(soln, reagentQuantity.Reagent, reaction);
_solutionContainerSystem.RemoveReagent(entity, contents, reagentQuantity.Reagent, reaction);
}
}