]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Revert "feat: RnD tech research console now have reroll feature (#32931)"
authorVasilis The Pikachu <vasilis@pikachu.systems>
Sun, 4 Jan 2026 16:28:09 +0000 (17:28 +0100)
committerVasilis The Pikachu <vasilis@pikachu.systems>
Sun, 4 Jan 2026 16:28:09 +0000 (17:28 +0100)
This reverts commit 1f2d80297cb81e8dbbd1c1f46aeb531a2624204c.

Discussed during the maintainer meeting and voted to be reverted at this time.

Content.Client/Research/ResearchSystem.cs
Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs
Content.Client/Research/UI/ResearchConsoleMenu.xaml
Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs
Content.Server/Research/Systems/ResearchSystem.Console.cs
Content.Server/Research/Systems/ResearchSystem.Technology.cs
Content.Shared/Research/Components/ResearchServerComponent.cs
Content.Shared/Research/Components/SharedResearchConsoleComponent.cs
Content.Shared/Research/Components/TechnologyDatabaseComponent.cs
Resources/Locale/en-US/research/components/research-console-component.ftl

index 7086fc928bcbe7e4c090379ab630b5be72f73b5c..55d953527293c81d0afdf1145a95a18152aea25f 100644 (file)
@@ -1,5 +1,8 @@
-using Content.Shared.Research.Systems;
+using Content.Shared.Research.Systems;
 
 namespace Content.Client.Research;
 
-public sealed class ResearchSystem : SharedResearchSystem;
+public sealed class ResearchSystem : SharedResearchSystem
+{
+
+}
index d5202eea5db15bc0febd201f4f2ec7a6a96de083..2895ada61fbb9ab3072067379c2229246b72c87f 100644 (file)
@@ -7,22 +7,23 @@ using Robust.Shared.Prototypes;
 namespace Content.Client.Research.UI;
 
 [UsedImplicitly]
