Files
tbd-station-14/Content.Shared/Ninja/Systems/EnergyKatanaSystem.cs
metalgearsloth 7d2ef2bd47 Action charges refactor (#33993)
* Action charges refactor

- Fixes the slight godmoding of baseactioncomponent.
- Gets back 1ms of server time.

* chorg

* Remove FrameUpdate

* Fixes

* More fixes

* Combine

* Fixes

* Updates

* weh

* Last fixes

* weh

* Fix naughty

* YAML fixes

* This one too

* Merge conflicts

* This thing

* Review

* Fix this as well

* Icon fix

* weh

* Review

* Review

* seamless

* Review
2025-04-18 13:45:48 +10:00

36 lines
1.0 KiB
C#

using Content.Shared.Inventory.Events;
using Content.Shared.Ninja.Components;
namespace Content.Shared.Ninja.Systems;
/// <summary>
/// System for katana binding and dash events. Recalling is handled by the suit.
/// </summary>
public sealed class EnergyKatanaSystem : EntitySystem
{
[Dependency] private readonly SharedSpaceNinjaSystem _ninja = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EnergyKatanaComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<EnergyKatanaComponent, CheckDashEvent>(OnCheckDash);
}
/// <summary>
/// When equipped by a ninja, try to bind it.
/// </summary>
private void OnEquipped(Entity<EnergyKatanaComponent> ent, ref GotEquippedEvent args)
{
_ninja.BindKatana(args.Equipee, ent);
}
private void OnCheckDash(Entity<EnergyKatanaComponent> ent, ref CheckDashEvent args)
{
// Just use a whitelist fam
if (!_ninja.IsNinja(args.User))
args.Cancelled = true;
}
}