make ragdolls/ghosts ignore bullets/stabs

This commit is contained in:
hubdom 2020-08-03 13:40:17 +02:00
parent 303132ef42
commit bdb8b4e845

View File

@ -321,6 +321,7 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
RETURN_META_VALUE(MRES_IGNORED, true);
}
char lifeState = 0;
if(!iTeam)
{
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index);
@ -332,9 +333,21 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
RETURN_META_VALUE(MRES_IGNORED, true);
iTeam = pInfo->GetTeamIndex();
static int offset = 0;
if(!offset)
{
sm_sendprop_info_t spi;
if (!gamehelpers->FindSendPropInfo("CBasePlayer", "m_lifeState", &spi))
RETURN_META_VALUE(MRES_IGNORED, true);
offset = spi.actual_offset;
}
lifeState = *(char *)((uint8_t *)pHandleEntity + offset);
}
if(iTeam == g_FireBulletPlayerTeam)
if(iTeam == g_FireBulletPlayerTeam || lifeState != 0)
RETURN_META_VALUE(MRES_SUPERCEDE, false);
RETURN_META_VALUE(MRES_IGNORED, true);