X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fhavocbot%2Fhavocbot.qc;h=17f3a80b3f48db0cdb5b73b56e279788a34833b7;hb=cd06eb102cd3ce2d6e5394de18196b6aa0e7fea9;hp=fad7dbda7b0d573a75aff2f9bdbaa63187be6ea1;hpb=7ca1d66af4b7d36f2e036100ba6183fff7213829;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index fad7dbda7..17f3a80b3 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -517,7 +517,9 @@ void havocbot_movetogoal(entity this) if(fabs(this.velocity.z)<50) { entity newgoal = NULL; - IL_EACH(g_waypoints, vdist(it.origin - this.origin, <=, 1000), + if (vdist(this.origin - this.goalcurrent.origin, <, 150)) + this.aistatus &= ~AI_STATUS_OUT_JUMPPAD; + else IL_EACH(g_waypoints, vdist(it.origin - this.origin, <=, 1000), { traceline(this.origin + this.view_ofs, ((it.absmin + it.absmax) * 0.5), true, this); @@ -544,12 +546,10 @@ void havocbot_movetogoal(entity this) } else { - if(this.velocity.z>0) + if(time - this.lastteleporttime > 0.3 && this.velocity.z > 0) { - float threshold; vector velxy = this.velocity; velxy_z = 0; - threshold = maxspeed * 0.2; - if(vdist(velxy, <, threshold)) + if(vdist(velxy, <, autocvar_sv_maxspeed * 0.2)) { LOG_TRACE("Warning: ", this.netname, " got stuck on a jumppad (velocity in xy is ", vtos(velxy), "), trying to get out of it now"); this.aistatus |= AI_STATUS_OUT_JUMPPAD; @@ -674,7 +674,39 @@ void havocbot_movetogoal(entity this) if (this.goalcurrent == NULL) return; - navigation_poptouchedgoals(this); + + bool locked_goal = false; + if(this.goalentity && wasfreed(this.goalentity)) + { + navigation_clearroute(this); + this.bot_strategytime = 0; + return; + } + else if(this.goalentity.bot_pickup) + { + if(this.goalentity.bot_pickup_respawning) + { + if(this.goalentity.solid) // item respawned + this.goalentity.bot_pickup_respawning = false; + else if(time < this.goalentity.scheduledrespawntime - 10) // item already taken (by someone else) + { + this.goalentity.bot_pickup_respawning = false; + navigation_clearroute(this); + this.bot_strategytime = 0; + return; + } + else if(this.goalentity == this.goalcurrent) + locked_goal = true; // wait for item to respawn + } + else if(!this.goalentity.solid) + { + navigation_clearroute(this); + this.bot_strategytime = 0; + return; + } + } + if(!locked_goal) + navigation_poptouchedgoals(this); // if ran out of goals try to use an alternative goal or get a new strategy asap if(this.goalcurrent == NULL) @@ -752,44 +784,36 @@ void havocbot_movetogoal(entity this) } // avoiding dangers and obstacles - offset = (vdist(this.velocity, >, 32) ? this.velocity * 0.5 : v_forward * 32); - vector dst_ahead = this.origin + this.view_ofs + offset; + offset = (vdist(this.velocity - eZ * this.velocity.z, >, 32) ? this.velocity * 0.5 : v_forward * 32); + vector dst_ahead = this.origin + offset; vector dst_down = dst_ahead - '0 0 3000'; - // Look ahead - traceline(this.origin + this.view_ofs, dst_ahead, true, NULL); - // Check head-banging against walls - if(vdist(this.origin + this.view_ofs - trace_endpos, <, 25) && !(this.aistatus & AI_STATUS_OUT_WATER)) + traceline(this.origin, dst_ahead, true, NULL); + if(vdist(this.origin - trace_endpos, <, 25) && !(this.aistatus & AI_STATUS_OUT_WATER)) { PHYS_INPUT_BUTTON_JUMP(this) = true; - if(this.facingwalltime && time > this.facingwalltime) + if(!this.facingwalltime) + this.facingwalltime = time + 0.2; + else if(time > this.facingwalltime) { - this.ignoregoal = this.goalcurrent; - this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout; + navigation_clearroute(this); this.bot_strategytime = 0; return; } - else - { - this.facingwalltime = time + 0.05; - } } else - { this.facingwalltime = 0; - if(this.ignoregoal != NULL && time > this.ignoregoaltime) - { - this.ignoregoal = NULL; - this.ignoregoaltime = 0; - } - } - // Check for water/slime/lava and dangerous edges // (only when the bot is on the ground or jumping intentionally) this.aistatus &= ~AI_STATUS_DANGER_AHEAD; + dst_ahead = this.origin + this.view_ofs + offset; + dst_down = dst_ahead - '0 0 3000'; + + traceline(this.origin + this.view_ofs, dst_ahead, true, NULL); + bool unreachable = false; s = CONTENT_SOLID; if(trace_fraction == 1 && this.jumppadcount == 0 && !this.goalcurrent.wphardwired )