X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fhavocbot%2Fhavocbot.qc;h=63f1e0179442941435d9dfc6aeb30ef6e8c9d8c4;hb=2e0ea8a4df1c5170b228f7a4ea425d8c4ef5fa8b;hp=b66d423d98fa31337b3e3ab8cb411d9042ae70ca;hpb=dde75a49c8c781947c6d5ef5968bb78f24171e25;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index b66d423d9..63f1e0179 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -668,7 +669,8 @@ void havocbot_movetogoal(entity this) return; } - else if(GetResourceAmount(this, RESOURCE_HEALTH) + GetResourceAmount(this, RESOURCE_ARMOR) > ROCKETJUMP_DAMAGE()) + else if(!this.jumppadcount && !this.goalcurrent.wphardwired + && GetResourceAmount(this, RESOURCE_HEALTH) + GetResourceAmount(this, RESOURCE_ARMOR) > ROCKETJUMP_DAMAGE()) { if(this.velocity.z < 0) { @@ -861,13 +863,18 @@ void havocbot_movetogoal(entity this) // if bot used the jumppad, push towards jumppad origin until jumppad waypoint gets removed destorg = this.goalcurrent.origin; } - else if (this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z)) + else if (this.goalcurrent.wpisbox) { // if bot is inside the teleport waypoint, head to teleport origin until teleport gets used - bunnyhop_forbidden = true; - destorg = this.goalcurrent.origin; - if(destorg.z > this.origin.z) - PHYS_INPUT_BUTTON_JUMP(this) = true; + // do it even if bot is on a ledge above a teleport/jumppad so it doesn't get stuck + if (boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z) + || (this.absmin.z > destorg.z && destorg.x == this.origin.x && destorg.y == this.origin.y)) + { + bunnyhop_forbidden = true; + destorg = this.goalcurrent.origin; + if(destorg.z > this.origin.z) + PHYS_INPUT_BUTTON_JUMP(this) = true; + } } diff = destorg - this.origin; @@ -1151,8 +1158,13 @@ void havocbot_movetogoal(entity this) } if (ladder_zdir) { - dir.z = ladder_zdir * 1.3; - dir = normalize(dir); + if (vdist(flatdir, <, 15)) + dir = ladder_zdir * '0 0 1'; + else + { + dir.z = ladder_zdir * 1.3; + dir = normalize(dir); + } } } @@ -1390,7 +1402,7 @@ void havocbot_chooseweapon(entity this, .entity weaponentity) // Should it do a weapon combo? float af, ct, combo_time, combo; - af = ATTACK_FINISHED(this, 0); + af = ATTACK_FINISHED(this, weaponentity); ct = autocvar_bot_ai_weapon_combo_threshold; // Bots with no skill will be 4 times more slower than "godlike" bots when doing weapon combos