X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fhavocbot%2Fhavocbot.qc;h=761300005321530823d3c8f1ddf60bc6f6bcded4;hp=9321d388c52e6b129990538fb038fa21e6b1d7c2;hb=d492869ab1f18e05121529b7bcffcb637d13994c;hpb=50d8efb863874f811bdcc118d7e873836902e453 diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 9321d388c5..7613000053 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -9,6 +9,7 @@ #include "../waypoints.qh" #include +#include #include #include #include @@ -179,7 +180,7 @@ void havocbot_ai(entity this) // we are currently holding a weapon that's not fully loaded, reload it if(skill >= 2) // bots can only reload the held weapon on purpose past this skill if(this.(weaponentity).clip_load < this.(weaponentity).clip_size) - this.impulse = 20; // "press" the reload button, not sure if this is done right + this.impulse = IMP_weapon_reload.impulse; // not sure if this is done right // if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next // the code above executes next frame, starting the reloading then @@ -188,7 +189,10 @@ void havocbot_ai(entity this) { FOREACH(Weapons, it != WEP_Null, LAMBDA( if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo)) + { this.(weaponentity).m_switchweapon = it; + break; + } )); } } @@ -1022,13 +1026,10 @@ float havocbot_chooseweapon_checkreload(entity this, .entity weaponentity, int n // if this weapon is scheduled for reloading, don't switch to it during combat if (this.(weaponentity).weapon_load[new_weapon] < 0) { - bool other_weapon_available = false; FOREACH(Weapons, it != WEP_Null, LAMBDA( if(it.wr_checkammo1(it, this, weaponentity) + it.wr_checkammo2(it, this, weaponentity)) - other_weapon_available = true; + return true; // other weapon available )); - if(other_weapon_available) - return true; } return false;