Fixes ninja not being able to use abilities (#23748)
* Fixes ninja not being able to use abilities * This was for testing
This commit is contained in:
@@ -3,8 +3,9 @@ using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Ninja.Components;
|
||||
using Content.Shared.Timing;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Ninja.Systems;
|
||||
|
||||
@@ -13,22 +14,25 @@ namespace Content.Shared.Ninja.Systems;
|
||||
/// </summary>
|
||||
public abstract class SharedNinjaSuitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
|
||||
[Dependency] private readonly SharedSpaceNinjaSystem _ninja = default!;
|
||||
[Dependency] protected readonly StealthClothingSystem StealthClothing = default!;
|
||||
[Dependency] protected readonly UseDelaySystem UseDelay = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
||||
[Dependency] protected readonly StealthClothingSystem StealthClothing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<NinjaSuitComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<NinjaSuitComponent, EntityUnpausedEvent>(OnEntityUnpaused);
|
||||
|
||||
SubscribeLocalEvent<NinjaSuitComponent, GotEquippedEvent>(OnEquipped);
|
||||
SubscribeLocalEvent<NinjaSuitComponent, GetItemActionsEvent>(OnGetItemActions);
|
||||
SubscribeLocalEvent<NinjaSuitComponent, AddStealthActionEvent>(OnAddStealthAction);
|
||||
SubscribeLocalEvent<NinjaSuitComponent, GotUnequippedEvent>(OnUnequipped);
|
||||
SubscribeLocalEvent<NinjaSuitComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, NinjaSuitComponent component, MapInitEvent args)
|
||||
@@ -39,6 +43,11 @@ public abstract class SharedNinjaSuitSystem : EntitySystem
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnEntityUnpaused(Entity<NinjaSuitComponent> ent, ref EntityUnpausedEvent args)
|
||||
{
|
||||
ent.Comp.DisableCooldown += args.PausedTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call the shared and serverside code for when a ninja equips the suit.
|
||||
/// </summary>
|
||||
@@ -110,10 +119,8 @@ public abstract class SharedNinjaSuitSystem : EntitySystem
|
||||
|
||||
// previously cloaked, disable abilities for a short time
|
||||
_audio.PlayPredicted(comp.RevealSound, uid, user);
|
||||
// all abilities check for a usedelay on the ninja
|
||||
var useDelay = EnsureComp<UseDelayComponent>(user);
|
||||
UseDelay.SetDelay((user, useDelay), comp.DisableTime);
|
||||
UseDelay.TryResetDelay((user, useDelay));
|
||||
Popup.PopupClient(Loc.GetString("ninja-revealed"), user, user, PopupType.MediumCaution);
|
||||
comp.DisableCooldown = GameTiming.CurTime + comp.DisableTime;
|
||||
}
|
||||
|
||||
// TODO: modify PowerCellDrain
|
||||
|
||||
Reference in New Issue
Block a user