-public sealed class ResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
+public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
 {
     [ViewVariables]
     private ResearchConsoleMenu? _consoleMenu;
 
+    public ResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
+    {
+    }
+
     protected override void Open()
     {
         base.Open();
 
-        _consoleMenu = this.CreateWindow<ResearchConsoleMenu>();
-        _consoleMenu.SetEntity(Owner);
+        var owner = Owner;
 
-        _consoleMenu.OnTechnologyRediscoverPressed += () =>
-        {
-            SendMessage(new ConsoleRediscoverTechnologyMessage());
-        };
+        _consoleMenu = this.CreateWindow<ResearchConsoleMenu>();
+        _consoleMenu.SetEntity(owner);
 
         _consoleMenu.OnTechnologyCardPressed += id =>
         {
@@ -55,7 +56,6 @@ public sealed class ResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKe
 
         if (state is not ResearchConsoleBoundInterfaceState castState)
             return;
-
         _consoleMenu?.UpdatePanels(castState);
         _consoleMenu?.UpdateInformationPanel(castState);
     }
index 8e3a74f93300a6329af8353c1d6dc74469ff079d..8de9827c0c10f3858675935b4b683a3ab7da36c6 100644 (file)
@@ -1,4 +1,4 @@
-<controls:FancyWindow xmlns="https://spacestation14.io"
+<controls:FancyWindow xmlns="https://spacestation14.io"
                       xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
                       xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
                       xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
@@ -22,7 +22,6 @@
             </BoxContainer>
             <BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalAlignment="Right">
                 <Button Name="ServerButton" Text="{Loc 'research-console-menu-server-selection-button'}" MinHeight="40"/>
-                <Button Name="RediscoverButton" Margin="0 5 0 0" ToolTip="{Loc 'research-console-menu-server-rediscover-tooltip'}" MinHeight="40"/>
             </BoxContainer>
         </BoxContainer>
         <BoxContainer Orientation="Horizontal"
index e0e60296676fa45b0a78b696557535bfc4b8feda..eafbe75fbb9e25d071bfc1bb8cbe66f68f823463 100644 (file)
@@ -12,7 +12,6 @@ using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
 using Robust.Shared.Prototypes;
-using Robust.Shared.Timing;
 using Robust.Shared.Utility;
 
 namespace Content.Client.Research.UI;
@@ -21,26 +20,15 @@ namespace Content.Client.Research.UI;
 public sealed partial class ResearchConsoleMenu : FancyWindow
 {
     public Action<string>? OnTechnologyCardPressed;
-    public Action? OnTechnologyRediscoverPressed;
     public Action? OnServerButtonPressed;
 
     [Dependency] private readonly IEntityManager _entity = default!;
     [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly IPlayerManager _player = default!;
-    [Dependency] private readonly IGameTiming _timing = default!;
-
     private readonly ResearchSystem _research;
     private readonly SpriteSystem _sprite;
     private readonly AccessReaderSystem _accessReader;
 
-    // if set to null  - we are waiting for server info and should not let rerolls
-    private TimeSpan? _nextRediscover;
-    private int _rediscoverCost;
-    private int _serverPoints;
-
-    private TimeSpan _nextUpdate;
-    private readonly TimeSpan _updateInterval = TimeSpan.FromMilliseconds(500);
-
     public EntityUid Entity;
 
     public ResearchConsoleMenu()
@@ -53,7 +41,6 @@ public sealed partial class ResearchConsoleMenu : FancyWindow
         _accessReader = _entity.System<AccessReaderSystem>();
 
         ServerButton.OnPressed += _ => OnServerButtonPressed?.Invoke();
-        RediscoverButton.OnPressed += OnRediscoverPressed;
     }
 
     public void SetEntity(EntityUid entity)
@@ -77,7 +64,9 @@ public sealed partial class ResearchConsoleMenu : FancyWindow
             MinHeight = 10
         });
 
-        var hasAccess = HasAccess();
+        var hasAccess = _player.LocalEntity is not { } local ||
+                        !_entity.TryGetComponent<AccessReaderComponent>(Entity, out var access) ||
+                        _accessReader.IsAllowed(local, Entity, access);
         foreach (var techId in database.CurrentTechnologyCards)
         {
             var tech = _prototype.Index<TechnologyPrototype>(techId);
@@ -90,12 +79,6 @@ public sealed partial class ResearchConsoleMenu : FancyWindow
         SyncTechnologyList(UnlockedCardsContainer, unlockedTech);
     }
 
-    private void UpdateRediscoverButton()
-    {
-        RediscoverButton.Disabled = !HasAccess() || _serverPoints < _rediscoverCost || _timing.CurTime < _nextRediscover;
-        RediscoverButton.Text = Loc.GetString("research-console-menu-server-rediscover-button", ("cost", _rediscoverCost));
-    }
-
     public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
     {
         var amountMsg = new FormattedMessage();
@@ -154,27 +137,6 @@ public sealed partial class ResearchConsoleMenu : FancyWindow
             };
             TierDisplayContainer.AddChild(control);
         }
-
-        _serverPoints = state.Points;
-        _rediscoverCost = state.RediscoverCost;
-        _nextRediscover = state.NextRediscover;
-
-        UpdateRediscoverButton();
-    }
-
-    private void OnRediscoverPressed(BaseButton.ButtonEventArgs args)
-    {
-        RediscoverButton.Disabled = true;
-        _nextRediscover = null;
-
-        OnTechnologyRediscoverPressed?.Invoke();
-    }
-
-    private bool HasAccess()
-    {
-        return _player.LocalEntity is not { } local
-               || !_entity.TryGetComponent<AccessReaderComponent>(Entity, out var access)
-               || _accessReader.IsAllowed(local, Entity, access);
     }
 
     /// <summary>
@@ -217,24 +179,5 @@ public sealed partial class ResearchConsoleMenu : FancyWindow
             container.Children.Remove(techControl);
         }
     }
