mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-05-09 21:54:51 +00:00
sprint improvements
This commit is contained in:
parent
8f5f1e0572
commit
bdea53b670
@ -136,6 +136,7 @@ resetBotVars()
|
||||
self.bot.stop_move = false;
|
||||
self.bot.greedy_path = false;
|
||||
self.bot.climbing = false;
|
||||
self.bot.wantsprint = false;
|
||||
self.bot.last_next_wp = -1;
|
||||
self.bot.last_second_next_wp = -1;
|
||||
|
||||
@ -277,6 +278,9 @@ doBotMovement_loop( data )
|
||||
}
|
||||
|
||||
// move!
|
||||
if ( self.bot.wantsprint && self.bot.issprinting )
|
||||
dir = ( 127, dir[1], 0 );
|
||||
|
||||
self botMovement( int( dir[0] ), int( dir[1] ) );
|
||||
}
|
||||
|
||||
@ -650,6 +654,25 @@ stance_loop()
|
||||
return;
|
||||
|
||||
self thread sprint();
|
||||
self thread setBotWantSprint();
|
||||
}
|
||||
|
||||
/*
|
||||
Stops the sprint fix when goal is completed
|
||||
*/
|
||||
setBotWantSprint()
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
self endon( "death" );
|
||||
|
||||
self notify( "setBotWantSprint" );
|
||||
self endon( "setBotWantSprint" );
|
||||
|
||||
self.bot.wantsprint = true;
|
||||
|
||||
self waittill( "kill_goal" );
|
||||
|
||||
self.bot.wantsprint = false;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1363,7 +1386,7 @@ aim_loop()
|
||||
if ( !nadeAimOffset && conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
|
||||
self thread bot_lookat( aimpos, 0.05 );
|
||||
else
|
||||
self thread bot_lookat( aimpos, aimspeed, target getVelocity() );
|
||||
self thread bot_lookat( aimpos, aimspeed, target getVelocity(), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1951,7 +1974,12 @@ movetowards( goal )
|
||||
timeslow = 0;
|
||||
time = 0;
|
||||
|
||||
while ( distanceSquared( self.origin, goal ) > level.bots_goalDistance )
|
||||
if ( self.bot.issprinting )
|
||||
tempGoalDist = level.bots_goalDistance * 2;
|
||||
else
|
||||
tempGoalDist = level.bots_goalDistance;
|
||||
|
||||
while ( distanceSquared( self.origin, goal ) > tempGoalDist )
|
||||
{
|
||||
self botMoveTo( goal );
|
||||
|
||||
@ -1993,6 +2021,11 @@ movetowards( goal )
|
||||
else
|
||||
timeslow = 0;
|
||||
|
||||
if ( self.bot.issprinting )
|
||||
tempGoalDist = level.bots_goalDistance * 2;
|
||||
else
|
||||
tempGoalDist = level.bots_goalDistance;
|
||||
|
||||
if ( stucks == 2 )
|
||||
self notify( "bad_path_internal" );
|
||||
}
|
||||
@ -2325,7 +2358,7 @@ botMoveTo( where )
|
||||
/*
|
||||
Bots will look at the pos
|
||||
*/
|
||||
bot_lookat( pos, time, vel )
|
||||
bot_lookat( pos, time, vel, doAimPredict )
|
||||
{
|
||||
self notify( "bots_aim_overlap" );
|
||||
self endon( "bots_aim_overlap" );
|
||||
@ -2340,6 +2373,9 @@ bot_lookat( pos, time, vel )
|
||||
if ( !isDefined( pos ) )
|
||||
return;
|
||||
|
||||
if ( !isDefined( doAimPredict ) )
|
||||
doAimPredict = false;
|
||||
|
||||
if ( !isDefined( time ) )
|
||||
time = 0.05;
|
||||
|
||||
@ -2352,9 +2388,13 @@ bot_lookat( pos, time, vel )
|
||||
steps = 1;
|
||||
|
||||
myEye = self GetEyePos(); // get our eye pos
|
||||
myEye += ( self getVelocity() * 0.05 ) * ( steps - 1 ); // account for our velocity
|
||||
|
||||
pos += ( vel * 0.05 ) * ( steps - 1 ); // add the velocity vector
|
||||
if ( doAimPredict )
|
||||
{
|
||||
myEye += ( self getVelocity() * 0.05 ) * ( steps - 1 ); // account for our velocity
|
||||
|
||||
pos += ( vel * 0.05 ) * ( steps - 1 ); // add the velocity vector
|
||||
}
|
||||
|
||||
myAngle = self getPlayerAngles();
|
||||
angles = VectorToAngles( ( pos - myEye ) - anglesToForward( myAngle ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user