2023-04-02 16:48:32 +03:00
|
|
|
using Content.Server.Weapons.Melee.EnergySword;
|
2023-06-22 07:08:58 +03:00
|
|
|
using Content.Server.Weapons.Melee.ItemToggle;
|
2023-04-02 16:48:32 +03:00
|
|
|
using Content.Shared.Weapons.Reflect;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Weapons.Reflect;
|
|
|
|
|
|
|
|
|
|
public sealed class ReflectSystem : SharedReflectSystem
|
|
|
|
|
{
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
2023-07-30 18:07:45 -07:00
|
|
|
|
2023-04-02 16:48:32 +03:00
|
|
|
SubscribeLocalEvent<ReflectComponent, EnergySwordActivatedEvent>(EnableReflect);
|
|
|
|
|
SubscribeLocalEvent<ReflectComponent, EnergySwordDeactivatedEvent>(DisableReflect);
|
2023-06-22 07:08:58 +03:00
|
|
|
SubscribeLocalEvent<ReflectComponent, ItemToggleActivatedEvent>(ShieldEnableReflect);
|
|
|
|
|
SubscribeLocalEvent<ReflectComponent, ItemToggleDeactivatedEvent>(ShieldDisableReflect);
|
2023-04-02 16:48:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2023-06-22 07:08:58 +03:00
|
|
|
|
|
|
|
|
private void ShieldEnableReflect(EntityUid uid, ReflectComponent comp, ref ItemToggleActivatedEvent args)
|
|
|
|
|
{
|
|
|
|
|
comp.Enabled = true;
|
|
|
|
|
Dirty(comp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShieldDisableReflect(EntityUid uid, ReflectComponent comp, ref ItemToggleDeactivatedEvent args)
|
|
|
|
|
{
|
|
|
|
|
comp.Enabled = false;
|
|
|
|
|
Dirty(comp);
|
|
|
|
|
}
|
|
|
|
|
}
|