Fix action-granting items not being predicted (#20778)
* Ensure actions are predicted * Fix test fail
This commit is contained in:
@@ -30,7 +30,7 @@ public sealed partial class StealthClothingComponent : Component
|
||||
/// <summary>
|
||||
/// The action for enabling and disabling stealth.
|
||||
/// </summary>
|
||||
[DataField("toggleActionEntity")] public EntityUid? ToggleActionEntity;
|
||||
[DataField, AutoNetworkedField] public EntityUid? ToggleActionEntity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Content.Shared.Clothing.EntitySystems;
|
||||
public sealed class StealthClothingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedStealthSystem _stealth = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -21,6 +22,13 @@ public sealed class StealthClothingSystem : EntitySystem
|
||||
SubscribeLocalEvent<StealthClothingComponent, ToggleStealthEvent>(OnToggleStealth);
|
||||
SubscribeLocalEvent<StealthClothingComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
||||
SubscribeLocalEvent<StealthClothingComponent, GotUnequippedEvent>(OnUnequipped);
|
||||
SubscribeLocalEvent<StealthClothingComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, StealthClothingComponent component, MapInitEvent args)
|
||||
{
|
||||
_actionContainer.EnsureAction(uid, ref component.ToggleActionEntity, component.ToggleAction);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,6 +15,7 @@ public abstract class SharedMagbootsSystem : EntitySystem
|
||||
[Dependency] private readonly ClothingSystem _clothing = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _sharedActions = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionContainer = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _sharedContainer = default!;
|
||||
[Dependency] private readonly SharedItemSystem _item = default!;
|
||||
@@ -27,6 +28,13 @@ public abstract class SharedMagbootsSystem : EntitySystem
|
||||
SubscribeLocalEvent<MagbootsComponent, InventoryRelayedEvent<SlipAttemptEvent>>(OnSlipAttempt);
|
||||
SubscribeLocalEvent<MagbootsComponent, GetItemActionsEvent>(OnGetActions);
|
||||
SubscribeLocalEvent<MagbootsComponent, ToggleMagbootsEvent>(OnToggleMagboots);
|
||||
SubscribeLocalEvent<MagbootsComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, MagbootsComponent component, MapInitEvent args)
|
||||
{
|
||||
_actionContainer.AddAction(uid, ref component.ToggleActionEntity, component.ToggleAction);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnToggleMagboots(EntityUid uid, MagbootsComponent component, ToggleMagbootsEvent args)
|
||||
@@ -55,7 +63,7 @@ public abstract class SharedMagbootsSystem : EntitySystem
|
||||
|
||||
_appearance.SetData(uid, ToggleVisuals.Toggled, magboots.On);
|
||||
OnChanged(uid, magboots);
|
||||
Dirty(magboots);
|
||||
Dirty(uid, magboots);
|
||||
}
|
||||
|
||||
protected virtual void UpdateMagbootEffects(EntityUid parent, EntityUid uid, bool state, MagbootsComponent? component) { }
|
||||
|
||||
Reference in New Issue
Block a user