-
-    /// <inheritdoc />
-    protected override void FrameUpdate(FrameEventArgs args)
-    {
-        base.FrameUpdate(args);
-
-        if(_nextUpdate > _timing.CurTime)
-            return;
-
-        _nextUpdate = _timing.CurTime + _updateInterval;
-
-        if (!RediscoverButton.Disabled)
-            return;
-
-        if (_nextRediscover == null || _nextRediscover > _timing.CurTime)
-            return;
-
-        UpdateRediscoverButton();
-    }
 }
 
index 045840814315e595e6a11f1a249854893722d384..baaf06ea714220a9ed55db1855a6f18c9565da2b 100644 (file)
@@ -17,7 +17,6 @@ public sealed partial class ResearchSystem
     private void InitializeConsole()
     {
         SubscribeLocalEvent<ResearchConsoleComponent, ConsoleUnlockTechnologyMessage>(OnConsoleUnlock);
-        SubscribeLocalEvent<ResearchConsoleComponent, ConsoleRediscoverTechnologyMessage>(OnRediscoverTechnology);
         SubscribeLocalEvent<ResearchConsoleComponent, BeforeActivatableUIOpenEvent>(OnConsoleBeforeUiOpened);
         SubscribeLocalEvent<ResearchConsoleComponent, ResearchServerPointsChangedEvent>(OnPointsChanged);
         SubscribeLocalEvent<ResearchConsoleComponent, ResearchRegistrationChangedEvent>(OnConsoleRegistrationChanged);
@@ -26,41 +25,6 @@ public sealed partial class ResearchSystem
         SubscribeLocalEvent<ResearchConsoleComponent, GotEmaggedEvent>(OnEmagged);
     }
 
-    private void OnRediscoverTechnology(
-        EntityUid uid,
-        ResearchConsoleComponent console,
-        ConsoleRediscoverTechnologyMessage args
-    )
-    {
-        var act = args.Actor;
-
-        if (!this.IsPowered(uid, EntityManager))
-            return;
-
-        if (!HasAccess(uid, act))
-        {
-            _popup.PopupEntity(Loc.GetString("research-console-no-access-popup"), act);
-            return;
-        }
-
-        if (!TryGetClientServer(uid, out var serverEnt, out var serverComponent))
-            return;
-
-        if(serverComponent.NextRediscover > _timing.CurTime)
-            return;
-
-        var rediscoverCost = serverComponent.RediscoverCost;
-        if (rediscoverCost > serverComponent.Points)
-            return;
-
-        serverComponent.NextRediscover = _timing.CurTime + serverComponent.RediscoverInterval;
-
-        ModifyServerPoints(serverEnt.Value, -rediscoverCost);
-        UpdateTechnologyCards(serverEnt.Value);
-        SyncClientWithServer(uid);
-        UpdateConsoleInterface(uid);
-    }
-
     private void OnConsoleUnlock(EntityUid uid, ResearchConsoleComponent component, ConsoleUnlockTechnologyMessage args)
     {
         var act = args.Actor;
@@ -71,7 +35,7 @@ public sealed partial class ResearchSystem
         if (!PrototypeManager.TryIndex<TechnologyPrototype>(args.Id, out var technologyPrototype))
             return;
 
-        if (!HasAccess(uid, act))
+        if (TryComp<AccessReaderComponent>(uid, out var access) && !_accessReader.IsAllowed(act, uid, access))
         {
             _popup.PopupEntity(Loc.GetString("research-console-no-access-popup"), act);
             return;
@@ -108,17 +72,17 @@ public sealed partial class ResearchSystem
         if (!Resolve(uid, ref component, ref clientComponent, false))
             return;
 
-        
-        var points = 0;
-        var nextRediscover = TimeSpan.MaxValue;
-        var rediscoverCost = 0;
-        if (TryGetClientServer(uid, out _, out var serverComponent, clientComponent) && clientComponent.ConnectedToServer)
+        ResearchConsoleBoundInterfaceState state;
+
+        if (TryGetClientServer(uid, out _, out var serverComponent, clientComponent))
+        {
+            var points = clientComponent.ConnectedToServer ? serverComponent.Points : 0;
+            state = new ResearchConsoleBoundInterfaceState(points);
+        }
+        else
         {
-            points = serverComponent.Points;
-            nextRediscover = serverComponent.NextRediscover;
-            rediscoverCost = serverComponent.RediscoverCost;
+            state = new ResearchConsoleBoundInterfaceState(default);
         }
-        var state = new ResearchConsoleBoundInterfaceState(points, nextRediscover, rediscoverCost);
 
         _uiSystem.SetUiState(uid, ResearchConsoleUiKey.Key, state);
     }
@@ -157,9 +121,4 @@ public sealed partial class ResearchSystem
 
         args.Handled = true;
     }
