This commit is contained in:
metalgearsloth
2023-01-18 05:25:32 +11:00
committed by GitHub
parent 4456229836
commit 6c9ce79387
27 changed files with 405 additions and 22 deletions

View File

@@ -0,0 +1,23 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Server.Tiles;
/// <summary>
/// Applies flammable and damage while vaulting.
/// </summary>
[RegisterComponent, Access(typeof(LavaSystem))]
public sealed class LavaComponent : Component
{
/// <summary>
/// Sound played if something disintegrates in lava.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("soundDisintegration")]
public SoundSpecifier DisintegrationSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
/// <summary>
/// How many fire stacks are applied per second.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("fireStacks")]
public float FireStacks = 2f;
}

View File

@@ -0,0 +1,39 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.StepTrigger.Systems;
namespace Content.Server.Tiles;
public sealed class LavaSystem : EntitySystem
{
[Dependency] private readonly FlammableSystem _flammable = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LavaComponent, StepTriggeredEvent>(OnLavaStepTriggered);
SubscribeLocalEvent<LavaComponent, StepTriggerAttemptEvent>(OnLavaStepTriggerAttempt);
}
private void OnLavaStepTriggerAttempt(EntityUid uid, LavaComponent component, ref StepTriggerAttemptEvent args)
{
if (!HasComp<FlammableComponent>(args.Tripper))
return;
args.Continue = true;
}
private void OnLavaStepTriggered(EntityUid uid, LavaComponent component, ref StepTriggeredEvent args)
{
var otherUid = args.Tripper;
if (TryComp<FlammableComponent>(otherUid, out var flammable))
{
// Apply the fury of a thousand suns
var multiplier = flammable.FireStacks == 0f ? 5f : 1f;
_flammable.AdjustFireStacks(otherUid, component.FireStacks * multiplier, flammable);
_flammable.Ignite(otherUid, flammable);
}
}
}