X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fhavocbot%2Fhavocbot.qc;h=2ddeb639182a3664a1315a2a41aedf19dd742f38;hb=fd20a1f1eae2b2ba955ce9ddedc20cd151a6f362;hp=5e8dc36e3d4058e97da48e4aa7ce9be6609c9dd6;hpb=bd7038146e8b9decebe5b9f852d2ee3d3ef2bfac;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 5e8dc36e3..2ddeb6391 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -35,7 +35,7 @@ void havocbot_ai(entity this) 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) @@ -107,7 +107,7 @@ void havocbot_ai(entity this) 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; @@ -653,7 +653,7 @@ void havocbot_movetogoal(entity this) 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) @@ -993,7 +993,7 @@ float havocbot_chooseweapon_checkreload(entity this, int new_weapon) { 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) @@ -1106,34 +1106,34 @@ void havocbot_chooseweapon(entity this) 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; } @@ -1265,7 +1265,7 @@ void havocbot_setupbot(entity this) this.cmd_moveto = havocbot_moveto; this.cmd_resetgoal = havocbot_resetgoal; - WITH(entity, self, this, havocbot_chooserole()); + havocbot_chooserole(this); } vector havocbot_dodge() @@ -1273,6 +1273,7 @@ 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; @@ -1282,13 +1283,13 @@ vector havocbot_dodge() 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)) @@ -1306,11 +1307,11 @@ vector havocbot_dodge() } 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); } } }