2828#include " tf_weapon_medigun.h"
2929#include " func_respawnroom.h"
3030#include " soundenvelope.h"
31+ #ifdef BDSBASE
32+ #include " tf_projectile_energy_ball.h"
33+ #endif
3134
3235#include " econ_entity_creation.h"
3336
@@ -42,7 +45,9 @@ ConVar tf_bot_force_class( "tf_bot_force_class", "", FCVAR_GAMEDLL, "If set to a
4245ConVar tf_bot_notice_gunfire_range ( " tf_bot_notice_gunfire_range" , " 3000" , FCVAR_GAMEDLL );
4346ConVar tf_bot_notice_quiet_gunfire_range ( " tf_bot_notice_quiet_gunfire_range" , " 500" , FCVAR_GAMEDLL );
4447ConVar tf_bot_sniper_personal_space_range ( " tf_bot_sniper_personal_space_range" , " 1000" , FCVAR_CHEAT, " Enemies beyond this range don't worry the Sniper" );
48+ #ifndef BDSBASE
4549ConVar tf_bot_pyro_deflect_tolerance ( " tf_bot_pyro_deflect_tolerance" , " 0.5" , FCVAR_CHEAT );
50+ #endif
4651ConVar tf_bot_keep_class_after_death ( " tf_bot_keep_class_after_death" , " 0" , FCVAR_GAMEDLL );
4752ConVar tf_bot_prefix_name_with_difficulty ( " tf_bot_prefix_name_with_difficulty" , " 0" , FCVAR_GAMEDLL, " Append the skill level of the bot to the bot's name" );
4853ConVar tf_bot_near_point_travel_distance ( " tf_bot_near_point_travel_distance" , " 750" , FCVAR_CHEAT, " If within this travel distance to the current point, bot is 'near' it" );
@@ -4424,6 +4429,77 @@ bool CTFBot::ShouldFireCompressionBlast( void )
44244429 if ( pObject->IsPlayer () )
44254430 continue ;
44264431
4432+ #ifdef BDSBASE
4433+ bool bSeesProjectile = false ;
4434+
4435+ CTFBaseRocket* pBaseRocket = dynamic_cast <CTFBaseRocket*>(pObject);
4436+ if (pBaseRocket)
4437+ {
4438+ // is this something I want to deflect?
4439+ if (pBaseRocket->IsDeflectable ())
4440+ {
4441+ bSeesProjectile = true ;
4442+ }
4443+ }
4444+
4445+ if (!bSeesProjectile)
4446+ {
4447+ CTFGrenadePipebombProjectile* pBaseGrenade = dynamic_cast <CTFGrenadePipebombProjectile*>(pObject);
4448+ if (pBaseGrenade)
4449+ {
4450+ // is this something I want to deflect?
4451+ if (pBaseGrenade->IsDeflectable ())
4452+ {
4453+ bSeesProjectile = true ;
4454+ }
4455+ }
4456+ }
4457+
4458+ // we can't deflect it.
4459+ if (!bSeesProjectile)
4460+ continue ;
4461+
4462+ if (bSeesProjectile)
4463+ {
4464+ // on hard or expert, we're not restricted to what projectiles we should reflect.
4465+ // on lower difficulties, only deflect rockets or energy balls.
4466+ if (!IsDifficulty (CTFBot::HARD) && !IsDifficulty (CTFBot::EXPERT))
4467+ {
4468+ bool bCanReflectThisProj = false ;
4469+
4470+ CTFProjectile_Rocket* pRocket = dynamic_cast <CTFProjectile_Rocket*>(pObject);
4471+ if (pRocket)
4472+ {
4473+ bCanReflectThisProj = true ;
4474+ }
4475+ else
4476+ {
4477+ CTFProjectile_EnergyBall* pBall = dynamic_cast <CTFProjectile_EnergyBall*>(pObject);
4478+ if (pBall)
4479+ {
4480+ bCanReflectThisProj = true ;
4481+ }
4482+ }
4483+
4484+ if (!bCanReflectThisProj)
4485+ continue ;
4486+ }
4487+
4488+ // is it headed right for me?
4489+ Vector vecThemUnitVel = pObject->GetAbsVelocity ();
4490+ vecThemUnitVel.z = 0 .0f ;
4491+ vecThemUnitVel.NormalizeInPlace ();
4492+
4493+ Vector horzForward (vecForward.x , vecForward.y , 0 .0f );
4494+ horzForward.NormalizeInPlace ();
4495+
4496+ if (DotProduct (horzForward, vecThemUnitVel) > 0 )
4497+ continue ;
4498+
4499+ // bounce it!
4500+ return true ;
4501+ }
4502+ #else
44274503 // is this something I want to deflect?
44284504 if ( !pObject->IsDeflectable () )
44294505 continue ;
@@ -4448,6 +4524,7 @@ bool CTFBot::ShouldFireCompressionBlast( void )
44484524
44494525 // bounce it!
44504526 return true ;
4527+ #endif
44514528 }
44524529
44534530 return false ;
0 commit comments