This commit is contained in:
Jackzie 2022-03-15 10:57:34 -05:00
parent 074cf2fd3c
commit aedbf9d77b
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
5 changed files with 177 additions and 32 deletions

View file

@ -109,6 +109,8 @@ enum // m_spawnflags
// ====================================================================================================
// STOCKS
// ====================================================================================================
// ==================================================
// ENGINE STOCKS
// ==================================================
static EngineVersion g_iEngine;
@ -258,7 +260,37 @@ stock int L4D_EntityParent(int entity)
*/
stock void L4D_ForcePanicEvent()
{
ServerCommand("director_force_panic_event");
static EngineVersion engine;
static int director = INVALID_ENT_REFERENCE;
if( engine == Engine_Unknown )
{
engine = GetEngineVersion();
}
if( engine == Engine_Left4Dead2 )
{
if( director == INVALID_ENT_REFERENCE || EntRefToEntIndex(director) == INVALID_ENT_REFERENCE )
{
director = FindEntityByClassname(-1, "info_director");
if( director != INVALID_ENT_REFERENCE )
{
director = EntIndexToEntRef(director);
}
}
if( director != INVALID_ENT_REFERENCE )
{
AcceptEntityInput(director, "ForcePanicEvent");
}
}
else
{
int flags = GetCommandFlags("director_force_panic_event");
SetCommandFlags("director_force_panic_event", flags & ~FCVAR_CHEAT);
ServerCommand("director_force_panic_event");
SetCommandFlags("director_force_panic_event", flags);
}
}
/**
@ -534,6 +566,9 @@ stock int L4D_GetPinnedInfected(int client)
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
return attacker;
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
return attacker;
}
return 0;
@ -619,6 +654,27 @@ stock void L4D_LedgeHangDisable(int client)
AcceptEntityInput(client, "DisableLedgeHang");
}
/**
* @brief Checks if a Survivor is currently staggering
*
* @param client Client ID of the player to affect
*
* @noreturn
*/
stock bool L4D_IsPlayerStaggering(int client)
{
static int m_iQueuedStaggerType = -1;
if( m_iQueuedStaggerType == -1 )
m_iQueuedStaggerType = FindSendPropInfo("CTerrorPlayer", "m_staggerDist") + 4;
if( GetEntData(client, m_iQueuedStaggerType, 4) == -1 )
{
return GetEntPropFloat(client, Prop_Send, "m_staggerTimer", 1) >= GetGameTime();
}
return true;
}
// ==================================================