diff --git a/Game.Client/C_BasePlayer.cs b/Game.Client/C_BasePlayer.cs index 1e557f4d3..ab7310dfb 100644 --- a/Game.Client/C_BasePlayer.cs +++ b/Game.Client/C_BasePlayer.cs @@ -47,6 +47,13 @@ public partial class C_BasePlayer : C_BaseCombatCharacter, IGameEventListener2 public override ShadowType ShadowCastType() => ShadowType.None; + static readonly DynamicAccessor DA_ViewOffset = FIELD.OF(nameof(ViewOffset)); + public readonly InterpolatedVar IV_ViewOffset = new($"{nameof(C_BasePlayer)}.{nameof(IV_ViewOffset)}"); + + public C_BasePlayer() { + AddVar(this, DA_ViewOffset, IV_ViewOffset, LatchFlags.LatchSimulationVar, true); + } + public static readonly DataMap PM_PlayerState = new(typeof(PlayerState), [ DEFINE.PRED_FIELD( nameof(PlayerState.DeadFlag), FieldType.Boolean, FieldTypeDescFlags.InSendTable ), ]); diff --git a/Source.Engine/CL.cs b/Source.Engine/CL.cs index 5e107fa7a..fa4da09a5 100644 --- a/Source.Engine/CL.cs +++ b/Source.Engine/CL.cs @@ -148,7 +148,8 @@ public void Move(double accumulatedExtraSamples, bool finalTick) { bool sendPacket = true; - if (Net.Time < cl.NextCmdTime || !cl.NetChannel!.CanPacket()) + if ((!cl.NetChannel!.IsLoopback() || Host.host_limitlocal.GetInt() != 0) && + (Net.Time < cl.NextCmdTime || !cl.NetChannel!.CanPacket() || !finalTick)) sendPacket = false; if (cl.IsActive()) { diff --git a/Source.Engine/Host.cs b/Source.Engine/Host.cs index 6101a6a27..8f47c5304 100644 --- a/Source.Engine/Host.cs +++ b/Source.Engine/Host.cs @@ -51,6 +51,7 @@ public partial class Host public static readonly ConVar host_map = new("host_map", "", 0, "Current map name."); public static readonly ConVar developer = new("developer", "0", 0, "Set developer message level"); public static readonly ConVar host_timescale = new("host_timescale", "1.0", FCvar.Replicated, "Prescale the clock by this amount."); + public static readonly ConVar host_limitlocal = new("host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection"); #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. public static GameClient? Client;