]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/havocbot/havocbot.qc
Merge branch 'master' into terencehill/bot_ai
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / havocbot / havocbot.qc
index 429254a5ef60d39631b7cebae03a91b4b301c7ee..788ee1bc6e17917dee0478cdc85bb1bfdc07d2c3 100644 (file)
@@ -18,8 +18,8 @@
 #include <common/items/_mod.qh>
 #include <common/wepent.qh>
 
-#include <common/triggers/teleporters.qh>
-#include <common/triggers/trigger/jumppads.qh>
+#include <common/mapobjects/teleporters.qh>
+#include <common/mapobjects/trigger/jumppads.qh>
 
 #include <lib/warpzone/common.qh>
 
@@ -112,7 +112,7 @@ void havocbot_ai(entity this)
                this.aistatus |= AI_STATUS_ATTACKING;
                this.aistatus &= ~AI_STATUS_ROAMING;
 
-               if(this.weapons)
+               if(STAT(WEAPONS, this))
                {
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
                        {
@@ -176,7 +176,7 @@ void havocbot_ai(entity this)
                        if(this.(weaponentity).clip_load >= 0) // only if we're not reloading a weapon already
                        {
                                FOREACH(Weapons, it != WEP_Null, {
-                                       if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo))
+                                       if((STAT(WEAPONS, this) & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo))
                                        {
                                                this.(weaponentity).m_switchweapon = it;
                                                break;
@@ -772,7 +772,12 @@ void havocbot_movetogoal(entity this)
        if (this.goalcurrent == this.goalentity && this.goalentity_lock_timeout > time)
                locked_goal = true;
 
-       navigation_shortenpath(this);
+       if (navigation_shortenpath(this))
+       {
+               if (vdist(this.origin - this.goalcurrent_prev.origin, <, 50)
+                       && navigation_goalrating_timeout_can_be_anticipated(this))
+                       navigation_goalrating_timeout_force(this);
+       }
 
        bool goalcurrent_can_be_removed = false;
        if (IS_MOVABLE(this.goalcurrent))
@@ -1291,7 +1296,7 @@ LABEL(scan_targets)
 
                // I want to do a second scan if no enemy was found or I don't have weapons
                // TODO: Perform the scan when using the rifle (requires changes on the rifle code)
-               if(best || this.weapons) // || this.weapon == WEP_RIFLE.m_id
+               if(best || STAT(WEAPONS, this)) // || this.weapon == WEP_RIFLE.m_id
                        break;
                if(scan_transparent)
                        break;