-
-    private bool HasAccess(EntityUid uid, EntityUid act)
-    {
-        return TryComp<AccessReaderComponent>(uid, out var access) && _accessReader.IsAllowed(act, uid, access);
-    }
 }
index 0c871c8071f970dadbb08529819c5c52b59c77fb..3e8888276fc0e9e85aeb0154e61f09ecc072e7c8 100644 (file)
@@ -165,10 +165,10 @@ public sealed partial class ResearchSystem
         if (args.Server != null)
             return;
         component.MainDiscipline = null;
-        component.CurrentTechnologyCards = new();
-        component.SupportedDisciplines = new();
-        component.UnlockedTechnologies = new();
-        component.UnlockedRecipes = new();
+        component.CurrentTechnologyCards = new List<string>();
+        component.SupportedDisciplines = new List<ProtoId<TechDisciplinePrototype>>();
+        component.UnlockedTechnologies = new List<ProtoId<TechnologyPrototype>>();
+        component.UnlockedRecipes = new List<ProtoId<LatheRecipePrototype>>();
         Dirty(uid, component);
     }
 }
index dab33f062d3ec098dd877e4312387f4fc3d96743..3663e760f119a75ed878db6e30bdeadd225dd754 100644 (file)
@@ -1,32 +1,26 @@
 using Robust.Shared.GameStates;
+using Robust.Shared.Serialization;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
 
 namespace Content.Shared.Research.Components;
 
