A return to foam (foam rework) (#20831)

This commit is contained in:
Nemanja
2023-10-26 22:52:11 -04:00
committed by GitHub
parent ddaf7ddc47
commit 0670b56205
11 changed files with 303 additions and 160 deletions

View File

@@ -1,26 +0,0 @@
using Content.Shared.Fluids.Components;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Chemistry.Components;
/// <summary>
/// Stores solution on an anchored entity that has touch and ingestion reactions
/// to entities that collide with it. Similar to <see cref="PuddleComponent"/>
/// </summary>
[RegisterComponent]
public sealed partial class SmokeComponent : Component
{
public const string SolutionName = "solutionArea";
[DataField("nextReact", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextReact = TimeSpan.Zero;
[DataField("spreadAmount")]
public int SpreadAmount = 0;
/// <summary>
/// Have we reacted with our tile yet?
/// </summary>
[DataField("reactedTile")]
public bool ReactedTile = false;
}

View File

@@ -1,4 +1,3 @@
using Content.Server.Chemistry.Components;
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Audio;
using Content.Shared.Chemistry.EntitySystems;
@@ -10,7 +9,6 @@ using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -71,18 +69,10 @@ namespace Content.Server.Chemistry.ReactionEffects
var coords = grid.MapToGrid(transform.MapPosition);
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
if (!args.EntityManager.TryGetComponent<SmokeComponent>(ent, out var smokeComponent))
{
Logger.Error("Couldn't get AreaEffectComponent from " + _prototypeId);
args.EntityManager.QueueDeleteEntity(ent);
return;
}
var smoke = args.EntityManager.System<SmokeSystem>();
smokeComponent.SpreadAmount = spreadAmount;
smoke.Start(ent, smokeComponent, splitSolution, _duration);
smoke.StartSmoke(ent, splitSolution, _duration, spreadAmount);
SoundSystem.Play(_sound.GetSound(), Filter.Pvs(args.SolutionEntity), args.SolutionEntity, AudioHelpers.WithVariation(0.125f));
args.EntityManager.System<SharedAudioSystem>().PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f));
}
}
}