37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Content.Server.Doors.Systems;
|
|
using Content.Shared._DV.CosmicCult;
|
|
using Content.Shared._DV.CosmicCult.Components;
|
|
using Content.Shared.Doors.Components;
|
|
using Robust.Shared.Audio.Systems;
|
|
|
|
namespace Content.Server._DV.CosmicCult.Abilities;
|
|
|
|
public sealed class CosmicIngressSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly CosmicCultSystem _cult = default!;
|
|
[Dependency] private readonly DoorSystem _door = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CosmicCultComponent, EventCosmicIngress>(OnCosmicIngress);
|
|
}
|
|
|
|
private void OnCosmicIngress(Entity<CosmicCultComponent> uid, ref EventCosmicIngress args)
|
|
{
|
|
var target = args.Target;
|
|
if (args.Handled)
|
|
return;
|
|
|
|
args.Handled = true;
|
|
if (uid.Comp.CosmicEmpowered && TryComp<DoorBoltComponent>(target, out var doorBolt))
|
|
_door.SetBoltsDown((target, doorBolt), false);
|
|
_door.StartOpening(target);
|
|
_audio.PlayPvs(uid.Comp.IngressSFX, uid);
|
|
Spawn(uid.Comp.AbsorbVFX, Transform(target).Coordinates);
|
|
_cult.MalignEcho(uid);
|
|
}
|
|
}
|