From: terencehill Date: Mon, 15 Jan 2018 16:57:12 +0000 (+0100) Subject: Merge branch 'terencehill/bot_waypoints' into terencehill/bot_ai X-Git-Tag: xonotic-v0.8.5~2378^2~3 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=13e8382b4bd9c0de8bcfd2a96f56e638ba5d431d Merge branch 'terencehill/bot_waypoints' into terencehill/bot_ai # Conflicts: # qcsrc/server/mutators/mutator/gamemode_race.qc --- 13e8382b4bd9c0de8bcfd2a96f56e638ba5d431d diff --cc qcsrc/server/bot/api.qh index 3dab2c26bf,86442178c1..51ac148fc1 --- a/qcsrc/server/bot/api.qh +++ b/qcsrc/server/bot/api.qh @@@ -31,12 -30,12 +31,13 @@@ float skill .float bot_moveskill; // moving technique .float bot_pickup; .float(entity player, entity item) bot_pickupevalfunc; -.float bot_strategytime; .string cleanname; .float havocbot_role_timeout; +.void(entity this) havocbot_role; +.void(entity this) havocbot_previous_role; .float isbot; // true if this client is actually a bot .float lastteleporttime; + .vector lastteleport_origin; .float navigation_hasgoals; .float nearestwaypointtimeout; .entity nearestwaypoint; diff --cc qcsrc/server/mutators/mutator/gamemode_cts.qc index ba2405b9db,0bfdc02fa2..daaf8a9695 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@@ -13,16 -13,30 +13,29 @@@ void havocbot_role_cts(entity this if(IS_DEAD(this)) return; - if (this.bot_strategytime < time) + if (navigation_goalrating_timeout(this)) { - this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); + bool raw_touch_check = true; + int cp = this.race_checkpoint; + + LABEL(search_racecheckpoints) IL_EACH(g_racecheckpoints, true, { - if(it.cnt == this.race_checkpoint) - navigation_routerating(this, it, 1000000, 5000); - else if(this.race_checkpoint == -1) + if(it.cnt == cp || cp == -1) + { + // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint + // e.g. checkpoint in front of Stormkeep's warpzone + // the same workaround is applied in Race game mode + if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30)) + { + cp = race_NextCheckpoint(cp); + raw_touch_check = false; + goto search_racecheckpoints; + } navigation_routerating(this, it, 1000000, 5000); + } }); navigation_goalrating_end(this); diff --cc qcsrc/server/mutators/mutator/gamemode_race.qc index c4ba8e9181,9c2d60f38e..690d23ca8b --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@@ -14,16 -14,30 +14,28 @@@ void havocbot_role_race(entity this if(IS_DEAD(this)) return; - if (this.bot_strategytime < time) + if (navigation_goalrating_timeout(this)) { - this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); + bool raw_touch_check = true; + int cp = this.race_checkpoint; + + LABEL(search_racecheckpoints) IL_EACH(g_racecheckpoints, true, { - if(it.cnt == this.race_checkpoint) - navigation_routerating(this, it, 1000000, 5000); - else if(this.race_checkpoint == -1) + if(it.cnt == cp || cp == -1) + { + // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint + // e.g. checkpoint in front of Stormkeep's warpzone + // the same workaround is applied in CTS game mode + if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30)) + { + cp = race_NextCheckpoint(cp); + raw_touch_check = false; + goto search_racecheckpoints; + } navigation_routerating(this, it, 1000000, 5000); - } }); navigation_goalrating_end(this);