DamageProxy improvements and API fix
This commit is contained in:
parent
28a543d1a9
commit
50bbbfcf6d
@ -9,13 +9,13 @@
|
||||
"z1397647" // Troll
|
||||
{
|
||||
"KnockbackMaxVel" "400"
|
||||
"KnockbackScale" "0.40"
|
||||
"KnockbackScale" "0.25"
|
||||
"FullKnife" "1"
|
||||
}
|
||||
|
||||
"z2420963" // Balrog
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.05"
|
||||
"KnockbackScale" "0.0"
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
"items"
|
||||
{
|
||||
"z1385" // Nazgul
|
||||
{
|
||||
"KnockbackMaxVel" "500"
|
||||
"KnockbackScale" "1.0"
|
||||
}
|
||||
}
|
23
DamageProxy/configs/damageproxy/ze_mountain_escape_v5_zy.cfg
Normal file
23
DamageProxy/configs/damageproxy/ze_mountain_escape_v5_zy.cfg
Normal file
@ -0,0 +1,23 @@
|
||||
"items"
|
||||
{
|
||||
"z1783" // Nazgul
|
||||
{
|
||||
"KnockbackMaxVel" "500"
|
||||
"KnockbackScale" "1.0"
|
||||
}
|
||||
|
||||
"z2530359" // Balrog
|
||||
{
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z11197" // Titan
|
||||
{
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z1910977" // Pyramid Head
|
||||
{
|
||||
"KillPush" "0"
|
||||
}
|
||||
}
|
@ -2,37 +2,21 @@
|
||||
{
|
||||
"z145960" // T-Rex
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.01"
|
||||
"KnockbackScale" "0.0"
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z147102" // Balrog
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.01"
|
||||
"KnockbackScale" "0.0"
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z144572" // Titan
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.01"
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z144536" // Pyramid Head
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.01"
|
||||
"KillPush" "0"
|
||||
}
|
||||
|
||||
"z146285" // Zombie Dog
|
||||
{
|
||||
"KnockbackMaxVel" "50"
|
||||
"KnockbackScale" "0.01"
|
||||
"KnockbackScale" "0.0"
|
||||
"KillPush" "0"
|
||||
"FullKnife" "1"
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
{
|
||||
"z7560944" // Barbossa
|
||||
{
|
||||
"KnockbackMaxVel" "250"
|
||||
"KnockbackMaxVel" "350"
|
||||
"KnockbackScale" "0.50"
|
||||
"FullKnife" "1"
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,14 @@
|
||||
{
|
||||
"KnockbackMaxVel" "150"
|
||||
"KnockbackScale" "0.25"
|
||||
"FullKnife" "1"
|
||||
}
|
||||
|
||||
"z1551093" // Troll
|
||||
{
|
||||
"KnockbackMaxVel" "150"
|
||||
"KnockbackScale" "0.25"
|
||||
"FullKnife" "1"
|
||||
}
|
||||
|
||||
"z1551122" // Giant
|
||||
|
@ -21,6 +21,7 @@ bool g_bLateLoad = false;
|
||||
|
||||
Handle g_hFireBulletDetour;
|
||||
int g_hVelocityModifier;
|
||||
int g_hActiveWeapon;
|
||||
|
||||
int g_LastAttacker = 0;
|
||||
int g_LastVictim = 0;
|
||||
@ -29,6 +30,7 @@ char g_iPhysboxToClient[2048];
|
||||
|
||||
int g_iSpecialKnife[MAXPLAYERS + 1];
|
||||
bool g_bNoSlowdown[MAXPLAYERS + 1];
|
||||
bool g_bFullKnife[MAXPLAYERS + 1];
|
||||
|
||||
KeyValues g_Config;
|
||||
|
||||
@ -41,6 +43,7 @@ public void OnPluginStart()
|
||||
g_hFireBulletDetour = DHookCreateFromConf(hGameData, "CCSPlayer__FireBullet");
|
||||
if(!g_hFireBulletDetour)
|
||||
SetFailState("Failed to setup detour for CCSPlayer__FireBullet");
|
||||
|
||||
delete hGameData;
|
||||
|
||||
if(!DHookEnableDetour(g_hFireBulletDetour, false, Detour_OnFireBullet))
|
||||
@ -49,6 +52,10 @@ public void OnPluginStart()
|
||||
g_hVelocityModifier = FindSendPropInfo("CCSPlayer", "m_flVelocityModifier");
|
||||
if(g_hVelocityModifier == -1)
|
||||
SetFailState("Couldn't find CCSPlayer::m_flVelocityModifier");
|
||||
|
||||
g_hActiveWeapon = FindSendPropInfo("CBaseCombatCharacter", "m_hActiveWeapon");
|
||||
if(g_hActiveWeapon == -1)
|
||||
SetFailState("Couldn't find CBaseCombatCharacter::m_hActiveWeapon");
|
||||
}
|
||||
|
||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||
@ -107,6 +114,7 @@ public void OnClientPutInServer(int client)
|
||||
{
|
||||
g_iSpecialKnife[client] = 0;
|
||||
g_bNoSlowdown[client] = false;
|
||||
g_bFullKnife[client] = false;
|
||||
|
||||
if(g_Config)
|
||||
{
|
||||
@ -141,16 +149,17 @@ public void OnWeaponEquipped(int client, int entity)
|
||||
if(!g_Config.JumpToKey(sHammerID))
|
||||
return;
|
||||
|
||||
float fKnockbackMaxVel = g_Config.GetFloat("KnockbackMaxVel", -1.0);
|
||||
if(fKnockbackMaxVel > 0.0)
|
||||
float fKnockbackMaxVel = g_Config.GetFloat("KnockbackMaxVel", 0.0);
|
||||
if(fKnockbackMaxVel >= 0.0)
|
||||
ZR_SetClientKnockbackMaxVelocity(client, fKnockbackMaxVel);
|
||||
|
||||
float fKnockbackScale = g_Config.GetFloat("KnockbackScale", -1.0);
|
||||
if(fKnockbackScale > 0.0)
|
||||
ZR_SetClientKnockbackScale(client, fKnockbackScale);
|
||||
float fKnockbackScale = g_Config.GetFloat("KnockbackScale", 1.0);
|
||||
ZR_SetClientKnockbackScale(client, fKnockbackScale);
|
||||
|
||||
g_bNoSlowdown[client] = view_as<bool>(g_Config.GetNum("NoSlowDown", 0));
|
||||
|
||||
g_bFullKnife[client] = view_as<bool>(g_Config.GetNum("FullKnife", 0));
|
||||
|
||||
g_iSpecialKnife[client] = entity;
|
||||
|
||||
CheckChildren(client, entity);
|
||||
@ -164,6 +173,7 @@ public void OnWeaponDropped(int client, int entity)
|
||||
ZR_SetClientKnockbackScale(client, 1.0);
|
||||
g_iSpecialKnife[client] = 0;
|
||||
g_bNoSlowdown[client] = false;
|
||||
g_bFullKnife[client] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,15 +277,38 @@ 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;
|
||||
|
||||
if(g_bFullKnife[victim])
|
||||
{
|
||||
char sWeaponClassname[64];
|
||||
if(inflictor == attacker)
|
||||
{
|
||||
int iWeapon = GetClientActiveWeapon(attacker);
|
||||
if(iWeapon > 0)
|
||||
GetEdictClassname(iWeapon, sWeaponClassname, sizeof(sWeaponClassname));
|
||||
}
|
||||
else
|
||||
GetEdictClassname(inflictor, sWeaponClassname, sizeof(sWeaponClassname));
|
||||
|
||||
if(StrEqual(sWeaponClassname, "weapon_knife"))
|
||||
flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITVEL);
|
||||
}
|
||||
|
||||
float flVelocityModifier = 1.0;
|
||||
if(g_bNoSlowdown[client])
|
||||
flVelocityModifier = GetEntDataFloat(client, g_hVelocityModifier);
|
||||
|
||||
damagetype |= DMG_DROWN;
|
||||
SDKHooks_TakeDamage(victim, inflictor, attacker, damage, damagetype, weapon, damageForce, damagePosition, 1);
|
||||
SDKHooks_TakeDamage(victim, inflictor, attacker, damage, damagetype, weapon, damageForce, damagePosition, flags);
|
||||
|
||||
if(g_bNoSlowdown[client] && flVelocityModifier >= 0.99)
|
||||
SetEntDataFloat(client, g_hVelocityModifier, 1.0, true);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
stock int GetClientActiveWeapon(int client)
|
||||
{
|
||||
return GetEntDataEnt2(client, g_hActiveWeapon);
|
||||
}
|
||||
|
@ -25,6 +25,10 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#define ZR_KNOCKBACK_CUSTOM (1<<31)
|
||||
#define ZR_KNOCKBACK_SCALE (1<<1)
|
||||
#define ZR_KNOCKBACK_LIMITVEL (1<<2)
|
||||
|
||||
/**
|
||||
* Set a maximum knockback velocity.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user