#include "role_ctf.qc"
#include "role_onslaught.qc"
#include "role_keyhunt.qc"
+#include "role_freezetag.qc"
+#include "role_keepaway.qc"
#include "roles.qc"
void havocbot_ai()
local vector now,v,next;//,heading;
local float aimdistance,skillblend,distanceblend,blend;
- next = now = self.goalcurrent.origin - (self.origin + self.view_ofs);
+ next = now = ( (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5) - (self.origin + self.view_ofs);
aimdistance = vlen(now);
//heading = self.velocity;
//dprint(self.goalstack01.classname,etos(self.goalstack01),"\n");
self.goalstack01 != self && self.goalstack01 != world && self.aistatus & AI_STATUS_RUNNING == 0 &&
!(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
)
- next = self.goalstack01.origin - (self.origin + self.view_ofs);
+ next = ((self.goalstack01.absmin + self.goalstack01.absmax) * 0.5) - (self.origin + self.view_ofs);
skillblend=bound(0,(skill+self.bot_moveskill-2.5)*0.5,1); //lower skill player can't preturn
distanceblend=bound(0,aimdistance/autocvar_bot_ai_keyboard_distance,1);
local float bunnyhopdistance;
local vector deviation;
local float maxspeed;
+ vector gco, gno;
if(autocvar_g_midair)
return;
self.bot_timelastseengoal = 0;
}
- bunnyhopdistance = vlen(self.origin - self.goalcurrent.origin);
+ gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
+ bunnyhopdistance = vlen(self.origin - gco);
// Run only to visible goals
if(self.flags & FL_ONGROUND)
if(self.aistatus & AI_STATUS_ROAMING)
if(self.goalcurrent.classname=="waypoint")
if not(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)
- if(fabs(self.goalcurrent.origin_z - self.origin_z) < self.maxs_z - self.mins_z)
+ if(fabs(gco_z - self.origin_z) < self.maxs_z - self.mins_z)
if(self.goalstack01!=world)
{
- deviation = vectoangles(self.goalstack01.origin - self.origin) - vectoangles(self.goalcurrent.origin - self.origin);
+ gno = (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5;
+ deviation = vectoangles(gno - self.origin) - vectoangles(gco - self.origin);
while (deviation_y < -180) deviation_y = deviation_y + 360;
while (deviation_y > 180) deviation_y = deviation_y - 360;
if(fabs(deviation_y) < 20)
- if(bunnyhopdistance < vlen(self.origin - self.goalstack01.origin))
- if(fabs(self.goalstack01.origin_z - self.goalcurrent.origin_z) < self.maxs_z - self.mins_z)
+ if(bunnyhopdistance < vlen(self.origin - gno))
+ if(fabs(gno_z - gco_z) < self.maxs_z - self.mins_z)
{
- if(vlen(self.goalcurrent.origin - self.goalstack01.origin) > autocvar_bot_ai_bunnyhop_startdistance)
+ if(vlen(gco - gno) > autocvar_bot_ai_bunnyhop_startdistance)
if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
{
checkdistance = FALSE;
local vector evadelava;
local float s;
local float maxspeed;
+ local vector gco;
//local float dist;
local vector dodge;
//if (self.goalentity)
float db, v, d;
vector dxy;
- dxy = self.origin - self.goalcurrent.origin; dxy_z = 0;
+ dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy_z = 0;
d = vlen(dxy);
v = vlen(self.velocity - self.velocity_z * '0 0 1');
db = (pow(v,2) / (autocvar_g_jetpack_acceleration_side * 2)) + 100;
if(distance>1000)
continue;
- traceline(self.origin + self.view_ofs , head.origin, TRUE, world);
+ traceline(self.origin + self.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), TRUE, world);
if(trace_fraction<1)
continue;
if(self.goalcurrent==world)
dir = v_forward;
else
- dir = normalize(self.goalcurrent.origin - self.origin);
+ dir = normalize(( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - self.origin);
local vector xyvelocity = self.velocity; xyvelocity_z = 0;
local float xyspeed = xyvelocity * dir;
return;
}
+
if(autocvar_bot_debug_goalstack)
debuggoalstack();
dir = normalize(diff);
flatdir = diff;flatdir_z = 0;
flatdir = normalize(flatdir);
+ gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
//if (self.bot_dodgevector_time < time)
{
}
else
{
- if(self.velocity_z >= 0 && !(self.watertype == CONTENT_WATER && self.goalcurrent.origin_z < self.origin_z) &&
+ if(self.velocity_z >= 0 && !(self.watertype == CONTENT_WATER && gco_z < self.origin_z) &&
( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER))
self.BUTTON_JUMP = TRUE;
else
{
// Remove dangerous dynamic goals from stack
if (self.goalcurrent.classname == "player" || self.goalcurrent.classname == "droppedweapon")
+ {
navigation_poproute();
+ if(self.goalcurrent)
+ gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
+ }
// try to stop
flatdir = '0 0 0';
evadeobstacle = normalize(self.velocity) * -1;
dodge = havocbot_dodge();
dodge = dodge * bound(0,0.5+(skill+self.bot_dodgeskill)*0.1,1);
evadelava = evadelava * bound(1,3-(skill+self.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
- traceline(self.origin, self.enemy.origin, TRUE, world);
+ traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), TRUE, world);
if(trace_ent.classname == "player")
dir = dir * bound(0,(skill+self.bot_dodgeskill)/7,1);
// and not really really far away
// and we're not severely injured
// then keep tracking for a half second into the future
- traceline(self.origin+self.view_ofs, self.enemy.origin+self.enemy.view_ofs*0.5,FALSE,world);
+ traceline(self.origin+self.view_ofs, ( self.enemy.absmin + self.enemy.absmax ) * 0.5,FALSE,world);
if (trace_ent == self.enemy || trace_fraction == 1)
- if (vlen(self.enemy.origin - self.origin) < 1000)
+ if (vlen((( self.enemy.absmin + self.enemy.absmax ) * 0.5) - self.origin) < 1000)
if (self.health > 30)
{
// remain tracking him for a shot while (case he went after a small corner or pilar
enemyvel = self.enemy.velocity;
if (!self.enemy.waterlevel)
enemyvel_z = 0;
- lag_additem(time + self.ping, 0, 0, self.enemy, self.origin, selfvel, self.enemy.origin, enemyvel);
+ lag_additem(time + self.ping, 0, 0, self.enemy, self.origin, selfvel, (self.enemy.absmin + self.enemy.absmax) * 0.5, enemyvel);
}
else
- lag_additem(time + self.ping, 0, 0, world, self.origin, selfvel, self.goalcurrent.origin, '0 0 0');
+ lag_additem(time + self.ping, 0, 0, world, self.origin, selfvel, ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5, '0 0 0');
};
float havocbot_moveto_refresh_route()
debuggoalstack();
// Heading
- local vector dir = self.goalcurrent.origin - (self.origin + self.view_ofs);
+ local vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
dir_z = 0;
bot_aimdir(dir, -1);