Puddles & spreader refactor (#15191)

This commit is contained in:
metalgearsloth
2023-04-10 15:37:03 +10:00
committed by GitHub
parent 3178ab83f6
commit 317a4013eb
141 changed files with 3046 additions and 3201 deletions

View File

@@ -14,12 +14,6 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
[RegisterComponent, Access(typeof(ChemicalPuddleArtifactSystem))]
public sealed class ChemicalPuddleArtifactComponent : Component
{
/// <summary>
/// The prototype id of the puddle
/// </summary>
[DataField("puddlePrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public string PuddlePrototype = "PuddleSmear";
/// <summary>
/// The solution where all the chemicals are stored
/// </summary>

View File

@@ -12,7 +12,7 @@ public sealed class ChemicalPuddleArtifactSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ArtifactSystem _artifact = default!;
[Dependency] private readonly SpillableSystem _spillable = default!;
[Dependency] private readonly PuddleSystem _puddle = default!;
/// <summary>
/// The key for the node data entry containing
@@ -49,6 +49,6 @@ public sealed class ChemicalPuddleArtifactSystem : EntitySystem
component.ChemicalSolution.AddReagent(reagent, amountPerChem);
}
_spillable.SpillAt(uid, component.ChemicalSolution, component.PuddlePrototype);
_puddle.TrySpillAt(uid, component.ChemicalSolution, out _);
}
}

View File

@@ -1,8 +1,11 @@
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;
@@ -33,10 +36,12 @@ public sealed class FoamArtifactSystem : EntitySystem
var sol = new Solution();
var xform = Transform(uid);
sol.AddReagent(component.SelectedReagent, component.ReagentAmount);
sol.AddReagent(component.SelectedReagent, component.ReagentAmount *
(component.MinFoamAmount +
(component.MaxFoamAmount - component.MinFoamAmount) * _random.NextFloat()));
FoamAreaReactionEffect.SpawnFoam("Foam", xform.Coordinates, sol,
_random.Next(component.MinFoamAmount, component.MaxFoamAmount), component.Duration,
component.SpreadDuration, component.SpreadDuration, entityManager: EntityManager);
var foamEnt = Spawn("Foam", xform.Coordinates);
var smoke = EnsureComp<SmokeComponent>(foamEnt);
EntityManager.System<SmokeSystem>().Start(foamEnt, smoke, sol, 20f);
}
}