diff --git a/Content.Server/_CP14/Chemistry/ReagentEffect/CP14InverseEffect.cs b/Content.Server/_CP14/Chemistry/ReagentEffect/CP14InverseEffect.cs index ee8f91c2b1..c3d0c88bd2 100644 --- a/Content.Server/_CP14/Chemistry/ReagentEffect/CP14InverseEffect.cs +++ b/Content.Server/_CP14/Chemistry/ReagentEffect/CP14InverseEffect.cs @@ -23,16 +23,14 @@ public sealed partial class CP14InverseEffect : EntityEffect { if (args is EntityEffectReagentArgs reagentArgs) { - if (reagentArgs.Source == null) + if (reagentArgs.Source is null) return; - if (!args.EntityManager.TryGetComponent(reagentArgs.SolutionEntity, out var solutionComp)) + if (reagentArgs.SolutionEntity is null) return; var solutionContainer = args.EntityManager.System(); - var ent = new Entity(reagentArgs.SolutionEntity, solutionComp); - Dictionary taskList = new(); foreach (var reagent in reagentArgs.Source.Contents) @@ -43,8 +41,8 @@ public sealed partial class CP14InverseEffect : EntityEffect foreach (var task in taskList) { - solutionContainer.RemoveReagent(ent, task.Key, task.Value); - solutionContainer.TryAddReagent(ent, Inversion[task.Key.Prototype].Id, task.Value); + solutionContainer.RemoveReagent(reagentArgs.SolutionEntity.Value, task.Key, task.Value); + solutionContainer.TryAddReagent(reagentArgs.SolutionEntity.Value, Inversion[task.Key.Prototype].Id, task.Value); } return; } diff --git a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs index 792d2f9431..7494804f83 100644 --- a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs @@ -198,7 +198,7 @@ namespace Content.Shared.Chemistry.Reaction private void OnReaction(Entity soln, ReactionPrototype reaction, ReagentPrototype? reagent, FixedPoint2 unitReactions) { - var args = new EntityEffectReagentArgs(soln, EntityManager, null, soln.Comp.Solution, unitReactions, reagent, null, 1f); + var args = new EntityEffectReagentArgs(soln, EntityManager, null, soln.Comp.Solution, unitReactions, reagent, null, 1f, soln); //CP14 soln add var posFound = _transformSystem.TryGetMapOrGridCoordinates(soln, out var gridPos); diff --git a/Content.Shared/EntityEffects/EntityEffect.cs b/Content.Shared/EntityEffects/EntityEffect.cs index 21e79f224d..8e0f2247c3 100644 --- a/Content.Shared/EntityEffects/EntityEffect.cs +++ b/Content.Shared/EntityEffects/EntityEffect.cs @@ -120,7 +120,9 @@ public record class EntityEffectReagentArgs : EntityEffectBaseArgs public FixedPoint2 Scale; - public EntityEffectReagentArgs(EntityUid targetEntity, IEntityManager entityManager, EntityUid? organEntity, Solution? source, FixedPoint2 quantity, ReagentPrototype? reagent, ReactionMethod? method, FixedPoint2 scale) : base(targetEntity, entityManager) + public Entity? SolutionEntity; //CP14 + + public EntityEffectReagentArgs(EntityUid targetEntity, IEntityManager entityManager, EntityUid? organEntity, Solution? source, FixedPoint2 quantity, ReagentPrototype? reagent, ReactionMethod? method, FixedPoint2 scale, Entity? solutionEntity = null) : base(targetEntity, entityManager) { OrganEntity = organEntity; Source = source; @@ -128,5 +130,6 @@ public record class EntityEffectReagentArgs : EntityEffectBaseArgs Reagent = reagent; Method = method; Scale = scale; + SolutionEntity = solutionEntity; //CP14 } }