[HL25] Backport satchel charge/radio controls
Those who want the "legacy" behavior can comment the define in "satchel.cpp" called "MODERN_SATCHEL_CONTROLS".
This commit is contained in:
parent
fd9713612f
commit
1c202f5812
2 changed files with 48 additions and 22 deletions
|
@ -21,6 +21,10 @@
|
|||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
// If you want the "legacy" controls where primary attack is "throw first charge / detonate" and secondary attack is
|
||||
// "throw extra" charge, simply comment this define.
|
||||
#define MODERN_SATCHEL_CONTROLS
|
||||
|
||||
class CSatchelCharge : public CGrenade
|
||||
{
|
||||
void Spawn() override;
|
||||
|
@ -333,6 +337,13 @@ void CSatchel::Holster()
|
|||
|
||||
void CSatchel::PrimaryAttack()
|
||||
{
|
||||
#ifdef MODERN_SATCHEL_CONTROLS
|
||||
// we're reloading, don't allow fire
|
||||
if (m_chargeReady != 2)
|
||||
{
|
||||
Throw();
|
||||
}
|
||||
#else
|
||||
switch (m_chargeReady)
|
||||
{
|
||||
case 0:
|
||||
|
@ -342,28 +353,7 @@ void CSatchel::PrimaryAttack()
|
|||
break;
|
||||
case 1:
|
||||
{
|
||||
SendWeaponAnim(SATCHEL_RADIO_FIRE);
|
||||
|
||||
edict_t* pPlayer = m_pPlayer->edict();
|
||||
|
||||
CBaseEntity* pSatchel = NULL;
|
||||
|
||||
while ((pSatchel = UTIL_FindEntityInSphere(pSatchel, m_pPlayer->pev->origin, 4096)) != NULL)
|
||||
{
|
||||
if (FClassnameIs(pSatchel->pev, "monster_satchel"))
|
||||
{
|
||||
if (pSatchel->pev->owner == pPlayer)
|
||||
{
|
||||
pSatchel->Use(m_pPlayer, m_pPlayer, USE_ON, 0);
|
||||
m_chargeReady = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_chargeReady = 2;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
Detonate();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -373,15 +363,23 @@ void CSatchel::PrimaryAttack()
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CSatchel::SecondaryAttack()
|
||||
{
|
||||
#ifdef MODERN_SATCHEL_CONTROLS
|
||||
if (m_chargeReady == 1)
|
||||
{
|
||||
Detonate();
|
||||
}
|
||||
#else
|
||||
if (m_chargeReady != 2)
|
||||
{
|
||||
Throw();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -419,6 +417,33 @@ void CSatchel::Throw()
|
|||
}
|
||||
|
||||
|
||||
void CSatchel::Detonate()
|
||||
{
|
||||
SendWeaponAnim(SATCHEL_RADIO_FIRE);
|
||||
|
||||
edict_t* pPlayer = m_pPlayer->edict();
|
||||
|
||||
CBaseEntity* pSatchel = NULL;
|
||||
|
||||
while ((pSatchel = UTIL_FindEntityInSphere(pSatchel, m_pPlayer->pev->origin, 4096)) != NULL)
|
||||
{
|
||||
if (FClassnameIs(pSatchel->pev, "monster_satchel"))
|
||||
{
|
||||
if (pSatchel->pev->owner == pPlayer)
|
||||
{
|
||||
pSatchel->Use(m_pPlayer, m_pPlayer, USE_ON, 0);
|
||||
m_chargeReady = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_chargeReady = 2;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
}
|
||||
|
||||
|
||||
void CSatchel::WeaponIdle()
|
||||
{
|
||||
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
|
||||
|
|
|
@ -1129,6 +1129,7 @@ public:
|
|||
void Holster() override;
|
||||
void WeaponIdle() override;
|
||||
void Throw();
|
||||
void Detonate();
|
||||
|
||||
bool UseDecrement() override
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue