mirror of
https://github.com/ENSL/NS.git
synced 2024-11-21 12:11:04 +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;
|
||||
}
|
||||
|
|
|
@ -4433,30 +4433,29 @@ void AIPlayerNSAlienThink(AvHAIPlayer* pBot)
|
|||
{
|
||||
if (AlienCombatThink(pBot)) { return; }
|
||||
}
|
||||
|
||||
if (AIPlayerMustFinishCurrentTask(pBot, &pBot->PrimaryBotTask))
|
||||
|
||||
bool bPlayerMustFinishPrimaryTask = AIPlayerMustFinishCurrentTask(pBot, &pBot->PrimaryBotTask);
|
||||
|
||||
if (!bPlayerMustFinishPrimaryTask)
|
||||
{
|
||||
BotProgressTask(pBot, &pBot->PrimaryBotTask);
|
||||
return;
|
||||
}
|
||||
UpdateAIAlienPlayerNSRole(pBot);
|
||||
|
||||
UpdateAIAlienPlayerNSRole(pBot);
|
||||
AvHAIHiveDefinition* HiveToBuild = nullptr;
|
||||
|
||||
AvHAIHiveDefinition* HiveToBuild = nullptr;
|
||||
|
||||
if (AITAC_ShouldBotBuildHive(pBot, &HiveToBuild))
|
||||
{
|
||||
if (pBot->PrimaryBotTask.TaskType != TASK_BUILD || pBot->PrimaryBotTask.StructureType != STRUCTURE_ALIEN_HIVE)
|
||||
if (AITAC_ShouldBotBuildHive(pBot, &HiveToBuild))
|
||||
{
|
||||
pBot->PrimaryBotTask.TaskType = TASK_BUILD;
|
||||
pBot->PrimaryBotTask.StructureType = STRUCTURE_ALIEN_HIVE;
|
||||
char msg[128];
|
||||
sprintf(msg, "I'm going to drop the hive at %s", HiveToBuild->HiveName);
|
||||
BotSay(pBot, true, 1.0f, msg);
|
||||
if (pBot->PrimaryBotTask.TaskType != TASK_BUILD || pBot->PrimaryBotTask.StructureType != STRUCTURE_ALIEN_HIVE)
|
||||
{
|
||||
pBot->PrimaryBotTask.TaskType = TASK_BUILD;
|
||||
pBot->PrimaryBotTask.StructureType = STRUCTURE_ALIEN_HIVE;
|
||||
char msg[128];
|
||||
sprintf(msg, "I'm going to drop the hive at %s", HiveToBuild->HiveName);
|
||||
BotSay(pBot, true, 1.0f, msg);
|
||||
}
|
||||
BotAlienBuildHive(pBot, &pBot->PrimaryBotTask, HiveToBuild);
|
||||
return;
|
||||
}
|
||||
BotAlienBuildHive(pBot, &pBot->PrimaryBotTask, HiveToBuild);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gpGlobals->time >= pBot->BotNextTaskEvaluationTime)
|
||||
{
|
||||
|
@ -4464,7 +4463,10 @@ void AIPlayerNSAlienThink(AvHAIPlayer* pBot)
|
|||
|
||||
AITASK_BotUpdateAndClearTasks(pBot);
|
||||
|
||||
AIPlayerSetPrimaryAlienTask(pBot, &pBot->PrimaryBotTask);
|
||||
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