Predict stripping (#32478)
* Predict stripping Stops mob verbs from getting moved around again. * Bola * Fix ftl
This commit is contained in:
@@ -2,7 +2,7 @@ using Content.Shared.Ensnaring;
|
||||
using Content.Shared.Ensnaring.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Ensnaring.Visualizers;
|
||||
namespace Content.Client.Ensnaring;
|
||||
|
||||
public sealed class EnsnareableSystem : SharedEnsnareableSystem
|
||||
{
|
||||
@@ -12,13 +12,14 @@ public sealed class EnsnareableSystem : SharedEnsnareableSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<EnsnareableComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<EnsnareableComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, EnsnareableComponent component, ComponentInit args)
|
||||
protected override void OnEnsnareInit(Entity<EnsnareableComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
if(!TryComp<SpriteComponent>(uid, out var sprite))
|
||||
base.OnEnsnareInit(ent, ref args);
|
||||
|
||||
if(!TryComp<SpriteComponent>(ent.Owner, out var sprite))
|
||||
return;
|
||||
|
||||
// TODO remove this, this should just be in yaml.
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Content.Client.Inventory
|
||||
StyleClasses = { StyleBase.ButtonOpenRight }
|
||||
};
|
||||
|
||||
button.OnPressed += (_) => SendMessage(new StrippingEnsnareButtonPressed());
|
||||
button.OnPressed += (_) => SendPredictedMessage(new StrippingEnsnareButtonPressed());
|
||||
|
||||
_strippingMenu.SnareContainer.AddChild(button);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace Content.Client.Inventory
|
||||
// So for now: only stripping & examining
|
||||
if (ev.Function == EngineKeyFunctions.Use)
|
||||
{
|
||||
SendMessage(new StrippingSlotButtonPressed(slot.SlotName, slot is HandButton));
|
||||
SendPredictedMessage(new StrippingSlotButtonPressed(slot.SlotName, slot is HandButton));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,12 @@ namespace Content.Client.Popups
|
||||
}
|
||||
|
||||
public override void PopupCursor(string? message, PopupType type = PopupType.Small)
|
||||
=> PopupCursorInternal(message, type, true);
|
||||
{
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
PopupCursorInternal(message, type, true);
|
||||
}
|
||||
|
||||
public override void PopupCursor(string? message, ICommonSession recipient, PopupType type = PopupType.Small)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user