mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-05-12 15:04:50 +00:00
Better crouch and mantle
This commit is contained in:
parent
3c7e07866f
commit
9744ff6ccd
@ -205,7 +205,9 @@ doBotMovement()
|
|||||||
self endon("disconnect");
|
self endon("disconnect");
|
||||||
self endon("death");
|
self endon("death");
|
||||||
|
|
||||||
for (;;)
|
FORWARDAMOUNT = 25;
|
||||||
|
|
||||||
|
for (i=0;;i+=0.05)
|
||||||
{
|
{
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
|
|
||||||
@ -213,7 +215,6 @@ doBotMovement()
|
|||||||
move_To = self.bot.moveTo;
|
move_To = self.bot.moveTo;
|
||||||
angles = self GetPlayerAngles();
|
angles = self GetPlayerAngles();
|
||||||
dir = (0, 0, 0);
|
dir = (0, 0, 0);
|
||||||
eye = self getEyePos();
|
|
||||||
|
|
||||||
if (DistanceSquared(self.origin, move_To) >= 49)
|
if (DistanceSquared(self.origin, move_To) >= 49)
|
||||||
{
|
{
|
||||||
@ -235,12 +236,40 @@ doBotMovement()
|
|||||||
dir = (dir[0], 0-dir[1], 0);
|
dir = (dir[0], 0-dir[1], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// climb through windows
|
||||||
if (self isMantling())
|
if (self isMantling())
|
||||||
self crouch();
|
self crouch();
|
||||||
|
|
||||||
bt = bulletTrace(eye, eye + anglesToForward(angles) * 25, false, self);
|
|
||||||
if (bt["surfacetype"] == "glass")
|
startPos = self.origin + (0, 0, 50);
|
||||||
self thread knife();
|
startPosForward = startPos + anglesToForward((0, angles[1], 0)) * FORWARDAMOUNT;
|
||||||
|
bt = bulletTrace(startPos, startPosForward, false, self);
|
||||||
|
if (bt["fraction"] >= 1)
|
||||||
|
{
|
||||||
|
// check if need to jump
|
||||||
|
bt = bulletTrace(startPosForward, startPosForward - (0, 0, 40), false, self);
|
||||||
|
|
||||||
|
if (bt["fraction"] < 1 && bt["normal"][2] > 0.75 && i > 1.5 && !self isOnLadder())
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
self thread jump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check if need to knife glass
|
||||||
|
else if (bt["surfacetype"] == "glass")
|
||||||
|
{
|
||||||
|
if (i > 1.5)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
self thread knife();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check if need to crouch
|
||||||
|
if (bulletTracePassed(startPos - (0, 0, 25), startPosForward - (0, 0, 25), false, self))
|
||||||
|
self crouch();
|
||||||
|
}
|
||||||
|
|
||||||
// move!
|
// move!
|
||||||
self botMovement(int(dir[0]), int(dir[1]));
|
self botMovement(int(dir[0]), int(dir[1]));
|
||||||
@ -1675,6 +1704,9 @@ movetowards(goal)
|
|||||||
time = 0;
|
time = 0;
|
||||||
if(distanceSquared(self.origin, lastOri) < 128)
|
if(distanceSquared(self.origin, lastOri) < 128)
|
||||||
{
|
{
|
||||||
|
self thread knife();
|
||||||
|
wait 0.5;
|
||||||
|
|
||||||
stucks++;
|
stucks++;
|
||||||
|
|
||||||
randomDir = self getRandomLargestStafe(stucks);
|
randomDir = self getRandomLargestStafe(stucks);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user