]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move this.goalcurrent check inside havocbot_bunnyhop
authorterencehill <piuntn@gmail.com>
Wed, 4 Sep 2019 20:30:50 +0000 (22:30 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 4 Sep 2019 20:35:25 +0000 (22:35 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc

index d055fc962b7a25e5100c71b2b66898bb9d485647..4e32ce99a0c415927749afa9f89b672f6e2a6c49 100644 (file)
@@ -270,7 +270,7 @@ void havocbot_bunnyhop(entity this, vector dir)
        if(this.aistatus & AI_STATUS_ATTACKING)
                return;
 
-       if(IS_PLAYER(this.goalcurrent))
+       if (!this.goalcurrent || IS_PLAYER(this.goalcurrent))
                return;
 
        if((this.aistatus & AI_STATUS_RUNNING) && vdist(this.velocity, <, autocvar_sv_maxspeed * 0.75)
@@ -295,8 +295,6 @@ void havocbot_bunnyhop(entity this, vector dir)
                this.bot_timelastseengoal = 0;
        }
 
-       vector gco = get_closer_dest(this.goalcurrent, this.origin);
-
        // Run only to visible goals
        if(IS_ONGROUND(this))
        if(vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed))
@@ -307,6 +305,7 @@ void havocbot_bunnyhop(entity this, vector dir)
                // seen it before
                if(this.bot_timelastseengoal)
                {
+                       vector gco = get_closer_dest(this.goalcurrent, this.origin);
                        // for a period of time
                        if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
                        {
@@ -1256,9 +1255,7 @@ void havocbot_movetogoal(entity this)
                havocbot_keyboard_movement(this, destorg);
 
        // Bunnyhop!
-       //if(this.aistatus & AI_STATUS_ROAMING)
-       if(!bunnyhop_forbidden && this.goalcurrent)
-       if(skill+this.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
+       if (!bunnyhop_forbidden && skill + this.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
                havocbot_bunnyhop(this, dir);
 
        if (dir * v_up >= autocvar_sv_jumpvelocity * 0.5 && IS_ONGROUND(this))