else
{
if (!this.jumppadcount)
- WITH(entity, self, this, this.havocbot_role()); // little too far down the rabbit hole
+ this.havocbot_role(this); // little too far down the rabbit hole
}
// TODO: tracewalk() should take care of this job (better path finding under water)
if(this.weapons)
{
Weapon w = PS(this).m_weapon;
- w.wr_aim(w);
+ w.wr_aim(w, this);
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
{
PHYS_INPUT_BUTTON_ATCK(this) = false;
return;
if (this.goalcurrent)
- navigation_poptouchedgoals();
+ navigation_poptouchedgoals(this);
// if ran out of goals try to use an alternative goal or get a new strategy asap
if(this.goalcurrent == world)
{
bool other_weapon_available = false;
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if(it.wr_checkammo1(it) + it.wr_checkammo2(it))
+ if(it.wr_checkammo1(it, this) + it.wr_checkammo2(it, this))
other_weapon_available = true;
));
if(other_weapon_available)
void havocbot_aim(entity this)
{
- vector selfvel, enemyvel;
+ vector myvel, enemyvel;
// if(this.flags & FL_INWATER)
// return;
if (time < this.nextaim)
return;
this.nextaim = time + 0.1;
- selfvel = this.velocity;
+ myvel = this.velocity;
if (!this.waterlevel)
- selfvel.z = 0;
+ myvel.z = 0;
if (this.enemy)
{
enemyvel = this.enemy.velocity;
if (!this.enemy.waterlevel)
enemyvel.z = 0;
- lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, selfvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
+ lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, myvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
}
else
- lag_additem(this, time + this.ping, 0, 0, world, this.origin, selfvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
+ lag_additem(this, time + this.ping, 0, 0, world, this.origin, myvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
}
-float havocbot_moveto_refresh_route(entity this)
+bool havocbot_moveto_refresh_route(entity this)
{
// Refresh path to goal if necessary
entity wp;
wp = this.havocbot_personal_waypoint;
- WITH(entity, self, this, navigation_goalrating_start());
- WITH(entity, self, this, navigation_routerating(wp, 10000, 10000));
- WITH(entity, self, this, navigation_goalrating_end());
+ navigation_goalrating_start(this);
+ navigation_routerating(this, wp, 10000, 10000);
+ navigation_goalrating_end(this);
return this.navigation_hasgoals;
}
this.cmd_moveto = havocbot_moveto;
this.cmd_resetgoal = havocbot_resetgoal;
- WITH(entity, self, this, havocbot_chooserole());
+ havocbot_chooserole(this);
}
vector havocbot_dodge()
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
+SELFPARAM();
entity head;
vector dodge, v, n;
float danger, bestdanger, vl, d;
head = findchainfloat(bot_dodge, true);
while(head)
{
- if (head.owner != self)
+ if (head.owner != this)
{
vl = vlen(head.velocity);
if (vl > autocvar_sv_maxspeed * 0.3)
{
n = normalize(head.velocity);
- v = self.origin - head.origin;
+ v = this.origin - head.origin;
d = v * n;
if (d > (0 - head.bot_dodgerating))
if (d < (vl * 0.2 + head.bot_dodgerating))
}
else
{
- danger = head.bot_dodgerating - vlen(head.origin - self.origin);
+ danger = head.bot_dodgerating - vlen(head.origin - this.origin);
if (bestdanger < danger)
{
bestdanger = danger;
- dodge = normalize(self.origin - head.origin);
+ dodge = normalize(this.origin - head.origin);
}
}
}