From c477d14bd4dfaf8ecaf2933ae739581716ce5d29 Mon Sep 17 00:00:00 2001 From: BotoX Date: Sun, 29 Sep 2019 01:13:55 +0200 Subject: [PATCH] DamageProxy: Add new KnockbackMaxVel from ZR --- .../damageproxy/ze_lotr_minas_tirith_v3_3.cfg | 2 +- .../ze_paranoid_rezurrection_v11_9.cfg | 2 +- .../ze_pirates_port_royal_v3_6.cfg | 2 +- .../damageproxy/ze_tesv_skyrim_v4fix.cfg | 8 +++--- DamageProxy/scripting/DamageProxy.sp | 24 +++++++++++------ includes/zombiereloaded.inc | 3 ++- includes/zr/knockback.zr.inc | 27 ++++++++++++------- 7 files changed, 43 insertions(+), 25 deletions(-) diff --git a/DamageProxy/configs/damageproxy/ze_lotr_minas_tirith_v3_3.cfg b/DamageProxy/configs/damageproxy/ze_lotr_minas_tirith_v3_3.cfg index 81047b35..b728cc31 100644 --- a/DamageProxy/configs/damageproxy/ze_lotr_minas_tirith_v3_3.cfg +++ b/DamageProxy/configs/damageproxy/ze_lotr_minas_tirith_v3_3.cfg @@ -8,7 +8,7 @@ "z1397647" // Troll { - "KnockbackMaxVel" "400" + "KnockbackMaxVel" "150" "KnockbackScale" "0.25" "FullKnife" "1" } diff --git a/DamageProxy/configs/damageproxy/ze_paranoid_rezurrection_v11_9.cfg b/DamageProxy/configs/damageproxy/ze_paranoid_rezurrection_v11_9.cfg index 0a3f29c6..7cd8039f 100644 --- a/DamageProxy/configs/damageproxy/ze_paranoid_rezurrection_v11_9.cfg +++ b/DamageProxy/configs/damageproxy/ze_paranoid_rezurrection_v11_9.cfg @@ -6,7 +6,7 @@ "KillPush" "0" } - "z147102" // Balrog + "z145917" // Balrog { "KnockbackScale" "0.0" "KillPush" "0" diff --git a/DamageProxy/configs/damageproxy/ze_pirates_port_royal_v3_6.cfg b/DamageProxy/configs/damageproxy/ze_pirates_port_royal_v3_6.cfg index 7428c0f7..39492cb1 100644 --- a/DamageProxy/configs/damageproxy/ze_pirates_port_royal_v3_6.cfg +++ b/DamageProxy/configs/damageproxy/ze_pirates_port_royal_v3_6.cfg @@ -2,7 +2,7 @@ { "z7560944" // Barbossa { - "KnockbackMaxVel" "350" + "KnockbackMaxVel" "150" "KnockbackScale" "0.50" "FullKnife" "1" } diff --git a/DamageProxy/configs/damageproxy/ze_tesv_skyrim_v4fix.cfg b/DamageProxy/configs/damageproxy/ze_tesv_skyrim_v4fix.cfg index e3afb8bf..e705b8a8 100644 --- a/DamageProxy/configs/damageproxy/ze_tesv_skyrim_v4fix.cfg +++ b/DamageProxy/configs/damageproxy/ze_tesv_skyrim_v4fix.cfg @@ -2,8 +2,8 @@ { "z1551382" // Werewolf { - "KnockbackMaxVel" "150" - "KnockbackScale" "0.25" + "KnockbackMaxVel" "100" + "KnockbackScale" "10" "FullKnife" "1" } @@ -16,8 +16,8 @@ "z1551122" // Giant { - "KnockbackMaxVel" "150" - "KnockbackScale" "0.20" + "KnockbackMaxVel" "100" + "KnockbackScale" "0.25" } "z1551162" // Dragonpriest diff --git a/DamageProxy/scripting/DamageProxy.sp b/DamageProxy/scripting/DamageProxy.sp index 26e39217..95ccc450 100644 --- a/DamageProxy/scripting/DamageProxy.sp +++ b/DamageProxy/scripting/DamageProxy.sp @@ -115,6 +115,7 @@ public void OnClientPutInServer(int client) { g_iSpecialKnife[client] = 0; g_bNoSlowdown[client] = false; + g_bRestoreHP[client] = false; g_bFullKnife[client] = false; if(g_Config) @@ -150,13 +151,17 @@ public void OnWeaponEquipped(int client, int entity) if(!g_Config.JumpToKey(sHammerID)) 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); 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(g_Config.GetNum("NoSlowDown", 0)); g_bRestoreHP[client] = view_as(g_Config.GetNum("RestoreHP", 1)); @@ -172,8 +177,9 @@ public void OnWeaponDropped(int client, int entity) { if(entity == g_iSpecialKnife[client]) { - ZR_SetClientKnockbackMaxVelocity(client, 0.0); ZR_SetClientKnockbackScale(client, 1.0); + ZR_SetClientKnockbackMaxForce(client, 0.0); + ZR_SetClientKnockbackMaxVelocity(client, -1.0); g_iSpecialKnife[client] = 0; g_bNoSlowdown[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_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]) { @@ -296,7 +302,7 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam GetEdictClassname(inflictor, sWeaponClassname, sizeof(sWeaponClassname)); if(StrEqual(sWeaponClassname, "weapon_knife")) - flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITVEL); + flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITFORCE | ZR_KNOCKBACK_LIMITVEL); } float flVelocityModifier; @@ -307,7 +313,9 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam if(g_bRestoreHP[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); if(g_bNoSlowdown[client]) diff --git a/includes/zombiereloaded.inc b/includes/zombiereloaded.inc index 861a2800..52f08be5 100644 --- a/includes/zombiereloaded.inc +++ b/includes/zombiereloaded.inc @@ -66,7 +66,8 @@ public void __pl_zombiereloaded_SetNTVOptional() MarkNativeAsOptional("ZR_SetKilledByWorld"); MarkNativeAsOptional("ZR_GetKilledByWorld"); - MarkNativeAsOptional("ZR_SetClientKnockbackMaxVelocity"); MarkNativeAsOptional("ZR_SetClientKnockbackScale"); + MarkNativeAsOptional("ZR_SetClientKnockbackMaxForce"); + MarkNativeAsOptional("ZR_SetClientKnockbackMaxVelocity"); } #endif diff --git a/includes/zr/knockback.zr.inc b/includes/zr/knockback.zr.inc index 1cd74cc8..861e251a 100644 --- a/includes/zr/knockback.zr.inc +++ b/includes/zr/knockback.zr.inc @@ -27,15 +27,8 @@ #define ZR_KNOCKBACK_CUSTOM (1<<31) #define ZR_KNOCKBACK_SCALE (1<<1) -#define ZR_KNOCKBACK_LIMITVEL (1<<2) - -/** - * Set a maximum knockback velocity. - * - * @param client The client. - * @param fVelocity Maximum knockback velocity / force. - */ -native void ZR_SetClientKnockbackMaxVelocity(int client, float fVelocity); +#define ZR_KNOCKBACK_LIMITFORCE (1<<2) +#define ZR_KNOCKBACK_LIMITVEL (1<<3) /** * Set a custom knockback scale. @@ -44,3 +37,19 @@ native void ZR_SetClientKnockbackMaxVelocity(int client, float fVelocity); * @param fScale Custom knockback scale. */ 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);