fix lava + affectTemp reagent effect
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.EntityEffects;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -7,7 +6,7 @@ namespace Content.Server._CP14.Chemistry.ReagentEffect;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed partial class CP14AffectSolutionTemperature : Shared.Chemistry.Reagent.ReagentEffect
|
||||
public sealed partial class CP14AffectSolutionTemperature : EntityEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// Temperature added to the solution. If negative, the solution is cooling.
|
||||
@@ -15,11 +14,6 @@ public sealed partial class CP14AffectSolutionTemperature : Shared.Chemistry.Rea
|
||||
[DataField]
|
||||
private float AddTemperature = -300f;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.Source != null)
|
||||
args.Source.Temperature += AddTemperature;
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
||||
{
|
||||
@@ -27,4 +21,18 @@ public sealed partial class CP14AffectSolutionTemperature : Shared.Chemistry.Rea
|
||||
("chance", Probability),
|
||||
("temperature", AddTemperature));
|
||||
}
|
||||
|
||||
public override void Effect(EntityEffectBaseArgs args)
|
||||
{
|
||||
if (args is EntityEffectReagentArgs reagentArgs)
|
||||
{
|
||||
if (reagentArgs.Source != null)
|
||||
reagentArgs.Source.Temperature += AddTemperature;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Someone needs to figure out how to do this for non-reagent effects.
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.EntityEffects;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -9,7 +10,7 @@ namespace Content.Server._CP14.Chemistry.ReagentEffect;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed partial class CP14InverseEffect : Shared.Chemistry.Reagent.ReagentEffect
|
||||
public sealed partial class CP14InverseEffect : EntityEffect
|
||||
{
|
||||
[DataField]
|
||||
public Dictionary<ProtoId<ReagentPrototype>, ProtoId<ReagentPrototype>> Inversion = new();
|
||||
@@ -18,30 +19,37 @@ public sealed partial class CP14InverseEffect : Shared.Chemistry.Reagent.Reagent
|
||||
return Loc.GetString("cp14-reagent-effect-guidebook-inverse-effect", ("chance", Probability));
|
||||
}
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
public override void Effect(EntityEffectBaseArgs args)
|
||||
{
|
||||
if (args.Source == null)
|
||||
return;
|
||||
|
||||
if (!args.EntityManager.TryGetComponent<SolutionComponent>(args.SolutionEntity, out var solutionComp))
|
||||
return;
|
||||
|
||||
var solutionContainer = args.EntityManager.System<SharedSolutionContainerSystem>();
|
||||
|
||||
var ent = new Entity<SolutionComponent>(args.SolutionEntity, solutionComp);
|
||||
|
||||
Dictionary<ReagentId, FixedPoint2> taskList = new();
|
||||
|
||||
foreach (var reagent in args.Source.Contents)
|
||||
if (args is EntityEffectReagentArgs reagentArgs)
|
||||
{
|
||||
if (Inversion.ContainsKey(reagent.Reagent.Prototype))
|
||||
taskList.Add(reagent.Reagent, reagent.Quantity);
|
||||
if (reagentArgs.Source == null)
|
||||
return;
|
||||
|
||||
if (!args.EntityManager.TryGetComponent<SolutionComponent>(reagentArgs.SolutionEntity, out var solutionComp))
|
||||
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)
|
||||
{
|
||||
if (Inversion.ContainsKey(reagent.Reagent.Prototype))
|
||||
taskList.Add(reagent.Reagent, reagent.Quantity);
|
||||
}
|
||||
|
||||
foreach (var task in taskList)
|
||||
{
|
||||
solutionContainer.RemoveReagent(ent, task.Key, task.Value);
|
||||
solutionContainer.TryAddReagent(ent, Inversion[task.Key.Prototype].Id, task.Value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var task in taskList)
|
||||
{
|
||||
solutionContainer.RemoveReagent(ent, task.Key, task.Value);
|
||||
solutionContainer.TryAddReagent(ent, Inversion[task.Key.Prototype].Id, task.Value);
|
||||
}
|
||||
// TODO: Someone needs to figure out how to do this for non-reagent effects.
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,20 @@
|
||||
- ItemMask
|
||||
density: 1000
|
||||
hard: false
|
||||
- type: Lava
|
||||
fireStacks: 0.2
|
||||
- type: StepTrigger
|
||||
requiredTriggeredSpeed: 0
|
||||
intersectRatio: 0.1
|
||||
blacklist:
|
||||
tags:
|
||||
- Catwalk
|
||||
- type: TileEntityEffect
|
||||
effects:
|
||||
- !type:FlammableReaction
|
||||
multiplier: 1.75
|
||||
multiplierOnExisting: 0.75
|
||||
- !type:Ignite
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: AmbientSound
|
||||
enabled: true
|
||||
volume: -5
|
||||
|
||||
Reference in New Issue
Block a user