Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/game/server/neo/bot/behavior/neo_bot_behavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "bot/behavior/nav_entities/neo_bot_nav_ent_move_to.h"
#include "bot/behavior/nav_entities/neo_bot_nav_ent_wait.h"
#include "bot/behavior/neo_bot_tactical_monitor.h"
#include "weapons/weapon_balc.h"

ConVar neo_bot_path_lookahead_range( "neo_bot_path_lookahead_range", "300" );
ConVar neo_bot_sniper_aim_error( "neo_bot_sniper_aim_error", "0.01", FCVAR_CHEAT );
Expand Down Expand Up @@ -828,10 +829,22 @@ void CNEOBotMainAction::FireWeaponAtEnemy( CNEOBot *me )
{
if (myWeapon->GetNeoWepBits() & NEO_WEP_BALC)
{
auto *pBalc = static_cast<CWeaponBALC *>(myWeapon);
// Minimum viable firing BALC
// TODO: Proper heat management for higher difficulty bots
me->ReleaseWalkButton(); // NEO Jank: this actually cancels sprint
me->PressFireButton(GetFireDurationByDifficulty(me));

// NEO JANK: To simplify alt fire input management
// we allow the bot to bypass button-hold charge firing requirement
if ( (me->GetTimeSinceWeaponFired() >= pBalc->GetChargeDuration())
&& threatRange >= 300.0f )
{
pBalc->ShootGrenade(me);
}
else
{
me->PressFireButton(GetFireDurationByDifficulty(me));
}
return;
}
else if (myWeapon->m_iClip1 <= 0)
Expand Down
16 changes: 16 additions & 0 deletions src/game/server/neo/bot/behavior/neo_bot_jgr_juggernaut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "bot/neo_bot.h"
#include "bot/neo_bot_path_compute.h"
#include "bot/behavior/neo_bot_jgr_juggernaut.h"
#include "bot/behavior/neo_bot_retreat_to_cover.h"
#include "weapon_balc.h"

//---------------------------------------------------------------------------------------------
ActionResult< CNEOBot > CNEOBotJgrJuggernaut::OnStart( CNEOBot *me, Action< CNEOBot > *priorAction )
Expand All @@ -25,6 +27,20 @@ ActionResult< CNEOBot > CNEOBotJgrJuggernaut::OnStart( CNEOBot *me, Action< CNEO
//---------------------------------------------------------------------------------------------
ActionResult< CNEOBot > CNEOBotJgrJuggernaut::Update( CNEOBot *me, float interval )
{
CBaseCombatWeapon *pWeapon = me->GetActiveWeapon();
if ( pWeapon )
{
CNEOBaseCombatWeapon *pNeoWep = dynamic_cast< CNEOBaseCombatWeapon * >( pWeapon );
if ( pNeoWep && ( pNeoWep->GetNeoWepBits() & NEO_WEP_BALC ) )
{
CWeaponBALC *pBalc = static_cast< CWeaponBALC * >( pNeoWep );
if ( pBalc->m_bOverheated )
{
return SuspendFor( new CNEOBotRetreatToCover(), "BALC overheated - retreating to cover!" );
}
}
}

ActionResult< CNEOBot > result = UpdateCommon( me, interval );
if ( result.IsRequestingChange() || result.IsDone() )
return result;
Expand Down
91 changes: 51 additions & 40 deletions src/game/shared/neo/weapons/weapon_balc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,59 +137,70 @@ void CWeaponBALC::PrimaryAttack(void)
}

auto pPlayer = ToNEOPlayer(GetOwner());
if (!pPlayer)
{
Assert(false);
return;
}
ShootGrenade(pPlayer);
}
}

if ((gpGlobals->curtime - m_flLastAttackTime) > 0.5f)
{
m_nNumShotsFired = 0;
}
else
{
++m_nNumShotsFired;
}
m_flLastAttackTime = gpGlobals->curtime;
void CWeaponBALC::ShootGrenade(CNEO_Player *pPlayer)
{
if (!pPlayer)
{
Assert(false);
return;
}

SendWeaponAnim(GetPrimaryAttackActivity());
SetWeaponIdleTime(gpGlobals->curtime + 2.0);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);
if ((gpGlobals->curtime - m_flLastAttackTime) > 0.5f)
{
m_nNumShotsFired = 0;
}
else
{
++m_nNumShotsFired;
}
m_flLastAttackTime = gpGlobals->curtime;

