if(this.draggedby)
return;
+ this.bot_aimdir_executed = false;
+ // lock aim if teleported or passing through a warpzone
+ if (this.lastteleporttime && !this.jumppadcount)
+ this.bot_aimdir_executed = true;
+
if(bot_execute_commands(this))
return;
havocbot_aim(this);
lag_update(this);
- this.bot_aimdir_executed = false;
-
if (this.bot_aimtarg)
{
this.aistatus |= AI_STATUS_ATTACKING;
this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
}
}
- else
+ else //if (this.goalcurrent)
{
if (this.goalcurrent.bot_pickup)
{
return;
}
}
- else
+ else //if (!(this.aistatus & AI_STATUS_OUT_JUMPPAD))
{
- if(time - this.lastteleporttime > 0.2 && this.velocity.z > 0)
+ if(this.origin.z - this.lastteleport_origin.z > (this.maxs.z - this.mins.z) * 0.5)
{
vector velxy = this.velocity; velxy_z = 0;
if(vdist(velxy, <, autocvar_sv_maxspeed * 0.2))
// don't remove if not visible
if (checkpvs(this.origin + this.view_ofs, this.goalcurrent))
{
- navigation_goalrating_timeout_force(this);
- return;
+ if (IS_DEAD(this.goalcurrent))
+ {
+ IL_EACH(g_items, it.enemy == this.goalcurrent && Item_IsLoot(it),
+ {
+ if (vdist(it.origin - this.goalcurrent.death_origin, <, 50))
+ {
+ navigation_clearroute(this);
+ navigation_pushroute(this, it);
+ // loot can't be immediately rated since it isn't on ground yet
+ // it will be rated after a second when on ground, meanwhile head to it
+ navigation_goalrating_timeout_expire(this, 1);
+ return;
+ }
+ });
+ }
+ if (!Item_IsLoot(this.goalcurrent))
+ {
+ navigation_goalrating_timeout_force(this);
+ return;
+ }
}
}
else if (!(STAT(FROZEN, this.goalentity)) && this.bot_tracewalk_time < time)
{
// Step 5: Waypoint reached
LOG_TRACE(this.netname, "'s personal waypoint reached");
- delete(this.havocbot_personal_waypoint);
+ waypoint_remove(this.havocbot_personal_waypoint);
this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
return CMD_STATUS_FINISHED;
}