]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Predict IntrinsicUI (#31310)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Thu, 22 Aug 2024 17:03:05 +0000 (03:03 +1000)
committerGitHub <noreply@github.com>
Thu, 22 Aug 2024 17:03:05 +0000 (13:03 -0400)
Content.Shared/UserInterface/IntrinsicUIComponent.cs [moved from Content.Server/UserInterface/IntrinsicUIComponent.cs with 59% similarity]
Content.Shared/UserInterface/IntrinsicUISystem.cs [moved from Content.Server/UserInterface/IntrinsicUISystem.cs with 73% similarity]

similarity index 59%
rename from Content.Server/UserInterface/IntrinsicUIComponent.cs
rename to Content.Shared/UserInterface/IntrinsicUIComponent.cs
index 83936edc8c479f07a16fc16ae18fc5b5dfb0efe3..ede0fd9c342baef21df28974551af1a795bc1539 100644 (file)
@@ -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.
similarity index 73%
rename from Content.Server/UserInterface/IntrinsicUISystem.cs
rename to Content.Shared/UserInterface/IntrinsicUISystem.cs
index 0f7261865dcfd03c50729c7856710d9c487f0b71..2d8c5d14801d2cf547d73f487e746367194c2307 100644 (file)
@@ -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);
     }
 }