mirror of
https://github.com/ENSL/NS.git
synced 2024-11-21 20:21:14 +00:00
Task priority and path merging
* Potentially fixed issue causing invalid paths * Fixed issue where gorges wouldn't heal anyone while focused on capping res node or building defensive structures
This commit is contained in:
parent
ff3b4afb1c
commit
d17cb601eb
3 changed files with 26 additions and 23 deletions
|
@ -2695,8 +2695,6 @@ void CheckAndHandleDoorObstruction(AvHAIPlayer* pBot)
|
|||
{
|
||||
if (Trigger->TriggerType == DOOR_BUTTON)
|
||||
{
|
||||
Vector UseLocation = UTIL_GetButtonFloorLocation(pBot->Edict->v.origin, Trigger->Edict);
|
||||
|
||||
NAV_SetUseMovementTask(pBot, Trigger->Edict, Trigger);
|
||||
}
|
||||
else if (Trigger->TriggerType == DOOR_TRIGGER)
|
||||
|
@ -6429,7 +6427,7 @@ bool NAV_MergeAndUpdatePath(AvHAIPlayer* pBot, std::vector<bot_path_node>& NewPa
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!vEquals(OldPathEnd->FromLocation, NewPathStart->FromLocation, 16.0f) || !vEquals(OldPathEnd->Location, NewPathStart->Location, 16.0f))
|
||||
if (OldPathEnd->flag != NewPathStart->flag || !vEquals(OldPathEnd->FromLocation, NewPathStart->FromLocation, 16.0f) || !vEquals(OldPathEnd->Location, NewPathStart->Location, 16.0f))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4434,12 +4434,10 @@ void AIPlayerNSAlienThink(AvHAIPlayer* pBot)
|
|||
if (AlienCombatThink(pBot)) { return; }
|
||||
}
|
||||
|
||||
if (AIPlayerMustFinishCurrentTask(pBot, &pBot->PrimaryBotTask))
|
||||
{
|
||||
BotProgressTask(pBot, &pBot->PrimaryBotTask);
|
||||
return;
|
||||
}
|
||||
bool bPlayerMustFinishPrimaryTask = AIPlayerMustFinishCurrentTask(pBot, &pBot->PrimaryBotTask);
|
||||
|
||||
if (!bPlayerMustFinishPrimaryTask)
|
||||
{
|
||||
UpdateAIAlienPlayerNSRole(pBot);
|
||||
|
||||
AvHAIHiveDefinition* HiveToBuild = nullptr;
|
||||
|
@ -4457,6 +4455,7 @@ void AIPlayerNSAlienThink(AvHAIPlayer* pBot)
|
|||
BotAlienBuildHive(pBot, &pBot->PrimaryBotTask, HiveToBuild);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gpGlobals->time >= pBot->BotNextTaskEvaluationTime)
|
||||
{
|
||||
|
@ -4464,7 +4463,10 @@ void AIPlayerNSAlienThink(AvHAIPlayer* pBot)
|
|||
|
||||
AITASK_BotUpdateAndClearTasks(pBot);
|
||||
|
||||
if (!bPlayerMustFinishPrimaryTask)
|
||||
{
|
||||
AIPlayerSetPrimaryAlienTask(pBot, &pBot->PrimaryBotTask);
|
||||
}
|
||||
AIPlayerSetSecondaryAlienTask(pBot, &pBot->SecondaryBotTask);
|
||||
AIPlayerSetWantsAndNeedsAlienTask(pBot, &pBot->WantsAndNeedsTask);
|
||||
}
|
||||
|
|
|
@ -4779,6 +4779,9 @@ bool AITAC_ShouldBotBuildHive(AvHAIPlayer* pBot, AvHAIHiveDefinition** EligibleH
|
|||
{
|
||||
AvHAIPlayer* OtherBot = (*it);
|
||||
|
||||
// Another bot already plans to do it
|
||||
if (OtherBot->PrimaryBotTask.TaskType == TASK_BUILD && OtherBot->PrimaryBotTask.StructureType == STRUCTURE_ALIEN_HIVE) { return false; }
|
||||
|
||||
// If the other bot has enough resources to drop a hive, and they're a less expensive life form than us, let them do it.
|
||||
if (OtherBot->Player->GetResources() >= BALANCE_VAR(kHiveCost) * 0.8f && OtherBot->Player->GetUser3() < pBot->Player->GetUser3()) { return false; }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue