mirror of
https://github.com/JezuzLizard/t4sp_bot_warfare.git
synced 2025-04-22 06:25:44 +00:00
add processrate to objs
This commit is contained in:
parent
7c9f6fca11
commit
1302a40869
@ -6,8 +6,8 @@
|
||||
init()
|
||||
{
|
||||
level.bot_objectives = [];
|
||||
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "revive", maps\bots\objectives\_revive::Finder, maps\bots\objectives\_revive::Executer, maps\bots\objectives\_revive::Priority );
|
||||
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "powerup", maps\bots\objectives\_powerup::Finder, maps\bots\objectives\_powerup::Executer, maps\bots\objectives\_powerup::Priority );
|
||||
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "revive", maps\bots\objectives\_revive::Finder, maps\bots\objectives\_revive::Executer, maps\bots\objectives\_revive::Priority, 1000 );
|
||||
level.bot_objectives[level.bot_objectives.size] = CreateObjectiveForManger( "powerup", maps\bots\objectives\_powerup::Finder, maps\bots\objectives\_powerup::Executer, maps\bots\objectives\_powerup::Priority, 2500 );
|
||||
}
|
||||
|
||||
connected()
|
||||
@ -59,6 +59,8 @@ clean_objective_on_completion()
|
||||
if ( isDefined( self.bot_current_objective ) )
|
||||
{
|
||||
obj_name = self.bot_current_objective.sName;
|
||||
|
||||
self.bot_current_objective.eParentObj.aBotProcessTimes[self GetEntityNumber() + ""] = getTime();
|
||||
}
|
||||
|
||||
PrintConsole( "clean_objective_on_completion: " + self.playername + ": " + obj_name + ": " + successful + ": " + reason );
|
||||
@ -89,12 +91,21 @@ bot_objective_think()
|
||||
|
||||
// find all avail objectives
|
||||
objectives = [];
|
||||
now = getTime();
|
||||
our_key = self GetEntityNumber() + "";
|
||||
|
||||
for ( i = 0; i < level.bot_objectives.size; i++ )
|
||||
{
|
||||
objective = level.bot_objectives[i];
|
||||
|
||||
// check the process rate
|
||||
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;
|
||||
}
|
||||
|
||||
if ( objectives.size <= 0 )
|
||||
@ -135,6 +146,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;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2,22 +2,17 @@
|
||||
#include maps\_utility;
|
||||
#include maps\bots\_bot_utility;
|
||||
|
||||
CreateObjectiveForManger( sName, fpFinder, fpExecuter, fpPriority )
|
||||
CreateObjectiveForManger( sName, fpFinder, fpExecuter, fpPriority, iProcessRate )
|
||||
{
|
||||
Answer = SpawnStruct();
|
||||
|
||||
Answer.sName = sName;
|
||||
Answer.fpFinder = fpFinder;
|
||||
Answer.fpExecuter = fpExecuter;
|
||||
|
||||
if ( !IsDefined( fpPriority ) )
|
||||
{
|
||||
Answer.fpPriority = ::DefaultPriority;
|
||||
}
|
||||
else
|
||||
{
|
||||
Answer.fpPriority = fpPriority;
|
||||
}
|
||||
|
||||
Answer.aBotProcessTimes = [];
|
||||
Answer.iProcessRate = iProcessRate;
|
||||
|
||||
return Answer;
|
||||
}
|
||||
@ -38,11 +33,6 @@ CreateFinderObjective( eObj, sName, eEnt, fPriority )
|
||||
return Answer;
|
||||
}
|
||||
|
||||
DefaultPriority( eObj, eEnt )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Checks whether the path generated by the ASTAR path finding is inaccessible
|
||||
*/
|
||||
@ -168,10 +158,12 @@ get_angle_offset_node( forward_size, angle_offset, offset )
|
||||
{
|
||||
forward_size = 40;
|
||||
}
|
||||
|
||||
if ( !isDefined( angle_offset ) )
|
||||
{
|
||||
angle_offset = ( 0, 0, 0 );
|
||||
}
|
||||
|
||||
if ( !isDefined( offset ) )
|
||||
{
|
||||
offset = ( 0, 0, 0 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user