float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
{
- local float f, r;
+ local float f, r, hf, distanceratio;
local vector v;
/*
eprint(self);
dprint(", ", ftos(applygravity));
dprint(");\n");
*/
+
+ hf = self.dphitcontentsmask;
+ self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+
shotspeed *= g_weaponspeedfactor;
shotspeedupward *= g_weaponspeedfactor;
if (!shotspeed)
shotorg = self.origin + self.view_ofs;
shotdir = v_forward;
v = bot_shotlead(self.bot_aimtargorigin, self.bot_aimtargvelocity, shotspeed, self.bot_aimlatency);
- local float distanceratio;
- distanceratio =sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
+ distanceratio = sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
distanceratio = bound(0,distanceratio,1);
r = (autocvar_bot_ai_aimskill_firetolerance_maxdegrees-autocvar_bot_ai_aimskill_firetolerance_mindegrees)
* (1-distanceratio) + autocvar_bot_ai_aimskill_firetolerance_mindegrees;
if (applygravity && self.bot_aimtarg)
{
if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self))
+ {
+ self.dphitcontentsmask = hf;
return FALSE;
+ }
+
f = bot_aimdir(findtrajectory_velocity - shotspeedupward * '0 0 1', r);
}
else
if (trace_fraction < 1)
if (trace_ent != self.enemy)
if (!bot_shouldattack(trace_ent))
+ {
+ self.dphitcontentsmask = hf;
return FALSE;
+ }
}
//if (r > maxshottime * shotspeed)
// return FALSE;
+ self.dphitcontentsmask = hf;
return TRUE;
};
// Handling of jump pads
if(self.jumppadcount)
{
- // If got stuck on the jump pad try to reach the farthest visible item
+ // If got stuck on the jump pad try to reach the farthest visible waypoint
if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
{
if(fabs(self.velocity_z)<50)
local entity head, newgoal;
local float distance, bestdistance;
- for (head = findchainfloat(bot_pickup, TRUE); head; head = head.chain)
+ for (head = findchain(classname, "waypoint"); head; head = head.chain)
{
- if(head.classname=="worldspawn")
- continue;
distance = vlen(head.origin - self.origin);
if(distance>1000)
{
if(self.velocity_z>0)
{
- local float threshold;
+ float threshold, sxy;
+ vector velxy = self.velocity; velxy_z = 0;
+ sxy = vlen(velxy);
threshold = maxspeed * 0.2;
- if(fabs(self.velocity_x) < threshold && fabs(self.velocity_y) < threshold)
+ if(sxy < threshold)
{
- dprint("Warning: ", self.netname, " got stuck on a jumppad, trying to get out of it now\n");
+ dprint("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
self.aistatus |= AI_STATUS_OUT_JUMPPAD;
}
return;
void havocbot_chooseenemy()
{
local entity head, best, head2;
- local float rating, bestrating, i, f;
+ local float rating, bestrating, i, hf;
local vector eye, v;
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
{
bestrating = 100000000;
head = head2 = findchainfloat(bot_attack, TRUE);
+ // Backup hit flags
+ hf = self.dphitcontentsmask;
+
// Search for enemies, if no enemy can be seen directly try to look through transparent objects
+
+ self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+
for(;;)
{
while (head)
break;
// Set flags to see through transparent objects
- f = self.dphitcontentsmask;
- self.dphitcontentsmask = DPCONTENTS_OPAQUE;
+ self.dphitcontentsmask |= DPCONTENTS_OPAQUE;
head = head2;
++i;
}
- // Restore hit flags if needed
- if(i)
- self.dphitcontentsmask = f;
+ // Restore hit flags
+ self.dphitcontentsmask = hf;
self.enemy = best;
self.havocbot_stickenemy = TRUE;
BADPREFIX("developer_");
BADPREFIX("g_ban_");
BADPREFIX("g_chat_flood_");
+ BADPREFIX("g_playerstats_");
BADPREFIX("g_voice_flood_");
BADPREFIX("rcon_");
BADPREFIX("settemp_");
BADPREFIX("sv_weaponstats_");
// these can contain player IDs, so better hide
- BADCVAR("g_forced_team_red");
- BADCVAR("g_forced_team_blue");
- BADCVAR("g_forced_team_yellow");
- BADCVAR("g_forced_team_pink");
+ BADPREFIX("g_forced_team_");
// mapinfo
BADCVAR("fraglimit");
BADCVAR("g_ctf_ignore_frags");
BADCVAR("g_ctf_win_mode");
BADCVAR("g_domination_point_limit");
+ BADCVAR("g_friendlyfire");
BADCVAR("g_fullbrightitems");
BADCVAR("g_fullbrightplayers");
BADCVAR("g_keyhunt_point_limit");
BADCVAR("g_maplist_votable_abstain");
BADCVAR("g_maplist_votable_nodetail");
BADCVAR("g_maplist_votable_suggestions");
+ BADCVAR("g_maxplayers");
BADCVAR("g_minstagib");
+ BADCVAR("g_mirrordamage");
BADCVAR("g_nexball_goallimit");
BADCVAR("g_runematch_point_limit");
BADCVAR("g_start_delay");
+ BADCVAR("g_warmup");
BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
BADCVAR("hostname");
BADCVAR("log_file");
BADCVAR("maxplayers");
- BADCVAR("g_maxplayers");
BADCVAR("minplayers");
BADCVAR("net_address");
BADCVAR("port");
BADCVAR("sv_vote_master_commands");
BADCVAR("sv_vote_master_password");
BADCVAR("sv_vote_simple_majority_factor");
+ BADCVAR("sys_ticrate");
+ BADCVAR("teamplay_mode");
BADCVAR("timelimit_override");
- BADCVAR("g_warmup");
BADPREFIX("g_warmup_");
- BADCVAR("teamplay_mode");
if(autocvar_g_minstagib)
{
self.bot_secondary_riflemooth = 0;
if(self.bot_secondary_riflemooth == 0)
{
- if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, TRUE))
+ if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
{
self.BUTTON_ATCK = TRUE;
if(random() < 0.01) self.bot_secondary_riflemooth = 1;
}
else
{
- if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, TRUE))
+ if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
{
self.BUTTON_ATCK2 = TRUE;
if(random() < 0.03) self.bot_secondary_riflemooth = 0;
self.rifle_accumulator += autocvar_g_balance_rifle_primary_burstcost;
}
if (self.BUTTON_ATCK2)
- {
+ {
if (autocvar_g_balance_rifle_secondary)
{
if(autocvar_g_balance_rifle_secondary_reload)
if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shotgun_secondary_melee_range)
self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
else
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+ {
+ if(autocvar_g_antilag_bullets)
+ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+ else
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_shotgun_primary_speed, 0, 0.001, FALSE);
+ }
+
else if (req == WR_THINK)
{
if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload