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 );
}
}

View File

@ -19,7 +19,7 @@ init()
for ( i = 0 ; i < vending_triggers.size; i++ )
{
vending_triggers[i] thread init_vending_trigger();
vending_triggers[ i ] thread init_vending_trigger();
}
}
@ -69,7 +69,7 @@ Finder( eObj )
for ( i = 0 ; i < vending_triggers.size; i++ )
{
vending = vending_triggers[i];
vending = vending_triggers[ i ];
if ( !isdefined( vending.bot_powered_on ) || !vending.bot_powered_on )
{
@ -104,7 +104,7 @@ Finder( eObj )
continue;
}
answer[answer.size] = self CreateFinderObjectiveEZ( eObj, vending );
answer[ answer.size ] = self CreateFinderObjectiveEZ( eObj, vending );
}
return answer;
@ -130,10 +130,10 @@ getPerkCost()
{
if ( self.targetname == "harrybo21_perk_trigger" )
{
return level.zombie_perks[self getVendingPerk()].perk_cost;
return level.zombie_perks[ self getVendingPerk() ].perk_cost;
}
cost = level.zombie_vars["zombie_perk_cost"];
cost = level.zombie_vars[ "zombie_perk_cost" ];
switch ( self getVendingPerk() )
{

View File

@ -17,24 +17,24 @@ Finder( eObj )
for ( i = 0; i < ents.size; i++ )
{
// not a powerup script_model
if ( !isdefined( ents[i].powerup_name ) )
if ( !isdefined( ents[ i ].powerup_name ) )
{
continue;
}
// can we path to it?
if ( GetPathIsInaccessible( self.origin, ents[i].origin ) )
if ( GetPathIsInaccessible( self.origin, ents[ i ].origin ) )
{
continue;
}
// make sure we are the only one going for it
if ( self GetBotsAmountForEntity( ents[i] ) >= 1 )
if ( self GetBotsAmountForEntity( ents[ i ] ) >= 1 )
{
continue;
}
answer[answer.size] = self CreateFinderObjectiveEZ( eObj, ents[i] );
answer[ answer.size ] = self CreateFinderObjectiveEZ( eObj, ents[ i ] );
}
return answer;

View File

@ -15,7 +15,7 @@ Finder( eObj )
for ( i = 0; i < Players.size; i++ )
{
Player = Players[i];
Player = Players[ i ];
if ( !isdefined( Player ) || !isdefined( Player.team ) )
{
@ -47,7 +47,7 @@ Finder( eObj )
continue;
}
Answer[Answer.size] = self CreateFinderObjectiveEZ( eObj, Player );
Answer[ Answer.size ] = self CreateFinderObjectiveEZ( eObj, Player );
}
return Answer;

View File

@ -29,7 +29,7 @@ Finder( eObj )
for ( i = 0; i < chests.size; i ++ )
{
chest = chests[i];
chest = chests[ i ];
// not active chest
if ( isdefined( chest.disabled ) && chest.disabled )
@ -81,7 +81,7 @@ Finder( eObj )
continue;
}
answer[answer.size] = self CreateFinderObjectiveEZ( eObj, chest );
answer[ answer.size ] = self CreateFinderObjectiveEZ( eObj, chest );
}
return answer;

View File

@ -19,7 +19,7 @@ CreateObjectiveForManger( sName, fpFinder, fpPriorty, fpExecuter, iProcessRate )
CreateFinderObjectiveEZ( eObj, eEnt )
{
return self CreateFinderObjective( eObj, eObj.sname + "_" + eEnt getentitynumber(), eEnt, self [[eObj.fppriorty]]( eObj, eEnt ) );
return self CreateFinderObjective( eObj, eObj.sname + "_" + eEnt getentitynumber(), eEnt, self [[ eObj.fppriorty ]]( eObj, eEnt ) );
}
CreateFinderObjective( eObj, sName, eEnt, fPriority )

View File

@ -27,26 +27,26 @@ Finder( eObj )
{
player_has_weapon = false;
if ( !isdefined( weapon_spawns[i].zombie_weapon_upgrade ) )
if ( !isdefined( weapon_spawns[ i ].zombie_weapon_upgrade ) )
{
continue;
}
for ( h = 0; h < weapons.size; h++ )
{
if ( weapons[h] == weapon_spawns[i].zombie_weapon_upgrade )
if ( weapons[ h ] == weapon_spawns[ i ].zombie_weapon_upgrade )
{
player_has_weapon = true;
}
}
is_grenade = ( weapontype( weapon_spawns[i].zombie_weapon_upgrade ) == "grenade" );
is_grenade = ( weapontype( weapon_spawns[ i ].zombie_weapon_upgrade ) == "grenade" );
if ( !player_has_weapon || is_grenade )
{
func = BotBuiltinGetFunction( "maps/_zombiemode_weapons", "get_weapon_cost" );
if ( self.score < [[func]]( weapon_spawns[i].zombie_weapon_upgrade ) )
if ( self.score < [[ func ]]( weapon_spawns[ i ].zombie_weapon_upgrade ) )
{
continue;
}
@ -55,7 +55,7 @@ Finder( eObj )
{
func = BotBuiltinGetFunction( "maps/_zombiemode_weapons", "get_ammo_cost" );
if ( self.score < [[func]]( weapon_spawns[i].zombie_weapon_upgrade ) )
if ( self.score < [[ func ]]( weapon_spawns[ i ].zombie_weapon_upgrade ) )
{
continue;
}
@ -80,7 +80,7 @@ Finder( eObj )
continue;
}
answer[answer.size] = self CreateFinderObjectiveEZ( eObj, weapon_spawns[i] );
answer[ answer.size ] = self CreateFinderObjectiveEZ( eObj, weapon_spawns[ i ] );
}
return answer;
@ -90,7 +90,7 @@ getOffset( model, weapon )
{
org = model get_angle_offset_node( 40, ( 0, -90, 0 ), ( 0, 0, 1 ) );
test_org = ( org[0], org[1], weapon.origin[2] );
test_org = ( org[ 0 ], org[ 1 ], weapon.origin[ 2 ] );
if ( !weapon PointInsideUseTrigger( test_org ) )
{