GENERAL: Allow napalm scaling, depending on damage.

This commit is contained in:
zaCade 2018-02-22 15:32:17 +01:00
parent 134ca810d0
commit fd8893ae6c
3 changed files with 22 additions and 2 deletions

View File

@ -165,6 +165,7 @@ enum CvarsList
Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD, Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD,
Handle:CVAR_NAPALM_IGNITE, Handle:CVAR_NAPALM_IGNITE,
Handle:CVAR_NAPALM_TIME_RESET, Handle:CVAR_NAPALM_TIME_RESET,
Handle:CVAR_NAPALM_TIME_SCALE,
Handle:CVAR_NAPALM_DOUSE, Handle:CVAR_NAPALM_DOUSE,
Handle:CVAR_JUMPBOOST_BHOP_PROTECT, Handle:CVAR_JUMPBOOST_BHOP_PROTECT,
Handle:CVAR_JUMPBOOST_BHOP_MAX, Handle:CVAR_JUMPBOOST_BHOP_MAX,
@ -472,6 +473,7 @@ CvarsCreate()
// =========================== // ===========================
g_hCvarsList[CVAR_NAPALM_IGNITE] = CreateConVar("zr_napalm_ignite", "1", "Ignite grenade in mid-air after player throws it. [Dependency: Human Attribute 'has_napalm']"); g_hCvarsList[CVAR_NAPALM_IGNITE] = CreateConVar("zr_napalm_ignite", "1", "Ignite grenade in mid-air after player throws it. [Dependency: Human Attribute 'has_napalm']");
g_hCvarsList[CVAR_NAPALM_TIME_RESET] = CreateConVar("zr_napalm_time_reset", "1", "The burn-time is reset when being naded multiple times. [0: Original burn-time is used.]"); g_hCvarsList[CVAR_NAPALM_TIME_RESET] = CreateConVar("zr_napalm_time_reset", "1", "The burn-time is reset when being naded multiple times. [0: Original burn-time is used.]");
g_hCvarsList[CVAR_NAPALM_TIME_SCALE] = CreateConVar("zr_napalm_time_scale", "75", "The amount of damage that's needed to apply full burn duration.");
g_hCvarsList[CVAR_NAPALM_DOUSE] = CreateConVar("zr_napalm_douse", "0", "Minimum water-saturation before flame is extinguished. ['0' = Disabled | '1' = Feet | '2' = Waist | '3' = Full submersion]"); g_hCvarsList[CVAR_NAPALM_DOUSE] = CreateConVar("zr_napalm_douse", "0", "Minimum water-saturation before flame is extinguished. ['0' = Disabled | '1' = Feet | '2' = Waist | '3' = Full submersion]");

View File

@ -229,7 +229,7 @@ public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadc
AccountOnClientHurt(index, attacker, dmg_health); AccountOnClientHurt(index, attacker, dmg_health);
SEffectsOnClientHurt(index); SEffectsOnClientHurt(index);
KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health); KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health);
NapalmOnClientHurt(index, attacker, weapon); NapalmOnClientHurt(index, attacker, weapon, dmg_health);
ZHPOnClientHurt(index); ZHPOnClientHurt(index);
} }

View File

@ -102,7 +102,7 @@ NapalmOnTakeDamage(client, damagetype)
* @param attacker The attacker index. * @param attacker The attacker index.
* @param weapon The weapon name. * @param weapon The weapon name.
*/ */
NapalmOnClientHurt(client, attacker, const String:weapon[]) NapalmOnClientHurt(client, attacker, const String:weapon[], dmg_health)
{ {
// If there's no attacker, then stop. // If there's no attacker, then stop.
if (!attacker) if (!attacker)
@ -137,6 +137,24 @@ NapalmOnClientHurt(client, attacker, const String:weapon[])
if (reset || !(flags & FL_ONFIRE)) if (reset || !(flags & FL_ONFIRE))
{ {
new Float:timescale = GetConVarFloat(g_hCvarsList[CVAR_NAPALM_TIME_SCALE])
if (timescale > 0.0)
{
// Figure out our scale value.
timescale = dmg_health / timescale;
// Make sure we dont go over 100%.
if (timescale > 1.0)
timescale = 1.0;
// Make sure we dont go below 0%.
if (timescale < 0.0)
timescale = 0.0;
// Scale our class time, accordingly.
napalm_time = napalm_time * timescale;
}
// Ignite the client or extend the current flames life. // Ignite the client or extend the current flames life.
NapalmIgniteEntity(client, napalm_time); NapalmIgniteEntity(client, napalm_time);
} }