2023-01-18 05:25:32 +11:00
|
|
|
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();
|
2024-03-24 07:33:45 +02:00
|
|
|
SubscribeLocalEvent<LavaComponent, StepTriggeredOffEvent>(OnLavaStepTriggered);
|
2023-01-18 05:25:32 +11:00
|
|
|
SubscribeLocalEvent<LavaComponent, StepTriggerAttemptEvent>(OnLavaStepTriggerAttempt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnLavaStepTriggerAttempt(EntityUid uid, LavaComponent component, ref StepTriggerAttemptEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (!HasComp<FlammableComponent>(args.Tripper))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Continue = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-24 07:33:45 +02:00
|
|
|
private void OnLavaStepTriggered(EntityUid uid, LavaComponent component, ref StepTriggeredOffEvent args)
|
2023-01-18 05:25:32 +11:00
|
|
|
{
|
|
|
|
|
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);
|
2023-08-04 21:18:09 -05:00
|
|
|
_flammable.Ignite(otherUid, uid, flammable);
|
2023-01-18 05:25:32 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|