fix bots stance using remote

added bot ads aimspeed slow
This commit is contained in:
INeedBots 2021-03-01 03:43:18 -06:00
parent 578ae5cd2b
commit e7fef2e080

View File

@ -40,6 +40,8 @@ added()
self.pers["bots"]["skill"]["aim_offset_amount"] = 1; // how far a bot's incorrect aim is self.pers["bots"]["skill"]["aim_offset_amount"] = 1; // how far a bot's incorrect aim is
self.pers["bots"]["skill"]["bone_update_interval"] = 0.05; // how often a bot changes their bone target self.pers["bots"]["skill"]["bone_update_interval"] = 0.05; // how often a bot changes their bone target
self.pers["bots"]["skill"]["bones"] = "j_head"; // a list of comma seperated bones the bot will aim at self.pers["bots"]["skill"]["bones"] = "j_head"; // a list of comma seperated bones the bot will aim at
self.pers["bots"]["skill"]["ads_fov_multi"] = 0.5; // a factor of how much ads to reduce when adsing
self.pers["bots"]["skill"]["ads_aimspeed_multi"] = 0.5; // a factor of how much more aimspeed delay to add
self.pers["bots"]["behavior"] = []; self.pers["bots"]["behavior"] = [];
self.pers["bots"]["behavior"]["strafe"] = 50; // percentage of how often the bot strafes a target self.pers["bots"]["behavior"]["strafe"] = 50; // percentage of how often the bot strafes a target
@ -758,6 +760,8 @@ target()
usingRemote = self isUsingRemote(); usingRemote = self isUsingRemote();
ignoreSmoke = isSubStr(self GetCurrentWeapon(), "_thermal_"); ignoreSmoke = isSubStr(self GetCurrentWeapon(), "_thermal_");
vehEnt = undefined; vehEnt = undefined;
adsAmount = self PlayerADS();
adsFovFact = self.pers["bots"]["skill"]["ads_fov_multi"];
if (usingRemote) if (usingRemote)
{ {
@ -768,7 +772,10 @@ target()
} }
// reduce fov if ads'ing // reduce fov if ads'ing
myFov *= 1 - 0.5 * self PlayerADS(); if (adsAmount > 0)
{
myFov *= 1 - adsFovFact * adsAmount;
}
if(hasTarget && !isDefined(self.bot.target.entity)) if(hasTarget && !isDefined(self.bot.target.entity))
{ {
@ -1100,6 +1107,14 @@ aim()
curweap = self getCurrentWeapon(); curweap = self getCurrentWeapon();
eyePos = self getEye(); eyePos = self getEye();
angles = self GetPlayerAngles(); angles = self GetPlayerAngles();
adsAmount = self PlayerADS();
adsAimSpeedFact = self.pers["bots"]["skill"]["ads_aimspeed_multi"];
// reduce aimspeed if ads'ing
if (adsAmount > 0)
{
aimspeed *= 1 + adsAimSpeedFact * adsAmount;
}
if (isDefined(self.bot.jav_loc) && !usingRemote) if (isDefined(self.bot.jav_loc) && !usingRemote)
{ {
@ -1232,7 +1247,7 @@ aim()
if(!self canFire(curweap) || !self isInRange(dist, curweap)) if(!self canFire(curweap) || !self isInRange(dist, curweap))
continue; continue;
canADS = self canAds(dist, curweap); canADS = (self canAds(dist, curweap) && conedot > 0.65);
if (canADS) if (canADS)
self thread pressAds(); self thread pressAds();
@ -1241,7 +1256,7 @@ aim()
if (trace_time > reaction_time) if (trace_time > reaction_time)
{ {
if((!canADS || self playerads() == 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.95 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire")) if((!canADS || adsAmount >= 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.95 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire"))
self botFire(curweap); self botFire(curweap);
if (isplay) if (isplay)
@ -1274,11 +1289,11 @@ aim()
if(!self canFire(curweap) || !self isInRange(dist, curweap)) if(!self canFire(curweap) || !self isInRange(dist, curweap))
continue; continue;
canADS = self canAds(dist, curweap); canADS = (self canAds(dist, curweap) && conedot > 0.65);
if (canADS) if (canADS)
self thread pressAds(); self thread pressAds();
if((!canADS || self playerads() == 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.95 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire")) if((!canADS || adsAmount >= 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.95 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire"))
self botFire(curweap); self botFire(curweap);
continue; continue;
@ -2030,6 +2045,9 @@ jump()
self notify("bot_jump"); self notify("bot_jump");
self endon("bot_jump"); self endon("bot_jump");
if (self IsUsingRemote())
return;
if(self getStance() != "stand") if(self getStance() != "stand")
{ {
self stand(); self stand();
@ -2046,6 +2064,9 @@ jump()
*/ */
stand() stand()
{ {
if (self IsUsingRemote())
return;
self botAction("-gocrouch"); self botAction("-gocrouch");
self botAction("-goprone"); self botAction("-goprone");
} }
@ -2055,6 +2076,9 @@ stand()
*/ */
crouch() crouch()
{ {
if (self IsUsingRemote())
return;
self botAction("+gocrouch"); self botAction("+gocrouch");
self botAction("-goprone"); self botAction("-goprone");
} }
@ -2064,6 +2088,9 @@ crouch()
*/ */
prone() prone()
{ {
if (self IsUsingRemote() || self.hasRiotShieldEquipped)
return;
self botAction("-gocrouch"); self botAction("-gocrouch");
self botAction("+goprone"); self botAction("+goprone");
} }