This commit is contained in:
ineed bots
2023-12-19 16:58:31 -06:00
parent 271ea76c3e
commit 9e2025e86a
13 changed files with 640 additions and 640 deletions

View File

@@ -6,12 +6,12 @@
init()
{
level.bot_objectives = [];
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "revive", maps\bots\objectives\_revive::Finder, maps\bots\objectives\_revive::Priority, maps\bots\objectives\_revive::Executer, 1000 );
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "powerup", maps\bots\objectives\_powerup::Finder, maps\bots\objectives\_powerup::Priority, maps\bots\objectives\_powerup::Executer, 2500 );
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "wallweapon", maps\bots\objectives\_wallweapon::Finder, maps\bots\objectives\_wallweapon::Priority, maps\bots\objectives\_wallweapon::Executer, 7500 );
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "treasurechest", maps\bots\objectives\_treasurechest::Finder, maps\bots\objectives\_treasurechest::Priority, maps\bots\objectives\_treasurechest::Executer, 7000 );
level.bot_objectives[ level.bot_objectives.size ] = CreateObjectiveForManger( "revive", maps\bots\objectives\_revive::Finder, maps\bots\objectives\_revive::Priority, maps\bots\objectives\_revive::Executer, 1000 );
level.bot_objectives[ level.bot_objectives.size ] = CreateObjectiveForManger( "powerup", maps\bots\objectives\_powerup::Finder, maps\bots\objectives\_powerup::Priority, maps\bots\objectives\_powerup::Executer, 2500 );
level.bot_objectives[ level.bot_objectives.size ] = CreateObjectiveForManger( "wallweapon", maps\bots\objectives\_wallweapon::Finder, maps\bots\objectives\_wallweapon::Priority, maps\bots\objectives\_wallweapon::Executer, 7500 );
level.bot_objectives[ level.bot_objectives.size ] = CreateObjectiveForManger( "treasurechest", maps\bots\objectives\_treasurechest::Finder, maps\bots\objectives\_treasurechest::Priority, maps\bots\objectives\_treasurechest::Executer, 7000 );
maps\bots\objectives\_perkmachine::init();
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "perkmachine", maps\bots\objectives\_perkmachine::Finder, maps\bots\objectives\_perkmachine::Priority, maps\bots\objectives\_perkmachine::Executer, 10000 );
level.bot_objectives[ level.bot_objectives.size ] = CreateObjectiveForManger( "perkmachine", maps\bots\objectives\_perkmachine::Finder, maps\bots\objectives\_perkmachine::Priority, maps\bots\objectives\_perkmachine::Executer, 10000 );
}
connected()
@@ -64,7 +64,7 @@ clean_objective_on_completion()
{
obj_name = self.bot_current_objective.sname;
self.bot_current_objective.eparentobj.abotprocesstimes[self getentitynumber() + ""] = gettime();
self.bot_current_objective.eparentobj.abotprocesstimes[ self getentitynumber() + "" ] = gettime();
}
self BotNotifyBotEvent( "debug", "clean_objective_on_completion: " + obj_name + ": " + successful + ": " + reason );
@@ -100,16 +100,16 @@ bot_objective_think()
for ( i = 0; i < level.bot_objectives.size; i++ )
{
objective = level.bot_objectives[i];
objective = level.bot_objectives[ i ];
// check the process rate
if ( isdefined( objective.abotprocesstimes[our_key] ) && now - objective.abotprocesstimes[our_key] < objective.iprocessrate )
if ( isdefined( objective.abotprocesstimes[ our_key ] ) && now - objective.abotprocesstimes[ our_key ] < objective.iprocessrate )
{
continue;
}
objectives = array_merge( objectives, self [[objective.fpfinder]]( objective ) );
objective.abotprocesstimes[our_key] = now;
objectives = array_merge( objectives, self [[ objective.fpfinder ]]( objective ) );
objective.abotprocesstimes[ our_key ] = now;
}
if ( objectives.size <= 0 )
@@ -122,16 +122,16 @@ bot_objective_think()
for ( i = 0; i < objectives.size; i++ )
{
if ( objectives[i].fpriority <= -100 )
if ( objectives[ i ].fpriority <= -100 )
{
continue;
}
heap HeapInsert( objectives[i] );
heap HeapInsert( objectives[ i ] );
}
// pop the top!
best_prio = heap.data[0];
best_prio = heap.data[ 0 ];
if ( !isdefined( best_prio ) )
{
@@ -139,7 +139,7 @@ bot_objective_think()
}
// already on a better obj
if ( isdefined( self.bot_current_objective ) && ( best_prio.guid == self.bot_current_objective.guid || best_prio.fpriority < self [[self.bot_current_objective.eparentobj.fppriorty]]( self.bot_current_objective.eparentobj, self.bot_current_objective.eent ) ) )
if ( isdefined( self.bot_current_objective ) && ( best_prio.guid == self.bot_current_objective.guid || best_prio.fpriority < self [[ self.bot_current_objective.eparentobj.fppriorty ]]( self.bot_current_objective.eparentobj, self.bot_current_objective.eent ) ) )
{
continue;
}
@@ -155,7 +155,7 @@ bot_objective_think()
self waittill( "completed_bot_objective" );
// redo the loop, should do the obj next iteration
best_prio.eparentobj.abotprocesstimes[our_key] = undefined;
best_prio.eparentobj.abotprocesstimes[ our_key ] = undefined;
continue;
}
@@ -163,6 +163,6 @@ bot_objective_think()
self BotNotifyBotEvent( "debug", "bot_objective_think: " + best_prio.sname );
self.bot_current_objective = best_prio;
self thread [[best_prio.eparentobj.fpexecuter]]( best_prio );
self thread [[ best_prio.eparentobj.fpexecuter ]]( best_prio );
}
}