Skip to content

Commit

Permalink
Bots now consider domination flags important, hopefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raptor007 committed Feb 9, 2018
1 parent c02351f commit d1eabe3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions source/acesrc/acebot_ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,34 @@ void ACEAI_PickLongRangeGoal(edict_t *self)
}
}

///////////////////////////////////////////////////////
// Domination Flags
///////////////////////////////////////////////////////
if( dom->value )
{
edict_t *flag = NULL;
while(( flag = G_Find( flag, FOFS(classname), "item_flag" ) ))
{
// Only chase flags we don't already control.
if( DomFlagOwner(flag) == self->client->resp.team )
continue;

node = ACEND_FindClosestReachableNode( flag, NODE_DENSITY, NODE_ALL );
if( node == INVALID )
continue;

// Always prioritize flags we don't own, so only use cost to differentiate them.
cost = ACEND_FindCost( current_node, node );
weight = 10000 - cost;

if( weight > best_weight )
{
best_weight = weight;
goal_node = node;
goal_ent = flag;
}
}
}

//Added by Werewolf
//-------------------------------
Expand Down
5 changes: 5 additions & 0 deletions source/acesrc/acebot_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ float ACEIT_ItemNeed( edict_t *self, edict_t *item_ent )
{
if( ! item_ent )
return 0;

// Make sure domination flags are always considered important short-range goals.
if( dom->value && (strcasecmp( item_ent->classname, "item_flag" ) == 0) )
return (DomFlagOwner(item_ent) != self->client->resp.team) ? 9000 : 0;

gitem_t *item = FindItemByClassname( item_ent->classname );
if( ! item )
return 0;
Expand Down

0 comments on commit d1eabe3

Please sign in to comment.