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