X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fhavocbot%2Fhavocbot.qc;h=a0e6bfffd42926004503c8e9f63b8e9eaaa07836;hb=0ab7132eba1a94b5ec19efe5a3f5f63071ed80ff;hp=e05d1aa1b312b79ac32100a4c696181888ca88ef;hpb=db20e10f5f82423356007ed51deb53c05f964a9a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index e05d1aa1b..a0e6bfffd 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -1,7 +1,6 @@ #include "havocbot.qh" #include "role_onslaught.qc" #include "role_keyhunt.qc" -#include "role_assault.qc" #include "roles.qc" void havocbot_ai() @@ -21,7 +20,7 @@ void havocbot_ai() } else { - if not(self.jumppadcount) + if (!self.jumppadcount) self.havocbot_role(); } @@ -29,7 +28,7 @@ void havocbot_ai() // if we don't have a goal and we're under water look for a waypoint near the "shore" and push it if(self.deadflag != DEAD_NO) if(self.goalcurrent==world) - if(self.waterlevel==WATERLEVEL_SWIMMING || self.aistatus & AI_STATUS_OUT_WATER) + if(self.waterlevel==WATERLEVEL_SWIMMING || (self.aistatus & AI_STATUS_OUT_WATER)) { // Look for the closest waypoint out of water entity newgoal, head; @@ -89,9 +88,9 @@ void havocbot_ai() if (self.bot_aimtarg) { self.aistatus |= AI_STATUS_ATTACKING; - self.aistatus &~= AI_STATUS_ROAMING; + self.aistatus &= ~AI_STATUS_ROAMING; - if(!WEPSET_EMPTY_E(self)) + if(self.weapons) { weapon_action(self.weapon, WR_AIM); if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self)) @@ -114,7 +113,7 @@ void havocbot_ai() else if (self.goalcurrent) { self.aistatus |= AI_STATUS_ROAMING; - self.aistatus &~= AI_STATUS_ATTACKING; + self.aistatus &= ~AI_STATUS_ATTACKING; vector now,v,next;//,heading; float aimdistance,skillblend,distanceblend,blend; @@ -123,7 +122,7 @@ void havocbot_ai() //heading = self.velocity; //dprint(self.goalstack01.classname,etos(self.goalstack01),"\n"); if( - self.goalstack01 != self && self.goalstack01 != world && self.aistatus & AI_STATUS_RUNNING == 0 && + self.goalstack01 != self && self.goalstack01 != world && ((self.aistatus & AI_STATUS_RUNNING) == 0) && !(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT) ) next = ((self.goalstack01.absmin + self.goalstack01.absmax) * 0.5) - (self.origin + self.view_ofs); @@ -147,7 +146,7 @@ void havocbot_ai() havocbot_movetogoal(); // if the bot is not attacking, consider reloading weapons - if not(self.aistatus & AI_STATUS_ATTACKING) + if (!(self.aistatus & AI_STATUS_ATTACKING)) { float i; entity e; @@ -165,7 +164,7 @@ void havocbot_ai() for(i = WEP_FIRST; i <= WEP_LAST; ++i) { e = get_weaponinfo(i); - if (WEPSET_CONTAINS_EW(self, i) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < cvar(strcat("g_balance_", e.netname, "_reload_ammo")))) + if ((self.weapons & WepSet_FromWeapon(i)) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < cvar(strcat("g_balance_", e.netname, "_reload_ammo")))) self.switchweapon = i; } } @@ -254,9 +253,6 @@ void havocbot_bunnyhop(vector dir) float maxspeed; vector gco, gno; - if(autocvar_g_midair) - return; - // Don't jump when attacking if(self.aistatus & AI_STATUS_ATTACKING) return; @@ -268,7 +264,7 @@ void havocbot_bunnyhop(vector dir) if(self.aistatus & AI_STATUS_DANGER_AHEAD) { - self.aistatus &~= AI_STATUS_RUNNING; + self.aistatus &= ~AI_STATUS_RUNNING; self.BUTTON_JUMP = FALSE; self.bot_canruntogoal = 0; self.bot_timelastseengoal = 0; @@ -277,7 +273,7 @@ void havocbot_bunnyhop(vector dir) if(self.waterlevel > WATERLEVEL_WETFEET) { - self.aistatus &~= AI_STATUS_RUNNING; + self.aistatus &= ~AI_STATUS_RUNNING; return; } @@ -320,7 +316,7 @@ void havocbot_bunnyhop(vector dir) if(self.aistatus & AI_STATUS_ROAMING) if(self.goalcurrent.classname=="waypoint") - if not(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) + if (!(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)) if(fabs(gco_z - self.origin_z) < self.maxs_z - self.mins_z) if(self.goalstack01!=world) { @@ -343,7 +339,7 @@ void havocbot_bunnyhop(vector dir) if(checkdistance) { - self.aistatus &~= AI_STATUS_RUNNING; + self.aistatus &= ~AI_STATUS_RUNNING; if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance) self.BUTTON_JUMP = TRUE; } @@ -367,7 +363,7 @@ void havocbot_bunnyhop(vector dir) #if 0 // Release jump button if(!cvar("sv_pogostick")) - if(self.flags & FL_ONGROUND == 0) + if((self.flags & FL_ONGROUND) == 0) { if(self.velocity_z < 0 || vlen(self.velocity)10) @@ -459,15 +455,15 @@ void havocbot_movetogoal() } // Switch to normal mode self.navigation_jetpack_goal = world; - self.aistatus &~= AI_STATUS_JETPACK_LANDING; - self.aistatus &~= AI_STATUS_JETPACK_FLYING; + self.aistatus &= ~AI_STATUS_JETPACK_LANDING; + self.aistatus &= ~AI_STATUS_JETPACK_FLYING; return; } } else if(checkpvs(self.origin,self.goalcurrent)) { // If I can see the goal switch to landing code - self.aistatus &~= AI_STATUS_JETPACK_FLYING; + self.aistatus &= ~AI_STATUS_JETPACK_FLYING; self.aistatus |= AI_STATUS_JETPACK_LANDING; return; } @@ -518,7 +514,7 @@ void havocbot_movetogoal() self.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout; navigation_clearroute(); navigation_routetogoal(newgoal, self.origin); - self.aistatus &~= AI_STATUS_OUT_JUMPPAD; + self.aistatus &= ~AI_STATUS_OUT_JUMPPAD; } } else @@ -546,11 +542,11 @@ void havocbot_movetogoal() } } else if(self.aistatus & AI_STATUS_OUT_JUMPPAD) - self.aistatus &~= AI_STATUS_OUT_JUMPPAD; + self.aistatus &= ~AI_STATUS_OUT_JUMPPAD; // If there is a trigger_hurt right below try to use the jetpack or make a rocketjump if(skill>6) - if not(self.flags & FL_ONGROUND) + if (!(self.flags & FL_ONGROUND)) { tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 -65536', MOVE_NOMONSTERS, self); if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos )) @@ -702,7 +698,7 @@ void havocbot_movetogoal() else { if(self.aistatus & AI_STATUS_OUT_WATER) - self.aistatus &~= AI_STATUS_OUT_WATER; + self.aistatus &= ~AI_STATUS_OUT_WATER; // jump if going toward an obstacle that doesn't look like stairs we // can walk up directly @@ -760,10 +756,10 @@ void havocbot_movetogoal() // Check for water/slime/lava and dangerous edges // (only when the bot is on the ground or jumping intentionally) - self.aistatus &~= AI_STATUS_DANGER_AHEAD; + self.aistatus &= ~AI_STATUS_DANGER_AHEAD; if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired ) - if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE) + if((self.flags & FL_ONGROUND) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == TRUE) { // Look downwards traceline(dst_ahead , dst_down, TRUE, world); @@ -927,7 +923,7 @@ void havocbot_chooseenemy() // 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 || !WEPSET_EMPTY_E(self)) // || self.weapon == WEP_RIFLE + if(best || self.weapons) // || self.weapon == WEP_RIFLE break; if(i) break; @@ -975,7 +971,7 @@ void havocbot_chooseweapon() float i; // ;) - if(WEPSET_EQ_AW(g_weaponarena_weapons, WEP_TUBA)) + if(g_weaponarena_weapons == WEPSET_TUBA) { self.switchweapon = WEP_TUBA; return; @@ -1115,7 +1111,7 @@ float havocbot_moveto(vector pos) if(self.havocbot_personal_waypoint==world) { dprint("Error: ", self.netname, " trying to walk to a non existent personal waypoint\n"); - self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_GOING; + self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING; return CMD_STATUS_ERROR; } @@ -1136,7 +1132,7 @@ float havocbot_moveto(vector pos) 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"); - self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_LINKING; + self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING; remove(self.havocbot_personal_waypoint); return CMD_STATUS_ERROR; } @@ -1161,7 +1157,7 @@ float havocbot_moveto(vector pos) // Step 5: Waypoint reached dprint(self.netname, "'s personal waypoint reached\n"); remove(self.havocbot_personal_waypoint); - self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_REACHED; + self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED; return CMD_STATUS_FINISHED; } @@ -1179,7 +1175,7 @@ float havocbot_moveto(vector pos) } self.havocbot_personal_waypoint_searchtime = time; // so we set the route next frame - self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_LINKING; + self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING; self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING; // Step 3: Route to waypoint