diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/FoamArtifactComponent.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/FoamArtifactComponent.cs index 7dfec6db86..ec4e491f1a 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/FoamArtifactComponent.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/FoamArtifactComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry.Reagent; +using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; +using Content.Shared.Chemistry.Reagent; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; @@ -6,7 +7,7 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; /// /// Generates foam from the artifact when activated /// -[RegisterComponent] +[RegisterComponent, Access(typeof(FoamArtifactSystem))] public sealed class FoamArtifactComponent : Component { /// @@ -19,36 +20,30 @@ public sealed class FoamArtifactComponent : Component /// /// The foam reagent /// - [ViewVariables(VVAccess.ReadWrite)] + [DataField("selectedReagent"), ViewVariables(VVAccess.ReadWrite)] public string? SelectedReagent; /// /// How long does the foam last? /// - [DataField("duration")] + [DataField("duration"), ViewVariables(VVAccess.ReadWrite)] public float Duration = 10; /// /// How much reagent is in the foam? /// - [DataField("reagentAmount")] - public float ReagentAmount = 100; + [DataField("reagentAmount"), ViewVariables(VVAccess.ReadWrite)] + public float ReagentAmount = 200; /// /// Minimum radius of foam spawned /// - [DataField("minFoamAmount")] - public int MinFoamAmount = 2; + [DataField("minFoamAmount"), ViewVariables(VVAccess.ReadWrite)] + public int MinFoamAmount = 15; /// /// Maximum radius of foam spawned /// - [DataField("maxFoamAmount")] - public int MaxFoamAmount = 6; - - /// - /// How long it takes for each tile of foam to spawn - /// - [DataField("spreadDuration")] - public float SpreadDuration = 1; + [DataField("maxFoamAmount"), ViewVariables(VVAccess.ReadWrite)] + public int MaxFoamAmount = 20; } diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/FoamArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/FoamArtifactSystem.cs index 667d1363d9..93d9d5a01b 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/FoamArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/FoamArtifactSystem.cs @@ -1,11 +1,9 @@ using System.Linq; using Content.Server.Chemistry.Components; -using Content.Server.Chemistry.ReactionEffects; using Content.Server.Fluids.EntitySystems; using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; using Content.Shared.Chemistry.Components; -using Robust.Server.GameObjects; using Robust.Shared.Random; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; @@ -13,6 +11,7 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; public sealed class FoamArtifactSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SmokeSystem _smoke = default!; /// public override void Initialize() @@ -36,12 +35,11 @@ public sealed class FoamArtifactSystem : EntitySystem var sol = new Solution(); var xform = Transform(uid); - sol.AddReagent(component.SelectedReagent, component.ReagentAmount * - (component.MinFoamAmount + - (component.MaxFoamAmount - component.MinFoamAmount) * _random.NextFloat())); - + var range = (int) MathF.Round(MathHelper.Lerp(component.MinFoamAmount, component.MaxFoamAmount, _random.NextFloat(0, 1f))); + sol.AddReagent(component.SelectedReagent, component.ReagentAmount); var foamEnt = Spawn("Foam", xform.Coordinates); var smoke = EnsureComp(foamEnt); - EntityManager.System().Start(foamEnt, smoke, sol, 20f); + smoke.SpreadAmount = range * 4; + _smoke.Start(foamEnt, smoke, sol, component.Duration); } } diff --git a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml index 2c016148d8..72aa1974cd 100644 --- a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml @@ -302,8 +302,6 @@ effectHint: artifact-effect-hint-biochemical components: - type: FoamArtifact - spreadDuration: 0.5 - duration: 5 reagents: - Dermaline - Arithrazine @@ -433,8 +431,8 @@ effectHint: artifact-effect-hint-biochemical components: - type: FoamArtifact - spreadDuration: 0.5 - duration: 5 + minFoamAmount: 20 + maxFoamAmount: 30 reagents: - Tritium - Plasma