WeaponSound(BURST);
SendWeaponAnim(GetPrimaryAttackActivity());
SetWeaponIdleTime(gpGlobals->curtime + 2.0);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);

WeaponSound(BURST);

#ifdef GAME_DLL
const Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecThrow;
const Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecThrow;

AngleVectors(pPlayer->EyeAngles() + pPlayer->GetPunchAngle(), &vecThrow);
VectorScale(vecThrow, 2000.0f, vecThrow);
AngleVectors(pPlayer->EyeAngles() + pPlayer->GetPunchAngle(), &vecThrow);
VectorScale(vecThrow, 2000.0f, vecThrow);

QAngle angles;
VectorAngles(vecThrow, angles);
CGrenadeAR2 *pGrenade = assert_cast<CGrenadeAR2*>(Create("grenade_ar2", vecSrc, angles, pPlayer));
pGrenade->SetAbsVelocity(vecThrow);
QAngle angles;
VectorAngles(vecThrow, angles);
CGrenadeAR2 *pGrenade = assert_cast<CGrenadeAR2 *>(Create("grenade_ar2", vecSrc, angles, pPlayer));
pGrenade->SetAbsVelocity(vecThrow);

pGrenade->SetLocalAngularVelocity(RandomAngle(-400, 400));
pGrenade->SetMoveType(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE);
pGrenade->SetThrower(GetOwner());
pGrenade->SetDamage(BALC_CHARGE_SHOT_DAMAGE);
pGrenade->SetLocalAngularVelocity(RandomAngle(-400, 400));
pGrenade->SetMoveType(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE);
pGrenade->SetThrower(GetOwner());
pGrenade->SetDamage(BALC_CHARGE_SHOT_DAMAGE);

CSoundEnt::InsertSound(SOUND_COMBAT, GetAbsOrigin(), 1000, 0.2, GetOwner(), SOUNDENT_CHANNEL_WEAPON);
CSoundEnt::InsertSound(SOUND_COMBAT, GetAbsOrigin(), 1000, 0.2, GetOwner(), SOUNDENT_CHANNEL_WEAPON);
pPlayer->OnMyWeaponFired(this); // to update GetTimeSinceWeaponFired
#endif
const int iAmmoCost = int((GetDefaultClip1() + 10) / BALC_CHARGE_SHOT_MAX);
m_iPrimaryAmmoCount = Max(0, m_iPrimaryAmmoCount - iAmmoCost);
const int iAmmoCost = int((GetDefaultClip1() + 10) / BALC_CHARGE_SHOT_MAX);
m_iPrimaryAmmoCount = Max(0, m_iPrimaryAmmoCount - iAmmoCost);

m_flNextPrimaryAttack = m_flNextPrimaryAttack + BALC_CHARGE_SHOT_RATE;
m_flNextPrimaryAttack = gpGlobals->curtime + BALC_CHARGE_SHOT_RATE;

m_bCharging = false;
m_bCharged = false;
m_bCharging = false;
m_bCharged = false;

//View kick
pPlayer->ViewPunchReset();
AddViewKick();
}
// View kick
pPlayer->ViewPunchReset();
AddViewKick();
Comment on lines +197 to +198
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a lot of asserts from bots using the gun here, I don't mind just being lazy because we're already letting them cheat by skipping the wind up. Maybe its from firing the gun without "actually" having fired it through the route guns expect to be fired but whatever

Suggested change
pPlayer->ViewPunchReset();
AddViewKick();
if (!pPlayer->IsBot())
{
pPlayer->ViewPunchReset();
AddViewKick();
}

}

float CWeaponBALC::GetChargeDuration() const
{
return BALC_CHARGE_DURATION;
}

void CWeaponBALC::SecondaryAttack(void)
Expand Down
2 changes: 2 additions & 0 deletions src/game/shared/neo/weapons/weapon_balc.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class CWeaponBALC : public CNEOBaseCombatWeapon
virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const override { return NEO_WEP_BALC | NEO_WEP_FIREARM; }
virtual int GetNeoWepXPCost(const int neoClass) const override { return 20; }
virtual void ItemPostFrame() override;
void ShootGrenade(CNEO_Player *pPlayer);
float GetChargeDuration() const;

virtual float GetSpeedScale(void) const OVERRIDE { return 1.0f; }

Expand Down
Loading