mirror of
https://github.com/JezuzLizard/t4sp_bot_warfare.git
synced 2025-10-30 17:36:56 +00:00
fmt
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
Finder( eObj )
|
||||
{
|
||||
answer = [];
|
||||
|
||||
|
||||
if ( self inLastStand() )
|
||||
{
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
||||
ents = getentarray( "script_model", "classname" );
|
||||
|
||||
|
||||
for ( i = 0; i < ents.size; i++ )
|
||||
{
|
||||
// not a powerup script_model
|
||||
@@ -21,22 +21,22 @@ Finder( eObj )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// can we path to it?
|
||||
if ( GetPathIsInaccessible( self.origin, ents[ i ].origin ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// make sure we are the only one going for it
|
||||
if ( self GetBotsAmountForEntity( ents[ i ] ) >= 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
answer[ answer.size ] = self CreateFinderObjectiveEZ( eObj, ents[ i ] );
|
||||
}
|
||||
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ Priority( eObj, eEnt )
|
||||
// TODO: check powerup type
|
||||
base_priority = 0;
|
||||
base_priority += ClampLerp( get_path_dist( self.origin, eEnt.origin ), 300, 700, 2, -2 );
|
||||
|
||||
|
||||
if ( self HasBotObjective() && self GetBotObjectiveEnt() != eEnt )
|
||||
{
|
||||
base_priority -= 1;
|
||||
}
|
||||
|
||||
|
||||
return base_priority;
|
||||
}
|
||||
|
||||
@@ -58,25 +58,25 @@ Executer( eObj )
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
self endon( "zombified" );
|
||||
|
||||
|
||||
powerup = eObj.eent;
|
||||
org = powerup.origin;
|
||||
|
||||
|
||||
self thread IncrementBotsForEntity( powerup );
|
||||
self thread WatchForCancel( powerup );
|
||||
|
||||
|
||||
self GoDoPowerup( eObj );
|
||||
|
||||
|
||||
self WatchForCancelCleanup();
|
||||
self DecrementBotsForEntity( powerup );
|
||||
self ClearScriptGoal();
|
||||
|
||||
|
||||
if ( distance( org, self.origin ) <= 64 )
|
||||
{
|
||||
eObj.sreason = "completed";
|
||||
eObj.bwassuccessful = true;
|
||||
}
|
||||
|
||||
|
||||
self CompletedObjective( eObj.bwassuccessful, eObj.sreason );
|
||||
}
|
||||
|
||||
@@ -90,17 +90,17 @@ WatchForCancel( powerup )
|
||||
self endon( "disconnect" );
|
||||
self endon( "zombified" );
|
||||
self endon( "WatchForCancelPowerup" );
|
||||
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
wait 0.05;
|
||||
|
||||
|
||||
if ( self inLastStand() )
|
||||
{
|
||||
self CancelObjective( "self inLastStand()" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( !isdefined( powerup ) )
|
||||
{
|
||||
self CancelObjective( "!isdefined( powerup )" );
|
||||
@@ -112,31 +112,31 @@ WatchForCancel( powerup )
|
||||
GoDoPowerup( eObj )
|
||||
{
|
||||
self endon( "cancel_bot_objective" );
|
||||
|
||||
|
||||
powerup = eObj.eent;
|
||||
|
||||
|
||||
// go to it
|
||||
self SetScriptGoal( powerup.origin, 32 );
|
||||
|
||||
|
||||
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
|
||||
|
||||
|
||||
if ( result != "goal" )
|
||||
{
|
||||
eObj.sreason = "didn't go to powerup";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( !isdefined( powerup ) || !isdefined( powerup.origin ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( distance( powerup.origin, self.origin ) > 64 )
|
||||
{
|
||||
eObj.sreason = "not touching it";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
eObj.sreason = "completed";
|
||||
eObj.bwassuccessful = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user