From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 27 May 2023 20:45:24 +0000 (+0200) Subject: make bots more aware of battle royale, no longer attempt to attack while still droppi... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fc0d4aef642b8036940959052a24b3f8f5050831;p=xonotic%2Fxonotic-data.pk3dir.git make bots more aware of battle royale, no longer attempt to attack while still dropping and do not seek out targets outside the ring --- diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index e166f3aca..1f7d829e3 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -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)) diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qh b/qcsrc/common/gamemodes/gamemode/br/sv_br.qh index f38de2765..819c0baa7 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qh +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qh @@ -6,6 +6,7 @@ entity ring; void br_Initialize(); +bool br_bot_ignore_in_ring(entity this); REGISTER_MUTATOR(br, false) { diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc index 52aff186a..abe75a026 100644 --- a/qcsrc/server/bot/default/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -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 /*