Predict IntrinsicUI (#31310)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.UserInterface;
|
||||
namespace Content.Shared.UserInterface;
|
||||
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class IntrinsicUIComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
@@ -15,8 +15,8 @@ public sealed partial class IntrinsicUIComponent : Component
|
||||
[DataDefinition]
|
||||
public sealed partial class IntrinsicUIEntry
|
||||
{
|
||||
[DataField("toggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>), required: true)]
|
||||
public string? ToggleAction;
|
||||
[DataField("toggleAction", required: true)]
|
||||
public EntProtoId? ToggleAction;
|
||||
|
||||
/// <summary>
|
||||
/// The action used for this BUI.
|
||||
@@ -1,14 +1,11 @@
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Actions;
|
||||
|
||||
namespace Content.Server.UserInterface;
|
||||
namespace Content.Shared.UserInterface;
|
||||
|
||||
public sealed class IntrinsicUISystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -32,9 +29,9 @@ public sealed class IntrinsicUISystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public bool InteractUI(EntityUid uid, Enum key, IntrinsicUIComponent? iui = null, ActorComponent? actor = null)
|
||||
public bool InteractUI(EntityUid uid, Enum key, IntrinsicUIComponent? iui = null)
|
||||
{
|
||||
if (!Resolve(uid, ref iui, ref actor))
|
||||
if (!Resolve(uid, ref iui))
|
||||
return false;
|
||||
|
||||
var attempt = new IntrinsicUIOpenAttemptEvent(uid, key);
|
||||
@@ -42,7 +39,7 @@ public sealed class IntrinsicUISystem : EntitySystem
|
||||
if (attempt.Cancelled)
|
||||
return false;
|
||||
|
||||
return _uiSystem.TryToggleUi(uid, key, actor.PlayerSession);
|
||||
return _uiSystem.TryToggleUi(uid, key, uid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user