Revert "PVS & client state handling changes" (#3151)

This commit is contained in:
Leon Friedrich
2022-08-21 07:27:16 +12:00
committed by GitHub
parent c5ba8b75c8
commit 9cd8adae93
43 changed files with 1107 additions and 1518 deletions

View File

@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using Prometheus;
using Robust.Client.GameStates;
using Robust.Client.Player;
using Robust.Client.Timing;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Network.Messages;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Robust.Client.GameObjects
@@ -18,7 +19,8 @@ namespace Robust.Client.GameObjects
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClientNetManager _networkManager = default!;
[Dependency] private readonly IClientGameTiming _gameTiming = default!;
[Dependency] private readonly IClientGameStateManager _gameStateManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
protected override int NextEntityUid { get; set; } = EntityUid.ClientUid + 1;
@@ -45,22 +47,6 @@ namespace Robust.Client.GameObjects
base.StartEntity(entity);
}
/// <inheritdoc />
public override void Dirty(EntityUid uid)
{
// Client only dirties during prediction
if (_gameTiming.InPrediction)
base.Dirty(uid);
}
/// <inheritdoc />
public override void Dirty(Component component)
{
// Client only dirties during prediction
if (_gameTiming.InPrediction)
base.Dirty(component);
}
#region IEntityNetworkManager impl
public override IEntityNetworkManager EntityNetManager => this;
@@ -81,7 +67,7 @@ namespace Robust.Client.GameObjects
{
using (histogram?.WithLabels("EntityNet").NewTimer())
{
while (_queue.Count != 0 && _queue.Peek().msg.SourceTick <= _gameTiming.LastRealTick)
while (_queue.Count != 0 && _queue.Peek().msg.SourceTick <= _gameStateManager.CurServerTick)
{
var (_, msg) = _queue.Take();
// Logger.DebugS("net.ent", "Dispatching: {0}: {1}", seq, msg);
@@ -117,7 +103,7 @@ namespace Robust.Client.GameObjects
private void HandleEntityNetworkMessage(MsgEntity message)
{
if (message.SourceTick <= _gameTiming.LastRealTick)
if (message.SourceTick <= _gameStateManager.CurServerTick)
{
DispatchMsgEntity(message);
return;