LagCompensation: add spawnflag (1 << 30) to disable lagcomp on an entity

This commit is contained in:
BotoX 2019-11-26 21:59:47 +01:00
parent e7e73e0199
commit bbdcd3bb39
1 changed files with 7 additions and 2 deletions

View File

@ -70,6 +70,8 @@ enum
SF_TRIGGER_ONLY_NPCS_IN_VEHICLES = 0x800, // *if* NPCs can fire this trigger, only NPCs in vehicles do so (respects player ally flag too)
};
#define SF_LAGCOMP_DISABLE (1 << 30)
#define MAX_RECORDS 32
#define MAX_ENTITIES 256
//#define DEBUG
@ -447,6 +449,10 @@ bool CheckEntityForLagComp(int entity, const char[] classname, bool bRecursive=f
if(g_aLagCompensated[entity] != -1)
return false;
int SpawnFlags = GetEntData(entity, g_iSpawnFlags);
if(SpawnFlags & SF_LAGCOMP_DISABLE)
return false;
bool bTrigger = StrEqual(classname, "trigger_hurt", false) ||
StrEqual(classname, "trigger_push", false) ||
StrEqual(classname, "trigger_teleport", false);
@ -509,8 +515,7 @@ bool CheckEntityForLagComp(int entity, const char[] classname, bool bRecursive=f
{
if(bTrigger)
{
int Flags = GetEntData(entity, g_iSpawnFlags);
if(!(Flags & (SF_TRIGGER_ALLOW_PUSHABLES | SF_TRIGGER_ALLOW_PHYSICS | SF_TRIGGER_ALLOW_ALL | SF_TRIG_TOUCH_DEBRIS)))
if(!(SpawnFlags & (SF_TRIGGER_ALLOW_PUSHABLES | SF_TRIGGER_ALLOW_PHYSICS | SF_TRIGGER_ALLOW_ALL | SF_TRIG_TOUCH_DEBRIS)))
SetBit(g_aBlockTriggerMoved, entity);
}