#include "../../../common/constants.qh"
+#include "../../../common/triggers/trigger/jumppads.qh"
+
#include "../../../warpzonelib/common.qh"
void havocbot_ai()
-{
+{SELFPARAM();
if(self.draggedby)
return;
if(self.weapons)
{
- WEP_ACTION(self.weapon, WR_AIM);
+ _WEP_ACTION(self.weapon, WR_AIM);
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
{
self.BUTTON_ATCK = false;
}
void havocbot_keyboard_movement(vector destorg)
-{
+{SELFPARAM();
vector keyboard;
float blend, maxspeed;
float sk;
}
void havocbot_bunnyhop(vector dir)
-{
+{SELFPARAM();
float bunnyhopdistance;
vector deviation;
float maxspeed;
}
void havocbot_movetogoal()
-{
+{SELFPARAM();
vector destorg;
vector diff;
vector dir;
// Flying
self.BUTTON_HOOK = true;
- if(self.navigation_jetpack_point.z - PL_MAX_z + PL_MIN_z < self.origin.z)
+ if(self.navigation_jetpack_point.z - PL_MAX.z + PL_MIN.z < self.origin.z)
{
self.movement_x = dir * v_forward * maxspeed;
self.movement_y = dir * v_right * maxspeed;
threshold = maxspeed * 0.2;
if(sxy < threshold)
{
- dprint("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
+ LOG_TRACE("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
self.aistatus |= AI_STATUS_OUT_JUMPPAD;
}
return;
else if(self.health>WEP_CVAR(devastator, damage)*0.5)
{
if(self.velocity.z < 0)
- if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
+ if(client_hasweapon(self, WEP_DEVASTATOR.m_id, true, false))
{
self.movement_x = maxspeed;
return;
}
- self.switchweapon = WEP_DEVASTATOR;
+ self.switchweapon = WEP_DEVASTATOR.m_id;
self.v_angle_x = 90;
self.BUTTON_ATCK = true;
self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
if(tracebox_hits_trigger_hurt(dst_ahead, self.mins, self.maxs, trace_endpos))
{
// Remove dangerous dynamic goals from stack
- dprint("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
+ LOG_TRACE("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
navigation_clearroute();
return;
}
}
void havocbot_chooseenemy()
-{
+{SELFPARAM();
entity head, best, head2;
float rating, bestrating, i, hf;
vector eye, v;
// I want to do a second scan if no enemy was found or I don't have weapons
// TODO: Perform the scan when using the rifle (requires changes on the rifle code)
- if(best || self.weapons) // || self.weapon == WEP_RIFLE
+ if(best || self.weapons) // || self.weapon == WEP_RIFLE.m_id
break;
if(i)
break;
}
float havocbot_chooseweapon_checkreload(int new_weapon)
-{
+{SELFPARAM();
// bots under this skill cannot find unloaded weapons to reload idly when not in combat,
// so skip this for them, or they'll never get to reload their weapons at all.
// this also allows bots under this skill to be more stupid, and reload more often during combat :)
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
// if we are out of ammo for all other weapons, it's an emergency to switch to anything else
- if (WEP_ACTION(i, WR_CHECKAMMO1) + WEP_ACTION(i, WR_CHECKAMMO2))
+ if (_WEP_ACTION(i, WR_CHECKAMMO1) + _WEP_ACTION(i, WR_CHECKAMMO2))
other_weapon_available = true;
}
if(other_weapon_available)
}
void havocbot_chooseweapon()
-{
+{SELFPARAM();
int i;
// ;)
if(g_weaponarena_weapons == WEPSET_TUBA)
{
- self.switchweapon = WEP_TUBA;
+ self.switchweapon = WEP_TUBA.m_id;
return;
}
{
// If no weapon was chosen get the first available weapon
if(self.weapon==0)
- for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER)
+ for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
{
if(client_hasweapon(self, i, true, false))
{
}
void havocbot_aim()
-{
+{SELFPARAM();
vector selfvel, enemyvel;
// if(self.flags & FL_INWATER)
// return;
}
float havocbot_moveto_refresh_route()
-{
+{SELFPARAM();
// Refresh path to goal if necessary
entity wp;
wp = self.havocbot_personal_waypoint;
}
float havocbot_moveto(vector pos)
-{
+{SELFPARAM();
entity wp;
if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
// Step 4: Move to waypoint
if(self.havocbot_personal_waypoint==world)
{
- dprint("Error: ", self.netname, " trying to walk to a non existent personal waypoint\n");
+ LOG_TRACE("Error: ", self.netname, " trying to walk to a non existent personal waypoint\n");
self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
return CMD_STATUS_ERROR;
}
bot_strategytoken_taken = true;
if(havocbot_moveto_refresh_route())
{
- dprint(self.netname, " walking to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
+ LOG_TRACE(self.netname, " walking to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
self.havocbot_personal_waypoint_searchtime = time + 10;
self.havocbot_personal_waypoint_failcounter = 0;
}
self.havocbot_personal_waypoint_searchtime = time + 2;
if(self.havocbot_personal_waypoint_failcounter >= 30)
{
- dprint("Warning: can't walk to the personal waypoint located at ", vtos(self.havocbot_personal_waypoint.origin),"\n");
+ LOG_TRACE("Warning: can't walk to the personal waypoint located at ", vtos(self.havocbot_personal_waypoint.origin),"\n");
self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
remove(self.havocbot_personal_waypoint);
return CMD_STATUS_ERROR;
}
else
- dprint(self.netname, " can't walk to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
+ LOG_TRACE(self.netname, " can't walk to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
}
}
if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_REACHED)
{
// Step 5: Waypoint reached
- dprint(self.netname, "'s personal waypoint reached\n");
+ LOG_TRACE(self.netname, "'s personal waypoint reached\n");
remove(self.havocbot_personal_waypoint);
self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
return CMD_STATUS_FINISHED;
// Wait until it is linked
if(!self.havocbot_personal_waypoint.wplinked)
{
- dprint(self.netname, " waiting for personal waypoint to be linked\n");
+ LOG_TRACE(self.netname, " waiting for personal waypoint to be linked\n");
return CMD_STATUS_EXECUTING;
}
self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING;
// Step 3: Route to waypoint
- dprint(self.netname, " walking to its personal waypoint\n");
+ LOG_TRACE(self.netname, " walking to its personal waypoint\n");
return CMD_STATUS_EXECUTING;
}
wp = waypoint_spawnpersonal(pos);
if(wp==world)
{
- dprint("Error: Can't spawn personal waypoint at ",vtos(pos),"\n");
+ LOG_TRACE("Error: Can't spawn personal waypoint at ",vtos(pos),"\n");
return CMD_STATUS_ERROR;
}
}
void havocbot_setupbot()
-{
+{SELFPARAM();
self.bot_ai = havocbot_ai;
self.cmd_moveto = havocbot_moveto;
self.cmd_resetgoal = havocbot_resetgoal;
}
vector havocbot_dodge()
-{
+{SELFPARAM();
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0