+using Content.Shared.Administration;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
+using Robust.Client.Timing;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Timing;
namespace Content.Client.Administration.UI.ManageSolutions
{
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
+ [Dependency] private readonly IClientGameTiming _timing = default!;
private NetEntity _target = NetEntity.Invalid;
private string? _selectedSolution;
private AddReagentWindow? _addReagentWindow;
private Dictionary<string, EntityUid>? _solutions;
+ private EditSolutionsEuiState? _nextState;
public EditSolutionsWindow()
{
SolutionOption.Select(selectedIndex);
_selectedSolution = (string?) SolutionOption.SelectedMetadata;
}
+
+ protected override void FrameUpdate(FrameEventArgs args)
+ {
+ // TODO: THIS IS FUCKING TERRIBLE.
+ // Ok so the problem is that this shouldn't be via an EUI at all. Why?
+ // The EUI update notification comes in *before* the game state it updates from.
+ // So the UI doesn't update properly. Heck.
+ // I didn't wanna completely rewrite this thing to work properly so instead you get terrible hacks.
+
+ if (_nextState != null && _timing.LastRealTick >= _nextState.Tick)
+ {
+ SetTargetEntity(_nextState.Target);
+ UpdateSolutions(_nextState.Solutions);
+ UpdateReagents();
+ _nextState = null;
+ }
+ }
+
+ public void SetState(EditSolutionsEuiState state)
+ {
+ _nextState = state;
+ }
}
}
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Eui;
using JetBrains.Annotations;
+using Robust.Shared.Timing;
namespace Content.Server.Administration.UI
{
public sealed class EditSolutionsEui : BaseEui
{
[Dependency] private readonly IEntityManager _entityManager = default!;
+ [Dependency] private readonly IGameTiming _gameTiming = default!;
private readonly SolutionContainerSystem _solutionContainerSystem = default!;
public readonly EntityUid Target;
else
netSolutions = null;
- return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), netSolutions);
+ return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), netSolutions, _gameTiming.CurTick);
}
}
}
using Content.Shared.Eui;
using Robust.Shared.Serialization;
+using Robust.Shared.Timing;
namespace Content.Shared.Administration
{
{
public readonly NetEntity Target;
public readonly List<(string, NetEntity)>? Solutions;
+ public readonly GameTick Tick;
- public EditSolutionsEuiState(NetEntity target, List<(string, NetEntity)>? solutions)
+ public EditSolutionsEuiState(NetEntity target, List<(string, NetEntity)>? solutions, GameTick tick)
{
Target = target;
Solutions = solutions;
+ Tick = tick;
}
}
}