Make energy sword reflect projectiles and hitscan shots (#14029)

This commit is contained in:
Slava0135
2023-04-02 16:48:32 +03:00
committed by GitHub
parent b8014bc8af
commit 6412289334
16 changed files with 517 additions and 272 deletions

View File

@@ -0,0 +1,26 @@
using Content.Server.Weapons.Melee.EnergySword;
using Content.Shared.Weapons.Reflect;
namespace Content.Server.Weapons.Reflect;
public sealed class ReflectSystem : SharedReflectSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ReflectComponent, EnergySwordActivatedEvent>(EnableReflect);
SubscribeLocalEvent<ReflectComponent, EnergySwordDeactivatedEvent>(DisableReflect);
}
private void EnableReflect(EntityUid uid, ReflectComponent comp, ref EnergySwordActivatedEvent args)
{
comp.Enabled = true;
Dirty(comp);
}
private void DisableReflect(EntityUid uid, ReflectComponent comp, ref EnergySwordDeactivatedEvent args)
{
comp.Enabled = false;
Dirty(comp);
}
}