mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 07:11:38 +00:00
Team fill logic adjusted
* The auto-fill system for bots now takes mp_limitteams into account, and will continue to add bots to one side if the team size config specifies it to
This commit is contained in:
parent
8fef7241a0
commit
9452b8a0c3
3 changed files with 43 additions and 4 deletions
|
@ -3309,8 +3309,10 @@ void AICOMM_CommanderThink(AvHAIPlayer* pBot)
|
|||
if (RelocationHive)
|
||||
{
|
||||
char msg[128];
|
||||
sprintf(msg, "We're relocating to %s, lads", RelocationHive->HiveName);
|
||||
BotSay(pBot, true, 1.0f, msg);
|
||||
if (AICOMM_GetRelocationMessage(pBot->RelocationSpot, msg))
|
||||
{
|
||||
BotSay(pBot, true, 1.0f, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3329,6 +3331,37 @@ void AICOMM_CommanderThink(AvHAIPlayer* pBot)
|
|||
if (AICOMM_CheckForNextSupplyAction(pBot)) { return; }
|
||||
}
|
||||
|
||||
bool AICOMM_GetRelocationMessage(Vector RelocationPoint, char* MessageBuffer)
|
||||
{
|
||||
const AvHAIHiveDefinition* RelocationHive = AITAC_GetHiveNearestLocation(RelocationPoint);
|
||||
|
||||
if (!RelocationHive)
|
||||
{
|
||||
sprintf(MessageBuffer, "We're relocating, get ready");
|
||||
return true;
|
||||
}
|
||||
|
||||
int MsgIndex = irandrange(0, 2);
|
||||
|
||||
switch (MsgIndex)
|
||||
{
|
||||
case 0:
|
||||
sprintf(MessageBuffer, "We're relocating to %s, lads", RelocationHive->HiveName);
|
||||
return true;
|
||||
case 1:
|
||||
sprintf(MessageBuffer, "Relocate to %s, go go go", RelocationHive->HiveName);
|
||||
return true;
|
||||
case 2:
|
||||
sprintf(MessageBuffer, "I'm relocating to %s", RelocationHive->HiveName);
|
||||
return true;
|
||||
default:
|
||||
sprintf(MessageBuffer, "We're relocating, get ready");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AICOMM_IsCommanderActionValid(AvHAIPlayer* pBot, commander_action* Action)
|
||||
{
|
||||
if (Action->NumActionAttempts > 5) { return false; }
|
||||
|
|
|
@ -74,4 +74,6 @@ void AICOMM_ReceiveChatRequest(AvHAIPlayer* Commander, edict_t* Requestor, const
|
|||
|
||||
bool AICOMM_ShouldCommanderRelocate(AvHAIPlayer* pBot);
|
||||
|
||||
bool AICOMM_GetRelocationMessage(Vector RelocationPoint, char* MessageBuffer);
|
||||
|
||||
#endif // AVH_AI_COMMANDER_H
|
|
@ -24,6 +24,7 @@ extern cvar_t avh_botusemapdefaults;
|
|||
extern cvar_t avh_botcommandermode;
|
||||
extern cvar_t avh_botdebugmode;
|
||||
extern cvar_t avh_botskill;
|
||||
extern cvar_t avh_limitteams;
|
||||
|
||||
float LastAIPlayerCountUpdate = 0.0f;
|
||||
|
||||
|
@ -224,8 +225,11 @@ void AIMGR_UpdateFillTeams()
|
|||
bRemoveB = !bRemoveB;
|
||||
}
|
||||
}
|
||||
|
||||
bool bCanAddToTeamA = (GetGameRules()->GetCheatsEnabled() || TeamSizeA < TeamSizeB || TeamSizeA - TeamSizeB < avh_limitteams.value);
|
||||
bool bCanAddToTeamB = (GetGameRules()->GetCheatsEnabled() || TeamSizeB < TeamSizeA || TeamSizeB - TeamSizeA < avh_limitteams.value);
|
||||
|
||||
if (TeamSizeA < NumDesiredTeamA && TeamSizeA <= TeamSizeB)
|
||||
if (TeamSizeA < NumDesiredTeamA && bCanAddToTeamA)
|
||||
{
|
||||
// Don't add a bot if we have any stuck in the ready room, wait for teams to resolve themselves
|
||||
if (AIMGR_GetNumAIPlayersOnTeam(TEAM_IND) > 0) { return; }
|
||||
|
@ -242,7 +246,7 @@ void AIMGR_UpdateFillTeams()
|
|||
}
|
||||
}
|
||||
|
||||
if (TeamSizeB < NumDesiredTeamB && TeamSizeB <= TeamSizeA)
|
||||
if (TeamSizeB < NumDesiredTeamB && bCanAddToTeamB)
|
||||
{
|
||||
// Don't add a bot if we have any stuck in the ready room, wait for teams to resolve themselves
|
||||
if (AIMGR_GetNumAIPlayersOnTeam(TEAM_IND) > 0) { return; }
|
||||
|
|
Loading…
Reference in a new issue