fix helicopters landing in silly places
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
if (aircraft.Altitude == 0)
|
||||
return NextActivity;
|
||||
|
||||
if (requireSpace && !aircraft.CanEnterCell(self.Location))
|
||||
if (requireSpace && !aircraft.CanLand(self.Location))
|
||||
return this;
|
||||
|
||||
--aircraft.Altitude;
|
||||
|
||||
@@ -468,6 +468,7 @@ TRAN:
|
||||
ROT: 5
|
||||
Speed: 15
|
||||
InitialFacing: 0
|
||||
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
||||
Health:
|
||||
HP: 90
|
||||
Armor:
|
||||
|
||||
@@ -802,6 +802,7 @@ TRAN:
|
||||
InitialFacing: 0
|
||||
ROT: 5
|
||||
Speed: 12
|
||||
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
||||
RenderUnitRotor:
|
||||
PrimaryOffset: 0,14,0,-8
|
||||
SecondaryOffset: 0,-14,0,-5
|
||||
|
||||
Reference in New Issue
Block a user