uncloak ninja after attacking (#20892)

* raise MeleeAttackEvent on the user after swinging

* add disable bool to RevealNinja

* uncloak ninja after attacking

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-10-11 03:55:53 +01:00
committed by GitHub
parent 088832a295
commit 6db534ef86
4 changed files with 28 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ public abstract class SharedSpaceNinjaSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<SpaceNinjaComponent, AttackedEvent>(OnNinjaAttacked);
SubscribeLocalEvent<SpaceNinjaComponent, MeleeAttackEvent>(OnNinjaAttack);
SubscribeLocalEvent<SpaceNinjaComponent, ShotAttemptedEvent>(OnShotAttempted);
}
@@ -74,7 +75,19 @@ public abstract class SharedSpaceNinjaSystem : EntitySystem
{
if (comp.Suit != null && TryComp<StealthClothingComponent>(comp.Suit, out var stealthClothing) && stealthClothing.Enabled)
{
Suit.RevealNinja(comp.Suit.Value, uid, null, stealthClothing);
Suit.RevealNinja(comp.Suit.Value, uid, true, null, stealthClothing);
}
}
/// <summary>
/// Handle revealing ninja if cloaked when attacking.
/// Only reveals, there is no cooldown.
/// </summary>
private void OnNinjaAttack(EntityUid uid, SpaceNinjaComponent comp, ref MeleeAttackEvent args)
{
if (comp.Suit != null && TryComp<StealthClothingComponent>(comp.Suit, out var stealthClothing) && stealthClothing.Enabled)
{
Suit.RevealNinja(comp.Suit.Value, uid, false, null, stealthClothing);
}
}