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