DamageProxy: Add new KnockbackMaxVel from ZR
This commit is contained in:
parent
8518a0d893
commit
c477d14bd4
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
"z1397647" // Troll
|
"z1397647" // Troll
|
||||||
{
|
{
|
||||||
"KnockbackMaxVel" "400"
|
"KnockbackMaxVel" "150"
|
||||||
"KnockbackScale" "0.25"
|
"KnockbackScale" "0.25"
|
||||||
"FullKnife" "1"
|
"FullKnife" "1"
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"KillPush" "0"
|
"KillPush" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
"z147102" // Balrog
|
"z145917" // Balrog
|
||||||
{
|
{
|
||||||
"KnockbackScale" "0.0"
|
"KnockbackScale" "0.0"
|
||||||
"KillPush" "0"
|
"KillPush" "0"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"z7560944" // Barbossa
|
"z7560944" // Barbossa
|
||||||
{
|
{
|
||||||
"KnockbackMaxVel" "350"
|
"KnockbackMaxVel" "150"
|
||||||
"KnockbackScale" "0.50"
|
"KnockbackScale" "0.50"
|
||||||
"FullKnife" "1"
|
"FullKnife" "1"
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
"z1551382" // Werewolf
|
"z1551382" // Werewolf
|
||||||
{
|
{
|
||||||
"KnockbackMaxVel" "150"
|
"KnockbackMaxVel" "100"
|
||||||
"KnockbackScale" "0.25"
|
"KnockbackScale" "10"
|
||||||
"FullKnife" "1"
|
"FullKnife" "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
"z1551122" // Giant
|
"z1551122" // Giant
|
||||||
{
|
{
|
||||||
"KnockbackMaxVel" "150"
|
"KnockbackMaxVel" "100"
|
||||||
"KnockbackScale" "0.20"
|
"KnockbackScale" "0.25"
|
||||||
}
|
}
|
||||||
|
|
||||||
"z1551162" // Dragonpriest
|
"z1551162" // Dragonpriest
|
||||||
|
@ -115,6 +115,7 @@ public void OnClientPutInServer(int client)
|
|||||||
{
|
{
|
||||||
g_iSpecialKnife[client] = 0;
|
g_iSpecialKnife[client] = 0;
|
||||||
g_bNoSlowdown[client] = false;
|
g_bNoSlowdown[client] = false;
|
||||||
|
g_bRestoreHP[client] = false;
|
||||||
g_bFullKnife[client] = false;
|
g_bFullKnife[client] = false;
|
||||||
|
|
||||||
if(g_Config)
|
if(g_Config)
|
||||||
@ -150,13 +151,17 @@ public void OnWeaponEquipped(int client, int entity)
|
|||||||
if(!g_Config.JumpToKey(sHammerID))
|
if(!g_Config.JumpToKey(sHammerID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float fKnockbackMaxVel = g_Config.GetFloat("KnockbackMaxVel", 0.0);
|
|
||||||
if(fKnockbackMaxVel >= 0.0)
|
|
||||||
ZR_SetClientKnockbackMaxVelocity(client, fKnockbackMaxVel);
|
|
||||||
|
|
||||||
float fKnockbackScale = g_Config.GetFloat("KnockbackScale", 1.0);
|
float fKnockbackScale = g_Config.GetFloat("KnockbackScale", 1.0);
|
||||||
ZR_SetClientKnockbackScale(client, fKnockbackScale);
|
ZR_SetClientKnockbackScale(client, fKnockbackScale);
|
||||||
|
|
||||||
|
float fKnockbackMaxForce = g_Config.GetFloat("KnockbackMaxForce", 0.0);
|
||||||
|
if(fKnockbackMaxForce >= 0.0)
|
||||||
|
ZR_SetClientKnockbackMaxForce(client, fKnockbackMaxForce);
|
||||||
|
|
||||||
|
float fKnockbackMaxVel = g_Config.GetFloat("KnockbackMaxVel", -1.0);
|
||||||
|
if(fKnockbackMaxVel >= 0.0)
|
||||||
|
ZR_SetClientKnockbackMaxVelocity(client, fKnockbackMaxVel);
|
||||||
|
|
||||||
g_bNoSlowdown[client] = view_as<bool>(g_Config.GetNum("NoSlowDown", 0));
|
g_bNoSlowdown[client] = view_as<bool>(g_Config.GetNum("NoSlowDown", 0));
|
||||||
|
|
||||||
g_bRestoreHP[client] = view_as<bool>(g_Config.GetNum("RestoreHP", 1));
|
g_bRestoreHP[client] = view_as<bool>(g_Config.GetNum("RestoreHP", 1));
|
||||||
@ -172,8 +177,9 @@ public void OnWeaponDropped(int client, int entity)
|
|||||||
{
|
{
|
||||||
if(entity == g_iSpecialKnife[client])
|
if(entity == g_iSpecialKnife[client])
|
||||||
{
|
{
|
||||||
ZR_SetClientKnockbackMaxVelocity(client, 0.0);
|
|
||||||
ZR_SetClientKnockbackScale(client, 1.0);
|
ZR_SetClientKnockbackScale(client, 1.0);
|
||||||
|
ZR_SetClientKnockbackMaxForce(client, 0.0);
|
||||||
|
ZR_SetClientKnockbackMaxVelocity(client, -1.0);
|
||||||
g_iSpecialKnife[client] = 0;
|
g_iSpecialKnife[client] = 0;
|
||||||
g_bNoSlowdown[client] = false;
|
g_bNoSlowdown[client] = false;
|
||||||
g_bRestoreHP[client] = false;
|
g_bRestoreHP[client] = false;
|
||||||
@ -281,7 +287,7 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
|
|||||||
g_LastAttacker = attacker;
|
g_LastAttacker = attacker;
|
||||||
g_LastVictim = victim;
|
g_LastVictim = victim;
|
||||||
|
|
||||||
int flags = ZR_KNOCKBACK_CUSTOM | ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITVEL;
|
int flags = ZR_KNOCKBACK_CUSTOM | ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITFORCE | ZR_KNOCKBACK_LIMITVEL;
|
||||||
|
|
||||||
if(g_bFullKnife[victim])
|
if(g_bFullKnife[victim])
|
||||||
{
|
{
|
||||||
@ -296,7 +302,7 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
|
|||||||
GetEdictClassname(inflictor, sWeaponClassname, sizeof(sWeaponClassname));
|
GetEdictClassname(inflictor, sWeaponClassname, sizeof(sWeaponClassname));
|
||||||
|
|
||||||
if(StrEqual(sWeaponClassname, "weapon_knife"))
|
if(StrEqual(sWeaponClassname, "weapon_knife"))
|
||||||
flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITVEL);
|
flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITFORCE | ZR_KNOCKBACK_LIMITVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
float flVelocityModifier;
|
float flVelocityModifier;
|
||||||
@ -307,7 +313,9 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
|
|||||||
if(g_bRestoreHP[client])
|
if(g_bRestoreHP[client])
|
||||||
iClientHealth = GetClientHealth(client);
|
iClientHealth = GetClientHealth(client);
|
||||||
|
|
||||||
damagetype |= DMG_DROWN;
|
// Don't damage kevlar.
|
||||||
|
damagetype |= DMG_RADIATION;
|
||||||
|
|
||||||
SDKHooks_TakeDamage(victim, inflictor, attacker, damage, damagetype, weapon, damageForce, damagePosition, flags);
|
SDKHooks_TakeDamage(victim, inflictor, attacker, damage, damagetype, weapon, damageForce, damagePosition, flags);
|
||||||
|
|
||||||
if(g_bNoSlowdown[client])
|
if(g_bNoSlowdown[client])
|
||||||
|
@ -66,7 +66,8 @@ public void __pl_zombiereloaded_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("ZR_SetKilledByWorld");
|
MarkNativeAsOptional("ZR_SetKilledByWorld");
|
||||||
MarkNativeAsOptional("ZR_GetKilledByWorld");
|
MarkNativeAsOptional("ZR_GetKilledByWorld");
|
||||||
|
|
||||||
MarkNativeAsOptional("ZR_SetClientKnockbackMaxVelocity");
|
|
||||||
MarkNativeAsOptional("ZR_SetClientKnockbackScale");
|
MarkNativeAsOptional("ZR_SetClientKnockbackScale");
|
||||||
|
MarkNativeAsOptional("ZR_SetClientKnockbackMaxForce");
|
||||||
|
MarkNativeAsOptional("ZR_SetClientKnockbackMaxVelocity");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,15 +27,8 @@
|
|||||||
|
|
||||||
#define ZR_KNOCKBACK_CUSTOM (1<<31)
|
#define ZR_KNOCKBACK_CUSTOM (1<<31)
|
||||||
#define ZR_KNOCKBACK_SCALE (1<<1)
|
#define ZR_KNOCKBACK_SCALE (1<<1)
|
||||||
#define ZR_KNOCKBACK_LIMITVEL (1<<2)
|
#define ZR_KNOCKBACK_LIMITFORCE (1<<2)
|
||||||
|
#define ZR_KNOCKBACK_LIMITVEL (1<<3)
|
||||||
/**
|
|
||||||
* Set a maximum knockback velocity.
|
|
||||||
*
|
|
||||||
* @param client The client.
|
|
||||||
* @param fVelocity Maximum knockback velocity / force.
|
|
||||||
*/
|
|
||||||
native void ZR_SetClientKnockbackMaxVelocity(int client, float fVelocity);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom knockback scale.
|
* Set a custom knockback scale.
|
||||||
@ -44,3 +37,19 @@ native void ZR_SetClientKnockbackMaxVelocity(int client, float fVelocity);
|
|||||||
* @param fScale Custom knockback scale.
|
* @param fScale Custom knockback scale.
|
||||||
*/
|
*/
|
||||||
native void ZR_SetClientKnockbackScale(int client, float fScale);
|
native void ZR_SetClientKnockbackScale(int client, float fScale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a maximum knockback force per tick.
|
||||||
|
*
|
||||||
|
* @param client The client.
|
||||||
|
* @param fForce Maximum knockback force per tick.
|
||||||
|
*/
|
||||||
|
native void ZR_SetClientKnockbackMaxForce(int client, float fForce);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a maximum knockback velocity.
|
||||||
|
*
|
||||||
|
* @param client The client.
|
||||||
|
* @param fVelocity Maximum knockback velocity.
|
||||||
|
*/
|
||||||
|
native void ZR_SetClientKnockbackMaxVelocity(int client, float fVelocity);
|
||||||
|
Loading…
Reference in New Issue
Block a user