-[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
 public sealed partial class ResearchServerComponent : Component
 {
     /// <summary>
     /// The name of the server
     /// </summary>
     [AutoNetworkedField]
-    [DataField]
+    [DataField("serverName"), ViewVariables(VVAccess.ReadWrite)]
     public string ServerName = "RDSERVER";
 
     /// <summary>
     /// The amount of points on the server.
     /// </summary>
     [AutoNetworkedField]
-    [DataField]
+    [DataField("points"), ViewVariables(VVAccess.ReadWrite)]
     public int Points;
 
-    /// <summary>
-    /// Cost of technology research options reroll.
-    /// </summary>
-    [AutoNetworkedField]
-    [DataField]
-    public int RediscoverCost = 2000;
-
     /// <summary>
     /// A unique numeric id representing the server
     /// </summary>
@@ -43,34 +37,27 @@ public sealed partial class ResearchServerComponent : Component
     [ViewVariables(VVAccess.ReadOnly)]
     public List<EntityUid> Clients = new();
 
-    [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
+    [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
     public TimeSpan NextUpdateTime = TimeSpan.Zero;
 
-    [DataField]
+    [DataField("researchConsoleUpdateTime"), ViewVariables(VVAccess.ReadWrite)]
     public TimeSpan ResearchConsoleUpdateTime = TimeSpan.FromSeconds(1);
-
-    /// <summary>
-    /// Time when next reroll for tech to research will be available.
-    /// </summary>
-    [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
-    public TimeSpan NextRediscover;
-
-    /// <summary>
-    /// Minimal interval between rediscover actions.
-    /// </summary>
-    [DataField]
-    public TimeSpan RediscoverInterval = TimeSpan.FromSeconds(1);
 }
 
 /// <summary>
 /// Event raised on a server's clients when the point value of the server is changed.
 /// </summary>
+/// <param name="Server"></param>
+/// <param name="Total"></param>
+/// <param name="Delta"></param>
 [ByRefEvent]
 public readonly record struct ResearchServerPointsChangedEvent(EntityUid Server, int Total, int Delta);
 
 /// <summary>
 /// Event raised every second to calculate the amount of points added to the server.
 /// </summary>
+/// <param name="Server"></param>
+/// <param name="Points"></param>
 [ByRefEvent]
 public record struct ResearchServerGetPointsPerSecondEvent(EntityUid Server, int Points);
 
index bf1269ad010b523abab44984613d97339455e8b4..6b7a210ecb8ed2a856a35a74298676da0a74f1d0 100644 (file)
@@ -9,13 +9,15 @@ namespace Content.Shared.Research.Components
     }
 
     [Serializable, NetSerializable]
-    public sealed class ConsoleUnlockTechnologyMessage(string id) : BoundUserInterfaceMessage
+    public sealed class ConsoleUnlockTechnologyMessage : BoundUserInterfaceMessage
     {
-        public string Id = id;
-    }
+        public string Id;
 
-    [Serializable, NetSerializable]
-    public sealed class ConsoleRediscoverTechnologyMessage : BoundUserInterfaceMessage;
+        public ConsoleUnlockTechnologyMessage(string id)
+        {
+            Id = id;
+        }
+    }
 
     [Serializable, NetSerializable]
     public sealed class ConsoleServerSelectionMessage : BoundUserInterfaceMessage
@@ -24,12 +26,12 @@ namespace Content.Shared.Research.Components
     }
 
     [Serializable, NetSerializable]
-    public sealed class ResearchConsoleBoundInterfaceState(int points, TimeSpan nextRediscover, int rediscoverCost) : BoundUserInterfaceState
+    public sealed class ResearchConsoleBoundInterfaceState : BoundUserInterfaceState
     {
-        public int Points = points;
-
-        public TimeSpan NextRediscover = nextRediscover;
-
-        public int RediscoverCost = rediscoverCost;
+        public int Points;
+        public ResearchConsoleBoundInterfaceState(int points)
+        {
+            Points = points;
+        }
     }
 }
index 89411a05c084f6a9ed1d06f78762d95ef4fd3644..f00338aac7fa4c7261f93cfafa26f6375f2e66cf 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.Research.Prototypes;
 using Content.Shared.Research.Systems;
 using Robust.Shared.GameStates;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 
 namespace Content.Shared.Research.Components;
 
@@ -13,12 +14,12 @@ public sealed partial class TechnologyDatabaseComponent : Component
     /// A main discipline that locks out other discipline technology past a certain tier.
     /// </summary>
     [AutoNetworkedField]
-    [DataField]
-    public ProtoId<TechDisciplinePrototype>? MainDiscipline;
+    [DataField("mainDiscipline", customTypeSerializer: typeof(PrototypeIdSerializer<TechDisciplinePrototype>))]
+    public string? MainDiscipline;
 
     [AutoNetworkedField]
-    [DataField]
-    public List<ProtoId<TechnologyPrototype>> CurrentTechnologyCards = new();
+    [DataField("currentTechnologyCards")]
+    public List<string> CurrentTechnologyCards = new();
 
     /// <summary>
     /// Which research disciplines are able to be unlocked
index 3094b4e773037f8f71459b7d3864942db1755838..5a1e074f4d4a62f3ba644514fc69889faf3e9dc6 100644 (file)
@@ -6,8 +6,6 @@ research-console-menu-main-discipline = Main Discipline: [color={$color}]{$name}
 research-console-menu-server-selection-button = Server list
 research-console-menu-server-sync-button = Sync
 research-console-menu-server-research-button = Research
-research-console-menu-server-rediscover-button = Rediscover ({$cost})
-research-console-menu-server-rediscover-tooltip = Reroll list of technologies to research
 research-console-available-text = Researchable Technologies
 research-console-unlocked-text = Unlocked Technologies
 research-console-tier-discipline-info = Tier {$tier}, [color={$color}]{$discipline}[/color]