]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make bots more aware of battle royale, no longer attempt to attack while still droppi...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sat, 27 May 2023 20:45:24 +0000 (22:45 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sat, 27 May 2023 20:45:24 +0000 (22:45 +0200)
qcsrc/common/gamemodes/gamemode/br/sv_br.qc
qcsrc/common/gamemodes/gamemode/br/sv_br.qh
qcsrc/server/bot/default/havocbot/roles.qc

index e166f3aca9586e3d6d9f81ffd30fb4e335487f8b..1f7d829e3d02a699f1c2d22cb2e3b986ffd93098 100644 (file)
@@ -952,7 +952,7 @@ MUTATOR_HOOKFUNCTION(br, BotShouldAttack)
     entity bot = M_ARGV(0, entity);
     entity target = M_ARGV(1, entity);
 
-    return SAME_SQUAD(bot, target) || (STAT(DROP, target) == DROP_TRANSPORT);
+    return SAME_SQUAD(bot, target) || (STAT(DROP, bot) != DROP_LANDED) || (STAT(DROP, target) == DROP_TRANSPORT);
 }
 
 MUTATOR_HOOKFUNCTION(br, TurretValidateTarget)
@@ -1043,6 +1043,16 @@ MUTATOR_HOOKFUNCTION(br, SV_StartFrame)
         br_event_vehicle_time = time;
         spawn_vehicle();
     }
+
+    if(ring)
+    {
+        float current_radius = ring_calculate_current_radius(ring);
+
+        IL_EACH(g_items, it.bot_pickup, {
+            if(vdist(it.origin - ring.origin, >, current_radius))
+                it.bot_pickup = false;
+        });
+    }
 }
 
 void(entity this) havocbot_role_br_reviving;
@@ -1062,6 +1072,17 @@ bool squad_needs_revive(entity this)
     return false;
 }
 
+bool br_bot_ignore_in_ring(entity this)
+{
+    if(!ring)
+        return false;
+
+    if(vlen(this.origin - ring.origin) > ring_calculate_current_radius(ring))
+        return true;
+
+    return false;
+}
+
 void havocbot_goalrating_br_findplayers(entity this, float ratingscale)
 {
     if(!IN_SQUAD(this))
index f38de2765a7cc01631e5c802f9bb59570d8bb2e1..819c0baa7e0c61650cab6c4c297d0c52d6ddcb9c 100644 (file)
@@ -6,6 +6,7 @@
 entity ring;
 
 void br_Initialize();
+bool br_bot_ignore_in_ring(entity this);
 
 REGISTER_MUTATOR(br, false)
 {
index 52aff186aef70e133f390c1851f93dc5c613e6f6..abe75a0268673c1debf7b9d371051d6efd05126d 100644 (file)
@@ -26,7 +26,8 @@ void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, f
        {
                IL_EACH(g_waypoints, vdist(it.origin - org, <, sradius)
                        && vdist(it.origin - org, >, max(100, sradius - range))
-                       && !(it.wpflags & WAYPOINTFLAG_TELEPORT),
+                       && !(it.wpflags & WAYPOINTFLAG_TELEPORT)
+                       && !br_bot_ignore_in_ring(it),
                {
                        if(vdist(it.origin - this.wp_goal_prev0.origin, <, range * 1.5))
                                f = 0.1;
@@ -190,6 +191,8 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                        continue;
                if(vdist(vec2(it.velocity), >, autocvar_sv_maxspeed * 2))
                        continue;
+               if(br_bot_ignore_in_ring(it))
+                       continue;
 
                // rate only visible enemies
                /*