This commit is contained in:
INeedBots 2020-09-26 18:53:35 -06:00
parent 56fc9148ac
commit d0098e8b44

View File

@ -214,28 +214,31 @@ drawLine( start, end, timeSlice )
* Usage functions * Usage functions
***********************************************************/ ***********************************************************/
tryUseAirdropPredatorMissile( lifeId ) tryUseAirdropPredatorMissile( lifeId, kID )
{ {
return ( self tryUseAirdrop( lifeId , "airdrop_predator_missile" ) ); return ( self tryUseAirdrop( lifeId, kID, "airdrop_predator_missile" ) );
} }
tryUseAirdropSentryMinigun( lifeId ) tryUseAirdropSentryMinigun( lifeId, kID )
{ {
return ( self tryUseAirdrop( lifeId, "airdrop_sentry_minigun" ) ); return ( self tryUseAirdrop( lifeId, kID, "airdrop_sentry_minigun" ) );
} }
tryUseMegaAirdrop( lifeId ) tryUseMegaAirdrop( lifeId, kID )
{ {
return ( self tryUseAirdrop( lifeId, "airdrop_mega" ) ); return ( self tryUseAirdrop( lifeId, kID, "airdrop_mega" ) );
} }
tryUseAirdrop( lifeId, dropType ) tryUseAirdrop( lifeId, kID, dropType )
{ {
result = undefined; result = undefined;
if ( !isDefined( dropType ) ) if ( !isDefined( dropType ) )
dropType = "airdrop"; dropType = "airdrop";
if ( !isDefined( self.pers["kIDs_valid"][kID] ) )
return true;
if ( level.littleBirds >= 3 && dropType != "airdrop_mega" ) if ( level.littleBirds >= 3 && dropType != "airdrop_mega" )
{ {
self iPrintLnBold( &"MP_AIR_SPACE_TOO_CROWDED" ); self iPrintLnBold( &"MP_AIR_SPACE_TOO_CROWDED" );
@ -259,14 +262,14 @@ tryUseAirdrop( lifeId, dropType )
self thread watchDisconnect(); self thread watchDisconnect();
} }
result = self beginAirdropViaMarker( lifeId, dropType ); result = self beginAirdropViaMarker( lifeId, kID, dropType );
if ( (!isDefined( result ) || !result) && !isDefined( self.airDropMarker ) ) if ( (!isDefined( result ) || !result) && isDefined( self.pers["kIDs_valid"][kID] ) )
{ {
self notify( "markerDetermined" ); self notify( "markerDetermined" );
if ( dropType != "airdrop_mega" ) if ( dropType != "airdrop_mega" )
level.littleBirds--; decrementLittleBirdCount();
return false; return false;
} }
@ -283,7 +286,7 @@ watchDisconnect()
self endon( "markerDetermined" ); self endon( "markerDetermined" );
self waittill( "disconnect" ); self waittill( "disconnect" );
level.littleBirds--; decrementLittleBirdCount();
return; return;
} }
@ -292,13 +295,13 @@ watchDisconnect()
* Marker functions * Marker functions
***********************************************************/ ***********************************************************/
beginAirdropViaMarker( lifeId, dropType ) beginAirdropViaMarker( lifeId, kID, dropType )
{ {
self endon ( "death" ); self endon ( "death" );
self endon ( "grenade_fire" ); self endon ( "grenade_fire" );
self.airDropMarker = undefined; self.airDropMarker = undefined;
self thread watchAirDropMarkerUsage( dropType ); self thread watchAirDropMarkerUsage( dropType, kID );
while( self isChangingWeapon() ) while( self isChangingWeapon() )
wait ( 0.05 ); wait ( 0.05 );
@ -310,7 +313,7 @@ beginAirdropViaMarker( lifeId, dropType )
else else
airdropMarkerWeapon = undefined; airdropMarkerWeapon = undefined;
while( isAirdropMarker( currentWeapon ) ) while( isAirdropMarker( currentWeapon ) /*|| currentWeapon == "none"*/ )
{ {
self waittill( "weapon_change", currentWeapon ); self waittill( "weapon_change", currentWeapon );
@ -327,7 +330,7 @@ beginAirdropViaMarker( lifeId, dropType )
} }
watchAirDropMarkerUsage( dropType ) watchAirDropMarkerUsage( dropType, kID )
{ {
self notify( "watchAirDropMarkerUsage" ); self notify( "watchAirDropMarkerUsage" );
@ -335,7 +338,7 @@ watchAirDropMarkerUsage( dropType )
self endon( "watchAirDropMarkerUsage" ); self endon( "watchAirDropMarkerUsage" );
self endon( "stopWatchingAirDropMarker" ); self endon( "stopWatchingAirDropMarker" );
thread watchAirDropMarker( dropType ); thread watchAirDropMarker( dropType, kID );
for ( ;; ) for ( ;; )
{ {
@ -350,7 +353,7 @@ watchAirDropMarkerUsage( dropType )
} }
} }
watchAirDropMarker( dropType ) watchAirDropMarker( dropType, kID )
{ {
self notify( "watchAirDropMarker" ); self notify( "watchAirDropMarker" );
@ -365,6 +368,14 @@ watchAirDropMarker( dropType )
if ( !isAirdropMarker( weapname ) ) if ( !isAirdropMarker( weapname ) )
continue; continue;
if ( !isDefined( self.pers["kIDs_valid"][kID] ) )
{
airDropWeapon delete();
continue;
}
self.pers["kIDs_valid"][kID] = undefined;
airDropWeapon thread airdropDetonateOnStuck(); airDropWeapon thread airdropDetonateOnStuck();
airDropWeapon.owner = self; airDropWeapon.owner = self;
@ -822,7 +833,7 @@ doFlyBy( owner, dropSite, dropYaw, dropType, heightAdjustment )
chopper waittill ( "goal" ); chopper waittill ( "goal" );
chopper notify( "leaving" ); chopper notify( "leaving" );
chopper trimActiveBirdList(); chopper trimActiveBirdList();
level.littleBirds--; decrementLittleBirdCount();
chopper notify( "delete" ); chopper notify( "delete" );
chopper delete(); chopper delete();
} }
@ -1094,7 +1105,7 @@ heliDestroyed()
return; return;
self trimActiveBirdList(); self trimActiveBirdList();
level.littleBirds--; decrementLittleBirdCount();
self Vehicle_SetSpeed( 25, 5 ); self Vehicle_SetSpeed( 25, 5 );
self thread lbSpin( RandomIntRange(180, 220) ); self thread lbSpin( RandomIntRange(180, 220) );
@ -1551,3 +1562,11 @@ airdropDetonateOnStuck()
self detonate(); self detonate();
} }
decrementLittleBirdCount()
{
level.littleBirds--;
level.littleBirds = int( max( level.littleBirds, 0 ) );
}