Fix solution editor UI (#24004)

Fixes #23645

The problem is that the solution editor UI is an EUI, so the UI updates before the game states are applied.

A correct fix would be to move it to a BUI in some way, but that's a little involved as we don't really have pre-existing code that uses BUIs in a manner good for this. I decided against this because I realized we'd want to have more tools similar to this and tbh I kinda figured integrating it with VV would be a better fix instead, so...

This is a bad workaround to manually synchronize the UI updates against game timing. It's not pretty but it works.
This commit is contained in:
Pieter-Jan Briers
2024-01-13 05:52:42 +01:00
committed by GitHub
parent 2375a6cd1d
commit 3a2cd95d7f
4 changed files with 35 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Eui;
using JetBrains.Annotations;
using Robust.Shared.Timing;
namespace Content.Server.Administration.UI
{
@@ -15,6 +16,7 @@ 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;
@@ -55,7 +57,7 @@ namespace Content.Server.Administration.UI
else
netSolutions = null;
return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), netSolutions);
return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), netSolutions, _gameTiming.CurTick);
}
}
}