Refactor FTL time tracking code to fix a UI bug (#26538)

The FTL UI on the shuttle console would reset the FTL progress bar every time you open it. This is because the server only sends "time until completion", not a start/end time. The FTL code now uses a separate start/end time so the exact same progress bar can be preserved.

For convenience, I made a StartEndTime record struct that stores the actual tuple. This is now used by the code and has some helpers.
This commit is contained in:
Pieter-Jan Briers
2024-03-30 02:40:55 +01:00
committed by GitHub
parent 72c6a14d59
commit 3b791459c7
7 changed files with 111 additions and 46 deletions

View File

@@ -19,6 +19,7 @@ using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server.Shuttles.Systems;
@@ -30,6 +31,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly BiomeSystem _biomes = default!;
[Dependency] private readonly BodySystem _bobby = default!;
[Dependency] private readonly DockingSystem _dockSystem = default!;
@@ -68,7 +70,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
public override void Update(float frameTime)
{
base.Update(frameTime);
UpdateHyperspace(frameTime);
UpdateHyperspace();
}
private void OnGridFixtureChange(EntityUid uid, FixturesComponent manager, GridFixtureChangeEvent args)