Skip to content

Enhanced custom weapons support #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
Petercov committed Apr 20, 2022
commit 37019140bd0ed63816c08303b966f1211a977d14
14 changes: 3 additions & 11 deletions sp/src/game/server/mapbase/weapon_custom_hl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ typedef struct HL2CustomMeleeData_s
float m_flDamage;
float m_flNPCDamage;
float m_flHitDelay;
Activity m_nHitActivity = ACT_INVALID;
byte m_nDamageClass;
bool m_bHitUsesMissAnim;

bool Parse(KeyValues*);
} HL2CustomMeleeData_t;
Expand Down Expand Up @@ -90,7 +90,7 @@ class CHLCustomWeaponMelee : public CBaseHLBludgeonWeapon, public ICustomWeapon
int GetBackupActivityListCount() { return 0; }

//Functions to select animation sequences
virtual Activity GetPrimaryAttackActivity(void) { return m_CustomData.m_nHitActivity; }
virtual Activity GetPrimaryAttackActivity(void) { return m_CustomData.m_bHitUsesMissAnim ? ACT_VM_MISSCENTER : BaseClass::GetPrimaryAttackActivity(); }

const char* GetWeaponScriptName() { return m_iszWeaponScriptName.Get(); }
virtual int GetDamageType() { return g_nDamageClassTypeBits[m_CustomData.m_nDamageClass]; }
Expand Down Expand Up @@ -123,15 +123,7 @@ bool HL2CustomMeleeData_s::Parse(KeyValues* pKVWeapon)
m_flMeleeRange = pkvData->GetFloat("range", 70.f);
m_flRefireRate = pkvData->GetFloat("rate", 0.7f);
m_flHitDelay = pkvData->GetFloat("hitdelay");
if (pkvData->FindKey("activity_hit"))
{
m_nHitActivity = (Activity)ActivityList_IndexForName(pkvData->GetString("activity_hit"));
}

if (m_nHitActivity == ACT_INVALID)
{
m_nHitActivity = ACT_VM_HITCENTER;
}
m_bHitUsesMissAnim = pkvData->GetBool("hit_uses_miss_anim");

const char* pszDamageClass = pkvData->GetString("damage_type", nullptr);
if (pszDamageClass)
Expand Down