Files
RobustToolbox/Robust.Client/GameStates/IClientGameStateManager.cs
Pieter-Jan Briers 069ebbc8d0 Make disabled prediction work again.
Simulation input and Update() does not happen when prediction is disabled. Both of these can be re-opted in on a per-handler/system basis with a bool flag. Stuff like physics opts out of this now.
2021-12-30 03:03:39 +01:00

84 lines
2.9 KiB
C#

using System;
using Robust.Shared;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;
using Robust.Shared.Timing;
namespace Robust.Client.GameStates
{
/// <summary>
/// Engine service that provides processing and management of game states.
/// </summary>
public interface IClientGameStateManager
{
/// <summary>
/// Minimum number of states needed in the buffer for everything to work.
/// </summary>
/// <remarks>
/// With interpolation enabled minimum is 3 states in buffer for the system to work (last, cur, next).
/// Without interpolation enabled minimum is 2 states in buffer for the system to work (last, cur).
/// </remarks>
int MinBufferSize { get; }
/// <summary>
/// The number of states the system is trying to keep in the buffer. This will always
/// be greater or equal to <see cref="MinBufferSize"/>.
/// </summary>
int TargetBufferSize { get; }
/// <summary>
/// Number of game states currently in the state buffer.
/// </summary>
int CurrentBufferSize { get; }
/// <summary>
/// The current tick of the last server game state applied.
/// </summary>
/// <remarks>
/// Use this to synchronize server-sent simulation events with the client's game loop.
/// </remarks>
GameTick CurServerTick { get; }
/// <summary>
/// If the buffer size is this many states larger than the target buffer size,
/// apply the overflow of states in a single tick.
/// </summary>
int StateBufferMergeThreshold { get; }
/// <summary>
/// Whether prediction is currently enabled on the client entirely.
/// This is NOT equal to <see cref="IGameTiming.InPrediction"/> or <see cref="IGameTiming.IsFirstTimePredicted"/>.
/// </summary>
/// <remarks>This is effectively an alias of <see cref="CVars.NetPredict"/>.</remarks>
bool IsPredictionEnabled { get; }
/// <summary>
/// This is called after the game state has been applied for the current tick.
/// </summary>
event Action<GameStateAppliedArgs> GameStateApplied;
/// <summary>
/// One time initialization of the service.
/// </summary>
void Initialize();
/// <summary>
/// Resets the service back to its initial state.
/// </summary>
void Reset();
/// <summary>
/// Applies the game state for this tick.
/// </summary>
void ApplyGameState();
/// <summary>
/// An input command has been dispatched.
/// </summary>
/// <param name="message">Message being dispatched.</param>
void InputCommandDispatched(FullInputCmdMessage message);
uint SystemMessageDispatched<T>(T message) where T : EntityEventArgs;
}
}