Added optimization

This commit is contained in:
ineedbots 2021-05-04 17:30:11 -06:00
parent 80a00b019b
commit e438ea2f02

View File

@ -137,6 +137,7 @@ resetBotVars()
self.bot.is_cur_full_auto = false; self.bot.is_cur_full_auto = false;
self.bot.cur_weap_dist_multi = 1; self.bot.cur_weap_dist_multi = 1;
self.bot.is_cur_sniper = false; self.bot.is_cur_sniper = false;
self.bot.is_cur_akimbo = false;
self.bot.rand = randomInt(100); self.bot.rand = randomInt(100);
@ -225,6 +226,7 @@ onWeaponChange()
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon); self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(newWeapon); self.bot.cur_weap_dist_multi = SetWeaponDistMulti(newWeapon);
self.bot.is_cur_sniper = IsWeapSniper(newWeapon); self.bot.is_cur_sniper = IsWeapSniper(newWeapon);
self.bot.is_cur_akimbo = isSubStr(newWeapon, "_akimbo_");
if (newWeapon == "none") if (newWeapon == "none")
continue; continue;
@ -1516,14 +1518,12 @@ aim()
*/ */
botFire(curweap) botFire(curweap)
{ {
isAkimbo = isSubStr(curweap, "_akimbo_");
self.bot.last_fire_time = getTime(); self.bot.last_fire_time = getTime();
if(self.bot.is_cur_full_auto) if(self.bot.is_cur_full_auto)
{ {
self thread pressFire(); self thread pressFire();
if (isAkimbo) self thread pressAds(); if (self.bot.is_cur_akimbo) self thread pressAds();
return; return;
} }
@ -1531,7 +1531,7 @@ botFire(curweap)
return; return;
self thread pressFire(); self thread pressFire();
if (isAkimbo) self thread pressAds(); if (self.bot.is_cur_akimbo) self thread pressAds();
self thread doSemiTime(); self thread doSemiTime();
} }
@ -1595,7 +1595,7 @@ canAds(dist, curweap)
if (curweap == "riotshield_mp" || curweap == "onemanarmy_mp") if (curweap == "riotshield_mp" || curweap == "onemanarmy_mp")
return false; return false;
if (isSubStr(curweap, "_akimbo_")) if (self.bot.is_cur_akimbo)
return false; return false;
return true; return true;
@ -1614,7 +1614,7 @@ isInRange(dist, curweap)
if (self IsUsingRemote()) if (self IsUsingRemote())
return true; return true;
if((weapclass == "spread" || isSubStr(curweap, "_akimbo_")) && dist > level.bots_maxShotgunDistance) if((weapclass == "spread" || self.bot.is_cur_akimbo) && dist > level.bots_maxShotgunDistance)
return false; return false;
if (curweap == "riotshield_mp" && dist > level.bots_maxKnifeDistance) if (curweap == "riotshield_mp" && dist > level.bots_maxKnifeDistance)