LagCompensation: block player from touching hooked trigger

This commit is contained in:
BotoX 2019-10-04 11:23:05 +02:00
parent 79cb2a7c08
commit d74cb89848

View File

@ -149,6 +149,10 @@ public void OnPluginStart()
public void OnPluginEnd() public void OnPluginEnd()
{ {
FilterSolidMoved(g_bNoPhysics, 0);
DHookDisableDetour(g_hUTIL_Remove, false, Detour_OnUTIL_Remove);
for(int i = 0; i < g_iNumEntities; i++) for(int i = 0; i < g_iNumEntities; i++)
{ {
if(!IsValidEntity(g_aEntityLagData[i].iEntity)) if(!IsValidEntity(g_aEntityLagData[i].iEntity))
@ -291,6 +295,8 @@ public void OnRunThinkFunctions(bool simulating)
); );
#endif #endif
} }
FilterSolidMoved(g_bNoPhysics, sizeof(g_bNoPhysics));
} }
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2]) public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
@ -314,18 +320,15 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
{ {
int simtick = GetGameTickCount() - delta; int simtick = GetGameTickCount() - delta;
if(simtick > g_aEntityLagData[i].iDeleted) if(simtick > g_aEntityLagData[i].iDeleted)
{
// TODO: completly block player from touching trigger
continue; continue;
} }
}
int iRecordIndex = g_aEntityLagData[i].iRecordIndex - delta; int iRecordIndex = g_aEntityLagData[i].iRecordIndex - delta;
if(iRecordIndex < 0) if(iRecordIndex < 0)
iRecordIndex += MAX_RECORDS; iRecordIndex += MAX_RECORDS;
RestoreEntityFromRecord(g_aEntityLagData[i].iEntity, client, g_aaLagRecords[i][iRecordIndex]); RestoreEntityFromRecord(g_aEntityLagData[i].iEntity, client, g_aaLagRecords[i][iRecordIndex]);
g_aEntityLagData[i].bRestore = true;//!g_aEntityLagData[i].iDeleted; g_aEntityLagData[i].bRestore = !g_aEntityLagData[i].iDeleted;
#if defined DEBUG #if defined DEBUG
LogMessage("2 [%d] index %d, Entity %d -> delta = %d | Record = %d", GetGameTickCount(), i, g_aEntityLagData[i].iEntity, delta, iRecordIndex); LogMessage("2 [%d] index %d, Entity %d -> delta = %d | Record = %d", GetGameTickCount(), i, g_aEntityLagData[i].iEntity, delta, iRecordIndex);
@ -342,6 +345,8 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
public void OnPostPlayerThinkFunctions() public void OnPostPlayerThinkFunctions()
{ {
FilterSolidMoved(g_bNoPhysics, 0);
for(int i = 0; i < g_iNumEntities; i++) for(int i = 0; i < g_iNumEntities; i++)
{ {
if(!g_aEntityLagData[i].bRestore) if(!g_aEntityLagData[i].bRestore)