From: terencehill Date: Sun, 10 Jun 2018 17:20:42 +0000 (+0200) Subject: Bot AI: CTF: fix offense role assigned to all bots when they spawn all at once X-Git-Tag: xonotic-v0.8.5~1923^2~38 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6a0d3353f9b7f30600b564ab05403053d318d0a5;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: CTF: fix offense role assigned to all bots when they spawn all at once --- diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 059af1e49..df9b68c7d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1623,6 +1623,20 @@ void havocbot_ctf_reset_role(entity this) havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE); return; } + else if (CS(this).jointime < time + 1) + { + // if bots spawn all at once set good default roles + if (count == 1) + { + havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE); + return; + } + else if (count == 2) + { + havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE); + return; + } + } // Evaluate best position to take // Count mates on middle position @@ -1640,6 +1654,10 @@ void havocbot_ctf_reset_role(entity this) havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE); else havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE); + + // if bots spawn all at once assign them a more appropriated role after a while + if (CS(this).jointime < time + 1 && count > 2) + this.havocbot_role_timeout = time + 10 + random() * 10; } bool havocbot_ctf_is_basewaypoint(entity item)