mirror of
https://github.com/jason-e/rngfix.git
synced 2025-12-06 18:08:33 +00:00
Fix for speed-stopping teleport hub boxes being ignored
Telehop fix will not be applied if the player also teleported the previous tick
This commit is contained in:
parent
41d7c480f6
commit
c56d7ded6d
@ -6,7 +6,7 @@
|
|||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
#define PLUGIN_VERSION "1.1.0"
|
#define PLUGIN_VERSION "1.1.1"
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
@ -48,6 +48,7 @@ int g_iLastGroundEnt[MAXPLAYERS+1];
|
|||||||
int g_iLastLandTick[MAXPLAYERS+1];
|
int g_iLastLandTick[MAXPLAYERS+1];
|
||||||
int g_iLastCollisionTick[MAXPLAYERS+1];
|
int g_iLastCollisionTick[MAXPLAYERS+1];
|
||||||
int g_iLastMapTeleportTick[MAXPLAYERS+1];
|
int g_iLastMapTeleportTick[MAXPLAYERS+1];
|
||||||
|
int g_bMapTeleportedSequentialTicks[MAXPLAYERS+1];
|
||||||
float g_vCollisionPoint[MAXPLAYERS+1][3];
|
float g_vCollisionPoint[MAXPLAYERS+1][3];
|
||||||
float g_vCollisionNormal[MAXPLAYERS+1][3];
|
float g_vCollisionNormal[MAXPLAYERS+1][3];
|
||||||
|
|
||||||
@ -347,6 +348,11 @@ public void Hook_TriggerTeleportTouchPost(int entity, int other)
|
|||||||
|
|
||||||
if (!NameExists(targetstring)) return;
|
if (!NameExists(targetstring)) return;
|
||||||
|
|
||||||
|
if (g_iLastMapTeleportTick[other] == g_iTick[other]-1)
|
||||||
|
{
|
||||||
|
g_bMapTeleportedSequentialTicks[other] = true;
|
||||||
|
}
|
||||||
|
|
||||||
g_iLastMapTeleportTick[other] = g_iTick[other];
|
g_iLastMapTeleportTick[other] = g_iTick[other];
|
||||||
|
|
||||||
DebugMsg(other, "Triggered teleport %i", entity);
|
DebugMsg(other, "Triggered teleport %i", entity);
|
||||||
@ -605,6 +611,7 @@ public MRESReturn DHook_ProcessMovementPre(Handle hParams)
|
|||||||
|
|
||||||
g_iTick[client]++;
|
g_iTick[client]++;
|
||||||
g_flFrameTime[client] = GetTickInterval() * GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
|
g_flFrameTime[client] = GetTickInterval() * GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
|
||||||
|
g_bMapTeleportedSequentialTicks[client] = false;
|
||||||
|
|
||||||
// If we are actually not doing ANY of the fixes that rely on pre-tick collision prediction, skip all this.
|
// If we are actually not doing ANY of the fixes that rely on pre-tick collision prediction, skip all this.
|
||||||
if (!g_cvUphill.BoolValue && !g_cvEdge.BoolValue && !g_cvStairs.BoolValue && !g_cvTelehop.BoolValue && !g_cvDownhill.BoolValue)
|
if (!g_cvUphill.BoolValue && !g_cvEdge.BoolValue && !g_cvStairs.BoolValue && !g_cvTelehop.BoolValue && !g_cvDownhill.BoolValue)
|
||||||
@ -1067,6 +1074,10 @@ bool DoTelehopFix(int client)
|
|||||||
|
|
||||||
if (g_iLastMapTeleportTick[client] != g_iTick[client]) return false;
|
if (g_iLastMapTeleportTick[client] != g_iTick[client]) return false;
|
||||||
|
|
||||||
|
// If the player was teleported two ticks in a row, don't do this fix because the player likely just passed
|
||||||
|
// through a speed-stopping teleport hub, and the map really did want to stop the player this way.
|
||||||
|
if (g_bMapTeleportedSequentialTicks[client]) return false;
|
||||||
|
|
||||||
// Check if we either collided this tick OR landed during this tick.
|
// Check if we either collided this tick OR landed during this tick.
|
||||||
// Note that we could have landed this tick, lost Z velocity, then gotten teleported, making us no longer on the ground.
|
// Note that we could have landed this tick, lost Z velocity, then gotten teleported, making us no longer on the ground.
|
||||||
// This is why we need to remember if we landed mid-tick rather than just check ground state now.
|
// This is why we need to remember if we landed mid-tick rather than just check ground state now.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user