]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/havocbot/havocbot.qc
Make ladders use the same iterative logic as conveyors, fixes some maps with super...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / havocbot / havocbot.qc
index 619d08dc5c878e23f4d131d2ecb2dd10a93ee826..0ff47977762180e7eb5688d9215e3623ccd0fafe 100644 (file)
@@ -48,7 +48,7 @@ void havocbot_ai(entity this)
                else
                {
                        if (!this.jumppadcount && !STAT(FROZEN, this)
-                               && !(this.goalcurrent_prev && (this.goalcurrent_prev.wpflags & WAYPOINTFLAG_JUMP)))
+                               && !(this.goalcurrent_prev && (this.goalcurrent_prev.wpflags & WAYPOINTFLAG_JUMP) && !IS_ONGROUND(this)))
                        {
                                // find a new goal
                                this.havocbot_role(this); // little too far down the rabbit hole
@@ -561,8 +561,8 @@ void havocbot_movetogoal(entity this)
        if (skill > 6 && !(IS_ONGROUND(this)))
        {
                #define ROCKETJUMP_DAMAGE() WEP_CVAR(devastator, damage) * 0.8 \
-                       * ((this.strength_finished > time) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \
-                       * ((this.invincible_finished > time) ? autocvar_g_balance_powerup_invincible_takedamage : 1)
+                       * ((STAT(STRENGTH_FINISHED, this) > time) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \
+                       * ((STAT(INVINCIBLE_FINISHED, this) > time) ? autocvar_g_balance_powerup_invincible_takedamage : 1)
 
                // save some CPU cycles by checking trigger_hurt after checking
                // that something can be done to evade it (cheaper checks)
@@ -956,7 +956,7 @@ void havocbot_movetogoal(entity this)
                        {
                                if (vlen2(flat_diff) < vlen2(offset))
                                {
-                                       if (this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP && this.goalstack01)
+                                       if ((this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP) && this.goalstack01)
                                        {
                                                // oblique warpzones need a jump otherwise bots gets stuck
                                                PHYS_INPUT_BUTTON_JUMP(this) = true;
@@ -1174,7 +1174,7 @@ void havocbot_movetogoal(entity this)
        }
 
        float ladder_zdir = 0;
-       if(time < this.ladder_time)
+       if(this.ladder_entity)
        {
                if(this.goalcurrent.origin.z + this.goalcurrent.mins.z > this.origin.z + this.mins.z)
                {
@@ -1476,13 +1476,13 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
 
                // Choose weapons for far distance
                if ( distance > bot_distance_far ) {
-                       for(i=0; i < Weapons_COUNT && bot_weapons_far[i] != -1 ; ++i){
+                       for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_far[i] != -1 ; ++i){
                                w = bot_weapons_far[i];
-                               if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                               if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                                {
                                        if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                                continue;
-                                       this.(weaponentity).m_switchweapon = Weapons_from(w);
+                                       this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                        return;
                                }
                        }
@@ -1490,26 +1490,26 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
 
                // Choose weapons for mid distance
                if ( distance > bot_distance_close) {
-                       for(i=0; i < Weapons_COUNT && bot_weapons_mid[i] != -1 ; ++i){
+                       for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_mid[i] != -1 ; ++i){
                                w = bot_weapons_mid[i];
-                               if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                               if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                                {
                                        if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                                continue;
-                                       this.(weaponentity).m_switchweapon = Weapons_from(w);
+                                       this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                        return;
                                }
                        }
                }
 
                // Choose weapons for close distance
-               for(i=0; i < Weapons_COUNT && bot_weapons_close[i] != -1 ; ++i){
+               for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_close[i] != -1 ; ++i){
                        w = bot_weapons_close[i];
-                       if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                       if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                        {
                                if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                        continue;
-                               this.(weaponentity).m_switchweapon = Weapons_from(w);
+                               this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                return;
                        }
                }