fix inverse effect
This commit is contained in:
@@ -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<SolutionComponent>(reagentArgs.SolutionEntity, out var solutionComp))
|
||||
if (reagentArgs.SolutionEntity is null)
|
||||
return;
|
||||
|
||||
var solutionContainer = args.EntityManager.System<SharedSolutionContainerSystem>();
|
||||
|
||||
var ent = new Entity<SolutionComponent>(reagentArgs.SolutionEntity, solutionComp);
|
||||
|
||||
Dictionary<ReagentId, FixedPoint2> 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;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
private void OnReaction(Entity<SolutionComponent> 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);
|
||||
|
||||
|
||||
@@ -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<SolutionComponent>? SolutionEntity; //CP14
|
||||
|
||||
public EntityEffectReagentArgs(EntityUid targetEntity, IEntityManager entityManager, EntityUid? organEntity, Solution? source, FixedPoint2 quantity, ReagentPrototype? reagent, ReactionMethod? method, FixedPoint2 scale, Entity<SolutionComponent>? 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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user