]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix bots occasionally jumping (dodging) when they shouldn't
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 6c056c27e718936952436c632f160a03c4b92872..57b4c310e37ed33760c7500f81c5fa1d8089d7f3 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 8261f36b39c391e77feb62374397d671f3bf549a..639717a901920b53c96339daebbeae95465b7511 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);
                }