fix helicopters landing in silly places

This commit is contained in:
Chris Forbes
2010-11-11 18:59:10 +13:00
parent c1eacc225d
commit bc7a9c14d0
4 changed files with 16 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ namespace OpenRA.Mods.RA.Air
public readonly int InitialFacing = 128;
public readonly int ROT = 255;
public readonly int Speed = 1;
public readonly string[] LandableTerrainTypes = { };
public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); }
}
@@ -102,5 +103,17 @@ namespace OpenRA.Mods.RA.Air
var angle = facing * Math.PI / 128.0;
return new int2( (int)Math.Truncate( 1024 * Math.Sin( angle ) ), (int)Math.Truncate( 1024 * Math.Cos( angle ) ) );
}
public bool CanLand(int2 cell)
{
if (!self.World.Map.IsInMap(cell))
return false;
if (self.World.WorldActor.Trait<UnitInfluence>().AnyUnitsAt(cell))
return false;
var type = self.World.GetTerrainType(cell);
return Info.LandableTerrainTypes.Contains(type);
}
}
}