From: mand1nga Date: Sat, 18 Dec 2010 22:14:42 +0000 (-0300) Subject: Merge branch 'master' into mand1nga/bot-navigation-fixes X-Git-Tag: xonotic-v0.1.0preview~15^2~1 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=fb0b9ad0a060e2f27d21bd76006c822dcdae8043;hp=f45f2df96df4e329a6b0b8343e53b750f9f632b0;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into mand1nga/bot-navigation-fixes --- diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index c1785a8d2..d8287df16 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -21,7 +21,8 @@ void havocbot_ai() } else { - self.havocbot_role(); + if not(self.jumppadcount) + self.havocbot_role(); } // TODO: tracewalk() should take care of this job (better path finding under water) @@ -452,14 +453,7 @@ void havocbot_movetogoal() // Handling of jump pads if(self.jumppadcount) { - if(self.flags & FL_ONGROUND) - { - self.jumppadcount = FALSE; - if(self.aistatus & AI_STATUS_OUT_JUMPPAD) - self.aistatus &~= AI_STATUS_OUT_JUMPPAD; - } - - // If got stuck on the jump pad try to reach the farther visible item + // If got stuck on the jump pad try to reach the farthest visible item if(self.aistatus & AI_STATUS_OUT_JUMPPAD) { if(fabs(self.velocity_z)<50) @@ -507,11 +501,20 @@ void havocbot_movetogoal() local float threshold; threshold = maxspeed * 0.2; if(fabs(self.velocity_x) < threshold && fabs(self.velocity_y) < threshold) + { + dprint("Warning: ", self.netname, " got stuck on a jumppad, trying to get out of it now\n"); self.aistatus |= AI_STATUS_OUT_JUMPPAD; + } return; } + + // Don't chase players while using a jump pad + if(self.goalcurrent.classname=="player" || self.goalstack01.classname=="player") + return; } } + else if(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) @@ -726,7 +729,7 @@ void havocbot_movetogoal() // (only when the bot is on the ground or jumping intentionally) self.aistatus &~= AI_STATUS_DANGER_AHEAD; - if(trace_fraction == 1) + if(trace_fraction == 1 && self.jumppadcount == 0) if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE) { // Look downwards diff --git a/qcsrc/server/bot/havocbot/roles.qc b/qcsrc/server/bot/havocbot/roles.qc index cfd050398..514c364ac 100644 --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/havocbot/roles.qc @@ -315,7 +315,6 @@ void havocbot_chooserole_ka() void havocbot_chooserole() { dprint("choosing a role...\n"); - navigation_clearroute(); self.bot_strategytime = 0; if (g_ctf) havocbot_chooserole_ctf(); diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index f3e5c26a8..9e1a92a22 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -897,6 +897,7 @@ void navigation_goalrating_start() self.navigation_jetpack_goal = world; navigation_bestrating = -1; self.navigation_hasgoals = FALSE; + navigation_clearroute(); navigation_bestgoal = world; navigation_markroutes(world); }; diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index 36048e860..1e72b765a 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -127,9 +127,9 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) void trigger_push_touch() { - if (self.active == ACTIVE_NOT) - return; - + if (self.active == ACTIVE_NOT) + return; + // FIXME: add a .float for whether an entity should be tossed by jumppads if (!other.iscreature) if (other.classname != "corpse") @@ -171,7 +171,7 @@ void trigger_push_touch() } local float ct; ct = clienttype(other); - if( ct == CLIENTTYPE_REAL) + if( ct == CLIENTTYPE_REAL || ct == CLIENTTYPE_BOT) { local float i; local float found; @@ -185,11 +185,14 @@ void trigger_push_touch() other.jumppadcount = other.jumppadcount + 1; } - if(self.message) - centerprint(other, self.message); + if(ct == CLIENTTYPE_REAL) + { + if(self.message) + centerprint(other, self.message); + } + else + other.lastteleporttime = time; } - else if(ct == CLIENTTYPE_BOT) - other.lastteleporttime = time; else other.jumppadcount = TRUE; @@ -289,8 +292,8 @@ void spawnfunc_trigger_push() SetMovedir (); EXACTTRIGGER_INIT; - - self.active = ACTIVE_ACTIVE; + + self.active = ACTIVE_ACTIVE; self.use = trigger_push_use; self.touch = trigger_push_touch;