Improved bots mantling

This commit is contained in:
ineedbots 2021-05-19 15:40:14 -06:00
parent e1326342d2
commit 91044ff842

View File

@ -300,6 +300,7 @@ doBotMovement()
self endon("death");
FORWARDAMOUNT = 25;
wasMantling = false;
for (i = 0;;i+=0.05)
{
@ -309,8 +310,15 @@ doBotMovement()
// climb through windows
if (self isMantling())
{
wasMantling = true;
self crouch();
}
else if (wasMantling)
{
wasMantling = false;
self stand();
}
startPos = self.origin + (0, 0, 50);
startPosForward = startPos + anglesToForward((0, angles[1], 0)) * FORWARDAMOUNT;
@ -338,7 +346,7 @@ doBotMovement()
else
{
// check if need to crouch
if (bulletTracePassed(startPos - (0, 0, 25), startPosForward - (0, 0, 25), false, self))
if (bulletTracePassed(startPos - (0, 0, 25), startPosForward - (0, 0, 25), false, self) && !self.bot.climbing)
self crouch();
}
}
@ -532,6 +540,9 @@ stance()
if (!isDefined(toStance))
toStance = "crouch";
if(toStance == "stand" && randomInt(100) <= self.pers["bots"]["behavior"]["crouch"])
toStance = "crouch";
if(toStance == "climb")
{
self.bot.climbing = true;
@ -541,9 +552,6 @@ stance()
if(toStance != "stand" && toStance != "crouch" && toStance != "prone")
toStance = "crouch";
if(toStance == "stand" && randomInt(100) <= self.pers["bots"]["behavior"]["crouch"])
toStance = "crouch";
if(toStance == "stand")
self stand();
else if(toStance == "crouch")
@ -1786,7 +1794,7 @@ movetowards(goal)
{
self botMoveTo(goal);
if(time > 3.5)
if(time > 3500)
{
time = 0;
if(distanceSquared(self.origin, lastOri) < 128)
@ -1804,19 +1812,20 @@ movetowards(goal)
lastOri = self.origin;
}
else if(timeslow > 1.5)
else if(timeslow > 0 && (timeslow % 1000) == 0)
{
self thread doMantle();
}
else if(timeslow > 0.75)
else if(time > 2500)
{
self crouch();
if(distanceSquared(self.origin, lastOri) < 128)
self crouch();
}
wait 0.05;
time += 0.05;
time += 50;
if(lengthsquared(self getVelocity()) < 1000)
timeslow += 0.05;
timeslow += 50;
else
timeslow = 0;