diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index f7dd4eb396..f002d16e56 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -205,7 +205,6 @@ - diff --git a/OpenRA.Game/Traits/World/AircraftInfluence.cs b/OpenRA.Game/Traits/World/AircraftInfluence.cs deleted file mode 100644 index 78eabf500f..0000000000 --- a/OpenRA.Game/Traits/World/AircraftInfluence.cs +++ /dev/null @@ -1,87 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using OpenRA.FileFormats; - -namespace OpenRA.Traits -{ - public class AircraftInfluenceInfo : ITraitInfo - { - public object Create( ActorInitializer init ) { return new AircraftInfluence( init.world ); } - } - - public class AircraftInfluence : ITick - { - List[,] influence; - Map map; - - public AircraftInfluence( World world ) - { - map = world.Map; - influence = new List[world.Map.MapSize.X, world.Map.MapSize.Y]; - for (int i = 0; i < world.Map.MapSize.X; i++) - for (int j = 0; j < world.Map.MapSize.Y; j++) - influence[ i, j ] = new List(); - - world.ActorRemoved += a => Remove( a, a.traits.GetOrDefault() ); - } - - public void Tick( Actor self ) - { - SanityCheck( self ); - } - - [Conditional( "SANITY_CHECKS" )] - void SanityCheck( Actor self ) - { - for( int x = 0 ; x < self.World.Map.MapSize.X ; x++ ) - for( int y = 0 ; y < self.World.Map.MapSize.Y ; y++ ) - if( influence[ x, y ] != null ) - foreach (var a in influence[ x, y ]) - if (!a.traits.Get().OccupiedAirCells().Contains( new int2( x, y ) ) ) - throw new InvalidOperationException( "AIM: Sanity check failed A" ); - - foreach( var t in self.World.Queries.WithTraitMultiple() ) - foreach( var cell in t.Trait.OccupiedAirCells() ) - if (!influence[cell.X, cell.Y].Contains(t.Actor)) - throw new InvalidOperationException( "AIM: Sanity check failed B" ); - } - - Actor[] noActors = { }; - public IEnumerable GetUnitsAt( int2 a ) - { - if (!map.IsInMap(a)) return noActors; - return influence[ a.X, a.Y ]; - } - - public void Add( Actor self, IOccupyAir unit ) - { - foreach( var c in unit.OccupiedAirCells() ) - influence[c.X, c.Y].Add(self); - } - - public void Remove( Actor self, IOccupyAir unit ) - { - if (unit != null) - foreach (var c in unit.OccupiedAirCells()) - influence[c.X, c.Y].Remove(self); - } - - public void Update(Actor self, IOccupyAir unit) - { - Remove(self, unit); - if (!self.IsDead()) Add(self, unit); - } - } -} diff --git a/OpenRA.Mods.Cnc/MobileAir.cs b/OpenRA.Mods.Cnc/MobileAir.cs deleted file mode 100644 index 68baee1507..0000000000 --- a/OpenRA.Mods.Cnc/MobileAir.cs +++ /dev/null @@ -1,102 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ -#endregion - -using System.Collections.Generic; -using System.Linq; - -namespace OpenRA.Traits -{ - public class MobileAirInfo : MobileInfo - { - public readonly int CruiseAltitude = 20; - public readonly float InstabilityMagnitude = 2.0f; - public readonly int InstabilityTicks = 5; - public readonly bool LandWhenIdle = true; - - public override object Create(ActorInitializer init) { return new MobileAir(init, this); } - } - - public class MobileAir : Mobile, ITick, IOccupyAir - { - MobileAirInfo AirInfo; - public MobileAir (ActorInitializer init, MobileAirInfo info) - : base(init, info) - { - AirInfo = info; - } - - public override void AddInfluence() - { - self.World.WorldActor.traits.Get().Add( self, this ); - } - - public override void RemoveInfluence() - { - self.World.WorldActor.traits.Get().Remove( self, this ); - } - - public override bool CanEnterCell(int2 p, Actor ignoreBuilding, bool checkTransientActors) - { - if (!checkTransientActors) - return true; - - return self.World.WorldActor.traits.Get().GetUnitsAt(p).Count() == 0; - } - - public override void FinishedMoving(Actor self) {} - - public override float MovementCostForCell(Actor self, int2 cell) - { - return (!self.World.Map.IsInMap(cell.X,cell.Y)) ? float.PositiveInfinity : 0; - } - - public override float MovementSpeedForCell(Actor self, int2 cell) - { - var modifier = self.traits - .WithInterface() - .Select(t => t.GetSpeedModifier()) - .Product(); - return Info.Speed * modifier; - } - - public override IEnumerable OccupiedCells() - { - // Todo: do the right thing when landed - return new int2[] {}; - } - - public IEnumerable OccupiedAirCells() - { - return (fromCell == toCell) - ? new[] { fromCell } - : CanEnterCell(toCell) - ? new[] { toCell } - : new[] { fromCell, toCell }; - } - - int offsetTicks = 0; - public void Tick(Actor self) - { - var move = self.traits.Get(); - //if (unit.Altitude <= 0) - // return; - - if (move.Altitude < AirInfo.CruiseAltitude) - move.Altitude++; - - if (--offsetTicks <= 0) - { - self.CenterLocation += AirInfo.InstabilityMagnitude * self.World.SharedRandom.Gauss2D(5); - move.Altitude += (int)(AirInfo.InstabilityMagnitude * self.World.SharedRandom.Gauss1D(5)); - offsetTicks = AirInfo.InstabilityTicks; - } - } - } -} \ No newline at end of file diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index 1fc8833f45..66325cdd57 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -58,7 +58,6 @@ - diff --git a/mods/cnc/defaults.yaml b/mods/cnc/defaults.yaml index 25faf8730e..6834815c6b 100644 --- a/mods/cnc/defaults.yaml +++ b/mods/cnc/defaults.yaml @@ -51,12 +51,13 @@ TargetTypes: Air Selectable: Voice: VehicleVoice + Helicopter: + RepairBuildings: hpad + RearmBuildings: + LandWhenIdle: false HiddenUnderFog: GainsExperience: GivesExperience: - MobileAir: - TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River - TerrainSpeeds: 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100% DrawLineToTarget: ActorLostNotification: Notification: unitlost.aud diff --git a/mods/cnc/structures.yaml b/mods/cnc/structures.yaml index 48855d06a1..624454fbec 100644 --- a/mods/cnc/structures.yaml +++ b/mods/cnc/structures.yaml @@ -334,7 +334,7 @@ HPAD: RevealsShroud: Range: 5 Bib: - Production: + ProducesHelicopters: SpawnOffset: 0,-4 Produces: Plane BelowUnits: diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index c7a6eaa4d3..130855146a 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -47,7 +47,6 @@ World: # WaterPaletteRotation: BuildingInfluence: UnitInfluence: - AircraftInfluence: BridgeLayer: Bridges: bridge1, bridge2, bridge3, bridge4 PaletteFromCurrentTheatre: diff --git a/mods/cnc/vehicles.yaml b/mods/cnc/vehicles.yaml index 60c5940caf..ff7efb1b82 100644 --- a/mods/cnc/vehicles.yaml +++ b/mods/cnc/vehicles.yaml @@ -400,8 +400,8 @@ TRAN: Cost: 1500 Description: Chinook Transport LongDesc: Fast Infantry Transport Helicopter.\n Unarmed - MobileAir: - InitialFacing: 20 + Helicopter: + LandWhenIdle: true ROT: 5 Speed: 15 Health: @@ -428,8 +428,7 @@ HELI: Cost: 1200 Description: Apache Longbow LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry - MobileAir: - InitialFacing: 20 + Helicopter: ROT: 4 Speed: 20 Health: @@ -437,7 +436,7 @@ HELI: Armor: heavy RevealsShroud: Range: 8 - AttackBase: + AttackHeli: PrimaryWeapon: HighV SecondaryWeapon: HighV PrimaryOffset: -5,0,0,2 @@ -457,8 +456,7 @@ ORCA: Cost: 1200 Description: Orca LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry - MobileAir: - InitialFacing: 20 + Helicopter: ROT: 4 Speed: 20 Health: @@ -466,7 +464,7 @@ ORCA: Armor: heavy RevealsShroud: Range: 8 - AttackBase: + AttackHeli: PrimaryWeapon: Rockets.Orca SecondaryWeapon: Rockets.Orca PrimaryOffset: -5,0,0,2