]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/bot_waypoints' into terencehill/bot_ai
authorterencehill <piuntn@gmail.com>
Mon, 15 Jan 2018 16:57:12 +0000 (17:57 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 15 Jan 2018 16:57:12 +0000 (17:57 +0100)
# Conflicts:
# qcsrc/server/mutators/mutator/gamemode_race.qc

1  2 
defaultServer.cfg
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/bot.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/navigation.qh
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_race.qc

Simple merge
Simple merge
Simple merge
index 3dab2c26bf94287485a592974c4e06e4ef9a0ba1,86442178c1e0068b4b24886fa7a79f2caefeed58..51ac148fc13c42c1185866cd87d6430165f61b8e
@@@ -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;
Simple merge
Simple merge
index ba2405b9db3837b67df1350876ccb5565b489f7d,0bfdc02fa2380ceadd6fdde783eed9a6e08e24a9..daaf8a969592e810af3531a1cdcded327b46a8fc
@@@ -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);
index c4ba8e91819b57f859cfe1fd3036b59ec72d88a7,9c2d60f38e7889991b0500fd22d7dcff660d4d52..690d23ca8bc3e2595df612f403185eba0975ee9c
@@@ -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);