Fix action-granting items not being predicted (#20778)

* Ensure actions are predicted

* Fix test fail
This commit is contained in:
Leon Friedrich
2023-10-08 06:08:13 +11:00
committed by GitHub
parent 29a77bc54e
commit 3101e5a18d
17 changed files with 91 additions and 31 deletions

View File

@@ -1,11 +1,8 @@
using Content.Shared.Actions;
using Content.Shared.CombatMode;
using Content.Shared.Communications;
using Content.Shared.Doors.Components;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Inventory.Events;
using Content.Shared.Ninja.Components;
@@ -14,7 +11,6 @@ using Content.Shared.Research.Components;
using Content.Shared.Timing;
using Content.Shared.Toggleable;
using Robust.Shared.Timing;
using System.Diagnostics.CodeAnalysis;
namespace Content.Shared.Ninja.Systems;
@@ -26,11 +22,10 @@ public abstract class SharedNinjaGlovesSystem : EntitySystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
[Dependency] protected readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] protected readonly SharedInteractionSystem Interaction = default!;
[Dependency] private readonly SharedSpaceNinjaSystem _ninja = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
public override void Initialize()
{
@@ -39,6 +34,13 @@ public abstract class SharedNinjaGlovesSystem : EntitySystem
SubscribeLocalEvent<NinjaGlovesComponent, GetItemActionsEvent>(OnGetItemActions);
SubscribeLocalEvent<NinjaGlovesComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<NinjaGlovesComponent, GotUnequippedEvent>(OnUnequipped);
SubscribeLocalEvent<NinjaGlovesComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(EntityUid uid, NinjaGlovesComponent component, MapInitEvent args)
{
_actionContainer.EnsureAction(uid, ref component.ToggleActionEntity, component.ToggleAction);
Dirty(uid, component);
}
/// <summary>