fix inverse effect

This commit is contained in:
Ed
2024-06-30 12:02:40 +03:00
parent 7e6be7feac
commit 7abf678bbe
3 changed files with 9 additions and 8 deletions

View File

@@ -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;
}