Files
tbd-station-14/Content.Server/Tiles/LavaSystem.cs
KISS 54dd273f66 Landmine stepoff (#22962)
* make landmine work on stepping off

* update methods naming

* made both step modes possible

* updated stepoff event raise to not interfere with game physics internals

* added comments

* figuring out how audiosystem works

* added beep sound effect, updated how stepoff trigger works to make it more consistent

* updated source in attributions.yml

* made stepoff working every time

* introduced suggested changes

* updated janitor's WetSignMine to have audio

* made cleaner events and bashing my head at OnEndCollide event raise

* inverted conditional where applicable

* review

---------

Co-authored-by: Yurii Kis <yurii.kis@smartteksas.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-03-24 16:33:45 +11:00

39 lines
1.3 KiB
C#

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, StepTriggeredOffEvent>(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 StepTriggeredOffEvent 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, uid, flammable);
}
}
}