better stuck

This commit is contained in:
ineed bots 2022-04-08 23:56:44 -06:00
parent 521e31211e
commit d8bc00708e

View File

@ -2277,11 +2277,11 @@ movetowards( goal )
{ {
self botMoveTo( goal ); self botMoveTo( goal );
if ( time > 3500 ) if ( time > 3000 )
{ {
time = 0; time = 0;
if ( distanceSquared( self.bot.moveOrigin, lastOri ) < 128 ) if ( distanceSquared( self.bot.moveOrigin, lastOri ) < 32 * 32 )
{ {
self thread knife(); self thread knife();
wait 0.5; wait 0.5;
@ -2293,6 +2293,9 @@ movetowards( goal )
self botMoveTo( randomDir ); self botMoveTo( randomDir );
wait stucks; wait stucks;
self stand(); self stand();
self.bot.last_next_wp = -1;
self.bot.last_second_next_wp = -1;
} }
lastOri = self.bot.moveOrigin; lastOri = self.bot.moveOrigin;
@ -2301,11 +2304,22 @@ movetowards( goal )
{ {
self thread doMantle(); self thread doMantle();
} }
else if ( time > 2500 ) else if ( time == 2000 )
{ {
if ( distanceSquared( self.bot.moveOrigin, lastOri ) < 128 ) if ( distanceSquared( self.bot.moveOrigin, lastOri ) < 32 * 32 )
self crouch(); self crouch();
} }
else if ( time == 1750 )
{
if ( distanceSquared( self.origin, lastOri ) < 32 * 32 )
{
// check if directly above or below
if ( abs( goal[2] - self.origin[2] ) > 64 && getConeDot( goal + ( 1, 1, 0 ), self.origin + ( -1, -1, 0 ), VectorToAngles( ( goal[0], goal[1], self.origin[2] ) - self.origin ) ) < 0.64 && DistanceSquared2D(self.origin, goal) < 32 * 32 )
{
stucks = 2;
}
}
}
wait 0.05; wait 0.05;
time += 50; time += 50;
@ -2320,7 +2334,7 @@ movetowards( goal )
else else
tempGoalDist = level.bots_goalDistance; tempGoalDist = level.bots_goalDistance;
if ( stucks == 2 ) if ( stucks >= 2 )
self notify( "bad_path_internal" ); self notify( "bad_path_internal" );
} }