This commit is contained in:
Jackz 2023-04-29 10:25:49 -05:00
parent 078b7c4bf6
commit cb66da2ca2
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
50 changed files with 3176 additions and 383 deletions

View file

@ -280,6 +280,32 @@ stock void StopUsingMinigun(int client)
}
}
/**
* @brief Returns if a player is on fire
*
* @param client Client index to check
*
* @return true on fire, false otherwise
*/
stock bool L4D_IsPlayerOnFire(int client)
{
if( GetEntProp(client, Prop_Data, "m_fFlags") & FL_ONFIRE ) return true;
else return false;
}
/**
* @brief Returns if a player is burning
*
* @param client Client index to check
*
* @return true on burning, false otherwise
*/
stock bool L4D_IsPlayerBurning(int client)
{
float fBurning = GetEntPropFloat(client, Prop_Send, "m_burnPercent");
return (fBurning > 0.0) ? true : false;
}
// ==================================================
@ -713,48 +739,65 @@ stock bool L4D_HasReachedSmoker(int client)
// ==================================================
// CHARGER STOCKS - Written by "Forgetest"
// ==================================================
#define QueuedPummel_Victim 0
#define QueuedPummel_StartTime 4
#define QueuedPummel_Attacker 8
/**
* @brief Internally used to get offset to the start of queued pummel field.
*
* @return Offset into CTerrorPlayer to the start of queued pummel props
*/
static int L4D2_OffsQueuedPummelInfo()
static stock int L4D2_OffsQueuedPummelInfo()
{
static int m_hQueuedPummelVictim = -1;
if ( m_hQueuedPummelVictim == -1 )
if( m_hQueuedPummelVictim == -1 )
m_hQueuedPummelVictim = FindSendPropInfo("CTerrorPlayer", "m_pummelAttacker") + 4;
return m_hQueuedPummelVictim;
}
/**
* @brief Returns the timestamp when the queued pummel begins.
*
* @param client Client ID of the player to check
* @param client Client ID of the charger to check
*
* @return timestamp or -1.0 if no queued pummel
*/
stock float L4D2_GetQueuedPummelStartTime(int client)
stock float L4D2_GetQueuedPummelStartTime(int charger)
{
return GetEntDataFloat(client, L4D2_OffsQueuedPummelInfo() + 4);
return GetEntDataFloat(charger, L4D2_OffsQueuedPummelInfo() + QueuedPummel_StartTime);
}
/**
* @brief Sets the timestamp when the queued pummel begins.
*
* @param client Client ID of the charger to check
* @param timestamp Timestamp to set
*
* @noreturn
*/
stock void L4D2_SetQueuedPummelStartTime(int charger, float timestamp)
{
SetEntDataFloat(charger, L4D2_OffsQueuedPummelInfo() + QueuedPummel_StartTime, timestamp);
}
/**
* @brief Returns if a Charger is in a queued pummel.
*
* @param client Client ID of the player to check
* @param charger Client ID of the charger to check
*
* @return true if in queued pummel, false otherwise
*/
stock bool L4D2_IsInQueuedPummel(int client)
stock bool L4D2_IsInQueuedPummel(int charger)
{
float flTimestamp = L4D2_GetQueuedPummelStartTime(client);
float flTimestamp = L4D2_GetQueuedPummelStartTime(charger);
return flTimestamp != -1.0 && flTimestamp > GetGameTime();
}
/**
* @brief Returns the victim when a Charger is in a queued pummel.
* @brief Returns the victim of a Charger in a queued pummel.
*
* @param client Client ID of the player to check
*
@ -762,11 +805,24 @@ stock bool L4D2_IsInQueuedPummel(int client)
*/
stock int L4D2_GetQueuedPummelVictim(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo());
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + QueuedPummel_Victim);
}
/**
* @brief Returns the attacker when a Survivor is in a queued pummel.
* @brief Sets the victim of a Charger in a queued pummel.
*
* @param client Client ID of the player to set
* @param target Client ID of the target to set
*
* @noreturn
*/
stock void L4D2_SetQueuedPummelVictim(int client, int target)
{
SetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + QueuedPummel_Victim, target);
}
/**
* @brief Returns the attacker of a Survivor in a queued pummel.
*
* @param client Client ID of the player to check
*
@ -774,7 +830,20 @@ stock int L4D2_GetQueuedPummelVictim(int client)
*/
stock int L4D2_GetQueuedPummelAttacker(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + 8);
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + QueuedPummel_Attacker);
}
/**
* @brief Sets the attacker of a Survivor in a queued pummel.
*
* @param client Client ID of the player to set
* @param target Client ID of the target to set
*
* @noreturn
*/
stock void L4D2_SetQueuedPummelAttacker(int client, int target)
{
SetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + QueuedPummel_Attacker, target);
}