Added bot_aim dvar

This commit is contained in:
ineedbots 2021-08-26 10:18:53 -06:00
parent ca9dad8b79
commit 79592e6056
2 changed files with 30 additions and 10 deletions

View File

@ -29,6 +29,9 @@ init()
if ( getDvar( "bots_main_waitForHostTime" ) == "" )
setDvar( "bots_main_waitForHostTime", 10.0 ); //how long to wait to wait for the host player
if ( getDvar( "bots_main_kickBotsAtEnd" ) == "" )
setDvar( "bots_main_kickBotsAtEnd", false ); //kicks the bots at game end
if ( getDvar( "bots_manage_add" ) == "" )
setDvar( "bots_manage_add", 0 ); //amount of bots to add to the game
@ -113,6 +116,9 @@ init()
if ( getDvar( "bots_play_ads" ) == "" ) //bot ads
setDvar( "bots_play_ads", true );
if ( getDvar( "bots_play_aim" ) == "" )
setDvar( "bots_play_aim", true );
if ( !isDefined( game["botWarfare"] ) )
game["botWarfare"] = true;
@ -182,6 +188,11 @@ handleBots()
wait 0.05;
setDvar( "bots_manage_add", getBotArray().size );
if ( !getDvarInt( "bots_main_kickBotsAtEnd" ) )
return;
removeAllTestClients();
}
/*

View File

@ -1302,7 +1302,9 @@ aim_loop()
}
}
if ( getDvarInt( "bots_play_aim" ) )
self botLookAt( last_pos + ( 0, 0, self getEyeHeight() + nadeAimOffset ), aimspeed );
return;
}
@ -1324,11 +1326,14 @@ aim_loop()
conedot = getConeDot( aimpos, eyePos, angles );
if ( getDvarInt( "bots_play_aim" ) )
{
if ( !nadeAimOffset && conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
self botLookAtPlayer( target, bone );
else
self botLookAt( aimpos, aimspeed );
}
}
else
{
aimpos = target.origin;
@ -1338,6 +1343,7 @@ aim_loop()
conedot = getConeDot( aimpos, eyePos, angles );
if ( getDvarInt( "bots_play_aim" ) )
self botLookAt( aimpos, aimspeed );
}
@ -1397,6 +1403,7 @@ aim_loop()
aimpos = last_pos + ( 0, 0, self getEyeHeight() + nadeAimOffset );
conedot = getConeDot( aimpos, eyePos, angles );
if ( getDvarInt( "bots_play_aim" ) )
self botLookAt( aimpos, aimspeed );
if ( !self canFire( curweap ) || !self isInRange( dist, curweap ) )
@ -1430,10 +1437,12 @@ aim_loop()
{
forwardPos = anglesToForward( level.waypoints[self.bot.next_wp].angles ) * 1024;
if ( getDvarInt( "bots_play_aim" ) )
self botLookAt( eyePos + forwardPos, aimspeed );
}
else if ( isDefined( self.bot.script_aimpos ) )
{
if ( getDvarInt( "bots_play_aim" ) )
self botLookAt( self.bot.script_aimpos, aimspeed );
}
else
@ -1445,7 +1454,7 @@ aim_loop()
else if ( isDefined( self.bot.towards_goal ) )
lookat = self.bot.towards_goal;
if ( isDefined( lookat ) )
if ( isDefined( lookat ) && getDvarInt( "bots_play_aim" ) )
self botLookAt( lookat + ( 0, 0, self getEyeHeight() ), aimspeed );
}
}