small fixes

This commit is contained in:
ineed bots 2023-07-14 20:18:54 -06:00
parent 411a1a047a
commit e25adccf15
2 changed files with 20 additions and 1 deletions

View File

@ -6,25 +6,29 @@
Finder( eObj )
{
answer = [];
ents = getentarray( "script_model", "classname" );
if ( self inLastStand() )
{
return answer;
}
ents = getentarray( "script_model", "classname" );
for ( i = 0; i < ents.size; i++ )
{
// not a powerup script_model
if ( !isDefined( ents[i].powerup_name ) )
{
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;
@ -56,6 +60,7 @@ Executer( eObj )
self endon( "zombified" );
powerup = eObj.eEnt;
org = powerup.origin;
self thread IncrementBotsForEntity( powerup );
self thread WatchForCancel( powerup );
@ -66,6 +71,12 @@ Executer( eObj )
self DecrementBotsForEntity( powerup );
self ClearScriptGoal();
if ( distance( org, self.origin ) <= 64 )
{
eObj.sReason = "completed";
eObj.bWasSuccessful = true;
}
self CompletedObjective( eObj.bWasSuccessful, eObj.sReason );
}

View File

@ -98,6 +98,8 @@ WatchForCancelRevive( revivee )
self endon( "zombified" );
self endon( "WatchForCancelRevive" );
org = revivee.origin;
for ( ;; )
{
wait 0.05;
@ -119,6 +121,12 @@ WatchForCancelRevive( revivee )
self CancelObjective( "revivee.revivetrigger.beingrevived && !self isReviving( revivee )" );
break;
}
if ( distance( revivee.origin, org ) > 16 )
{
self CancelObjective( "distance( revivee.origin, org ) > 16" );
break;
}
}
}