mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 15:21:54 +00:00
Adjusted base node definitions
This commit is contained in:
parent
bb810972c5
commit
f59de3b88f
2 changed files with 76 additions and 2 deletions
|
@ -670,7 +670,6 @@ void AITAC_PopulateHiveData()
|
|||
if (NearestNode)
|
||||
{
|
||||
NewHive.HiveResNodeRef = NearestNode;
|
||||
NearestNode->bIsBaseNode = true;
|
||||
NearestNode->ParentHive = NewHive.HiveEntity->edict();
|
||||
}
|
||||
|
||||
|
@ -719,6 +718,11 @@ void AITAC_RefreshHiveData()
|
|||
it->OwningTeam = CurrentOwningTeam;
|
||||
it->Status = CurrentStatus;
|
||||
|
||||
if (it->HiveResNodeRef)
|
||||
{
|
||||
it->HiveResNodeRef->bIsBaseNode = (it->Status != HIVE_STATUS_UNBUILT);
|
||||
}
|
||||
|
||||
if (it->Status != HIVE_STATUS_UNBUILT && it->ObstacleRefs[REGULAR_NAV_MESH] == 0)
|
||||
{
|
||||
UTIL_AddTemporaryObstacles(UTIL_GetCentreOfEntity(it->HiveEntity->edict()) - Vector(0.0f, 0.0f, 25.0f), 125.0f, 300.0f, DT_AREA_NULL, it->ObstacleRefs);
|
||||
|
@ -835,11 +839,48 @@ Vector AITAC_GetTeamStartingLocation(AvHTeamNumber Team)
|
|||
|
||||
// Update reachabilities since team starting points have been modified
|
||||
bNavMeshModified = true;
|
||||
|
||||
AITAC_OnTeamStartsModified();
|
||||
}
|
||||
|
||||
return (Team == GetGameRules()->GetTeamANumber()) ? TeamAStartingLocation : TeamBStartingLocation;
|
||||
}
|
||||
|
||||
void AITAC_OnTeamStartsModified()
|
||||
{
|
||||
AvHTeamNumber TeamANum = GetGameRules()->GetTeamANumber();
|
||||
AvHTeamNumber TeamBNum = GetGameRules()->GetTeamBNumber();
|
||||
|
||||
bool bTeamAIsMarine = (AIMGR_GetTeamType(TeamANum) == AVH_CLASS_TYPE_MARINE);
|
||||
bool bTeamBIsMarine = (AIMGR_GetTeamType(TeamBNum) == AVH_CLASS_TYPE_MARINE);
|
||||
|
||||
if (!bTeamAIsMarine && !bTeamBIsMarine) { return; }
|
||||
|
||||
AvHAIResourceNode* TeamAMarineNode = nullptr;
|
||||
AvHAIResourceNode* TeamBMarineNode = nullptr;
|
||||
|
||||
if (bTeamAIsMarine)
|
||||
{
|
||||
TeamAMarineNode = AITAC_GetNearestResourceNodeToLocation(TeamAStartingLocation);
|
||||
}
|
||||
|
||||
if (bTeamBIsMarine)
|
||||
{
|
||||
TeamBMarineNode = AITAC_GetNearestResourceNodeToLocation(TeamBStartingLocation);
|
||||
}
|
||||
|
||||
vector<AvHAIResourceNode*> AllNodes = AITAC_GetAllResourceNodes();
|
||||
|
||||
for (auto it = AllNodes.begin(); it != AllNodes.end(); it++)
|
||||
{
|
||||
AvHAIResourceNode* ThisNode = (*it);
|
||||
|
||||
if (!ThisNode) { continue; }
|
||||
|
||||
ThisNode->bIsBaseNode = (!ThisNode->ParentHive) && (ThisNode == TeamAMarineNode || ThisNode == TeamBMarineNode);
|
||||
}
|
||||
}
|
||||
|
||||
Vector AITAC_GetCommChairLocation(AvHTeamNumber Team)
|
||||
{
|
||||
if (Team != TEAM_IND)
|
||||
|
@ -3451,7 +3492,22 @@ edict_t* AITAC_GetNearestHiddenPlayerInLocation(AvHTeamNumber Team, const Vector
|
|||
return Result;
|
||||
}
|
||||
|
||||
const vector<AvHAIResourceNode*> AITAC_GetAllReachableResourceNodes(AvHTeamNumber Team)
|
||||
{
|
||||
vector<AvHAIResourceNode*> Results;
|
||||
|
||||
for (auto it = ResourceNodes.begin(); it != ResourceNodes.end(); it++)
|
||||
{
|
||||
unsigned int CheckReachabilityFlags = (Team == GetGameRules()->GetTeamANumber()) ? it->TeamAReachabilityFlags : it->TeamBReachabilityFlags;
|
||||
|
||||
if (CheckReachabilityFlags != AI_REACHABILITY_UNREACHABLE && CheckReachabilityFlags != AI_REACHABILITY_NONE)
|
||||
{
|
||||
Results.push_back(&(*it));
|
||||
}
|
||||
}
|
||||
|
||||
return Results;
|
||||
}
|
||||
|
||||
const vector<AvHAIResourceNode*> AITAC_GetAllResourceNodes()
|
||||
{
|
||||
|
@ -3641,7 +3697,22 @@ bool AITAC_IsAlienCapperNeeded(AvHAIPlayer* pBot)
|
|||
AvHTeamNumber BotTeam = pBot->Player->GetTeam();
|
||||
AvHTeamNumber EnemyTeam = AIMGR_GetEnemyTeam(BotTeam);
|
||||
|
||||
float ResNodeOwnership = AITAC_GetTeamResNodeOwnership(BotTeam, true);
|
||||
int NumOwnedNodes = 0;
|
||||
int NumEnemyNodes = 0;
|
||||
int NumEligibleNodes = 0;
|
||||
|
||||
vector<AvHAIResourceNode*> AllNodes = AITAC_GetAllReachableResourceNodes(BotTeam);
|
||||
|
||||
for (auto it = AllNodes.begin(); it != AllNodes.end(); it++)
|
||||
{
|
||||
AvHAIResourceNode* ThisNode = (*it);
|
||||
|
||||
if (ThisNode->OwningTeam == BotTeam) { NumOwnedNodes++; }
|
||||
if (ThisNode->OwningTeam == EnemyTeam) { NumEnemyNodes++; }
|
||||
if (ThisNode->OwningTeam != EnemyTeam || !ThisNode->bIsBaseNode) { NumEligibleNodes++; }
|
||||
}
|
||||
|
||||
float ResNodeOwnership = (float)NumOwnedNodes / (float)NumEligibleNodes;
|
||||
|
||||
if (ResNodeOwnership > 0.6f) { return false; }
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ edict_t* AITAC_GetMarineEligibleToBuildSiege(AvHTeamNumber Team, const AvHAIHive
|
|||
edict_t* AITAC_GetNearestHiddenPlayerInLocation(AvHTeamNumber Team, const Vector Location, const float MaxRadius);
|
||||
|
||||
const vector<AvHAIResourceNode*> AITAC_GetAllResourceNodes();
|
||||
const vector<AvHAIResourceNode*> AITAC_GetAllReachableResourceNodes(AvHTeamNumber Team);
|
||||
const vector<AvHAIHiveDefinition*> AITAC_GetAllHives();
|
||||
const vector<AvHAIHiveDefinition*> AITAC_GetAllTeamHives(AvHTeamNumber Team);
|
||||
|
||||
|
@ -169,4 +170,6 @@ bool AITAC_ShouldBotBuildHive(AvHAIPlayer* pBot, AvHAIHiveDefinition** EligibleH
|
|||
|
||||
AvHAIDeployableStructureType AITAC_GetNextMissingUpgradeChamberForTeam(AvHTeamNumber Team);
|
||||
|
||||
void AITAC_OnTeamStartsModified();
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue