Thread: Fuel limit
View Single Post
  #2  
Old 05-21-2012, 06:03 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Fuel limit on spawning

Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
     base.OnPlaceEnter(player, actor, placeIndex);

     AiAircraft aircraft = actor as AiAircraft;
     if (aircraft != null)
     {
         double FuelLimit = 100; // max kg's of fuel allowed
         double f = aircraft.getParameter(part.ParameterTypes.S_FuelReserve, -1);  // kg's of fuel in aircraft
         if (f > FuelLimit)  // too much fuel
        {
            aircraft.Destroy();    // too much fuel so destroy plane
        }
     }
}
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 05-21-2012 at 06:23 AM.
Reply With Quote