PutClientInServer(it);
}
});
- bot_relinkplayerlist();
return true;
}
}
frag_target.respawn_flags |= RESPAWN_FORCE;
if (!warmup_stage)
- {
eliminatedPlayers.SendFlags |= 1;
- if (IS_BOT_CLIENT(frag_target))
- bot_clear(frag_target);
- }
return true;
}
{
if (player.lms_spectate_warning < 2)
{
- if(IS_BOT_CLIENT(player))
- bot_clear(player);
player.frags = FRAGS_PLAYER_OUT_OF_GAME;
int pl_cnt = 0;
FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
pl_cnt++;
});
- if(IS_BOT_CLIENT(frag_target))
- bot_clear(frag_target);
frag_target.frags = FRAGS_PLAYER_OUT_OF_GAME;
GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
}
bool bot_fixcount();
void bot_list_commands();
void bot_queuecommand(entity bot, string cmdstring);
-void bot_clear(entity this);
void bot_relinkplayerlist();
void bot_resetqueues();
void bot_serverframe();
}
// if dead, just wait until we can respawn
- if (IS_DEAD(this))
+ if (IS_DEAD(this) || IS_OBSERVER(this))
{
if (bot_waypoint_queue_owner == this)
bot_waypoint_queue_owner = NULL;
this.aistatus = 0;
CS(this).movement = '0 0 0';
- if (this.deadflag == DEAD_DEAD)
+ if (IS_OBSERVER(this))
+ return;
+ if (IS_DEAD(this))
{
PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
- navigation_goalrating_timeout_force(this);
+ if (!navigation_goalrating_timeout(this))
+ navigation_goalrating_timeout_force(this);
}
}
else if(this.aistatus & AI_STATUS_STUCK)
if(IS_BOT_CLIENT(it))
{
- if(prevbot)
- prevbot.nextbot = it;
- else
- bot_list = it;
- prevbot = it;
+ if (!IS_OBSERVER(it) && !bot_ispaused(it))
+ {
+ if(prevbot)
+ prevbot.nextbot = it;
+ else
+ bot_list = it;
+ prevbot = it;
+ }
++currentbots;
}
});
if(prevbot)
prevbot.nextbot = NULL;
- LOG_TRACE("relink: ", ftos(currentbots), " bots seen.");
bot_strategytoken = bot_list;
bot_strategytoken_taken = true;
}
return true;
}
-void bot_remove_from_bot_list(entity this)
-{
- entity e = bot_list;
- entity prev_bot = NULL;
- while (e)
- {
- if(e == this)
- {
- if(!prev_bot)
- bot_list = this.nextbot;
- else
- prev_bot.nextbot = this.nextbot;
- if(bot_strategytoken == this)
- {
- bot_strategytoken = this.nextbot;
- bot_strategytoken_taken = true;
- }
- this.nextbot = NULL;
- break;
- }
- prev_bot = e;
- e = e.nextbot;
- }
-}
-
-void bot_clear(entity this)
-{
- bot_remove_from_bot_list(this);
- if(bot_waypoint_queue_owner == this)
- bot_waypoint_queue_owner = NULL;
- this.aistatus &= ~AI_STATUS_STUCK; // otherwise bot_waypoint_queue_owner will be set again to this by navigation_unstuck
-}
-
void bot_serverframe()
{
if (intermission_running && currentbots > 0)
void bot_custom_weapon_priority_setup();
void bot_endgame();
void bot_relinkplayerlist();
-void bot_clear(entity this);
void bot_clientdisconnect(entity this);
void bot_clientconnect(entity this);
void bot_removefromlargestteam();
if(bot_execute_commands(this))
return;
+ // after bot_execute_commands otherwise bots can't be unpaused
+ if (bot_ispaused(this))
+ return;
+
if (bot_strategytoken == this && !bot_strategytoken_taken)
{
if(this.havocbot_blockhead)
float bot_cmd_continue(entity this)
{
- bot_relinkplayerlist();
this.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
+ bot_relinkplayerlist();
return CMD_STATUS_FINISHED;
}
return bot_cmd_keypress_handler(this, key,false);
}
+bool bot_ispaused(entity this)
+{
+ return(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED);
+}
+
float bot_cmd_pause(entity this)
{
PHYS_INPUT_BUTTON_DRAG(this) = false;
CS(this).movement = '0 0 0';
this.bot_cmd_keys = BOT_CMD_KEY_NONE;
- bot_clear(this);
this.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
+ bot_relinkplayerlist();
return CMD_STATUS_FINISHED;
}
.float bot_cmd_execution_index; // Position in the queue of the command to be executed
+bool bot_ispaused(entity this);
+
void bot_resetqueues();
void bot_queuecommand(entity bot, string cmdstring);
void bot_cmdhelp(string scmd);
SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR);
this.frags = FRAGS_SPECTATOR;
}
+
+ bot_relinkplayerlist();
+
if (CS(this).just_joined)
CS(this).just_joined = false;
}
} else if (IS_PLAYER(this)) {
PutPlayerInServer(this);
}
+
+ bot_relinkplayerlist();
}
// TODO do we need all these fields, or should we stop autodetecting runtime