Bot AI: fix bots occasionally jumping (dodging) when they shouldn't master
authorterencehill <piuntn@gmail.com>
Fri, 19 Jul 2019 13:29:56 +0000 (15:29 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 19 Jul 2019 13:29:56 +0000 (15:29 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/client.qc

index 6c056c2..57b4c31 100644 (file)
@@ -1259,9 +1259,15 @@ void havocbot_movetogoal(entity this)
        if(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))) PHYS_INPUT_BUTTON_JUMP(this) = true;
-       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(this) = true;
-       if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) this.havocbot_ducktime=time+0.3/bound(0.1,skill+this.bot_dodgeskill,10);
+       if (dir * v_up >= autocvar_sv_jumpvelocity * 0.5 && IS_ONGROUND(this))
+               PHYS_INPUT_BUTTON_JUMP(this) = true;
+       if (dodge)
+       {
+               if (dodge * v_up > 0 && random() * frametime >= 0.2 * bound(0, (10 - skill - this.bot_dodgeskill) * 0.1, 1))
+                       PHYS_INPUT_BUTTON_JUMP(this) = true;
+               if (dodge * v_up < 0 && random() * frametime >= 0.5 * bound(0, (10 - skill - this.bot_dodgeskill) * 0.1, 1))
+                       this.havocbot_ducktime = time + 0.3 / bound(0.1, skill + this.bot_dodgeskill, 10);
+       }
 }
 
 entity havocbot_gettarget(entity this, bool secondary)
index 8261f36..639717a 100644 (file)
@@ -2047,7 +2047,7 @@ void PrintWelcomeMessage(entity this)
                        CS(this).motd_actived_time = -2; // wait until BUTTON_INFO gets released
                else if(CS(this).motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
                {
-                       // instanctly hide MOTD
+                       // instantly hide MOTD
                        CS(this).motd_actived_time = 0;
                        Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                }