diff --git a/OpenRA.Mods.D2k/AutoCarryall/AutoCarryall.cs b/OpenRA.Mods.D2k/AutoCarryall/AutoCarryall.cs index e01c3769f5..394296c425 100644 --- a/OpenRA.Mods.D2k/AutoCarryall/AutoCarryall.cs +++ b/OpenRA.Mods.D2k/AutoCarryall/AutoCarryall.cs @@ -151,6 +151,7 @@ namespace OpenRA.Mods.D2k // Create a new animation for our carryable unit anim = new Animation(self.World, RenderSprites.GetImage(carryable.Info), RenderSprites.MakeFacingFunc(self)); anim.PlayRepeating("idle"); + anim.IsDecoration = true; } // Called when released diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 6ee8043a70..eeaccf7bd5 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -460,6 +460,7 @@ + diff --git a/OpenRA.Mods.RA/Render/Hovers.cs b/OpenRA.Mods.RA/Render/Hovers.cs new file mode 100644 index 0000000000..357fa5e58e --- /dev/null +++ b/OpenRA.Mods.RA/Render/Hovers.cs @@ -0,0 +1,52 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 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 COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRA.Graphics; +using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Traits; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Render +{ + [Desc("Changes the visual Z position periodically.")] + class HoversInfo : ITraitInfo, Requires + { + [Desc("Amount of Z axis changes in world units.")] + public readonly int OffsetModifier = -43; + + public object Create(ActorInitializer init) { return new Hovers(this, init.self); } + } + + class Hovers : IRenderModifier + { + readonly HoversInfo info; + readonly bool aircraft; + + public Hovers(HoversInfo info, Actor self) + { + this.info = info; + aircraft = self.HasTrait(); + } + + public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) + { + if (self.World.Paused) + return r; + + var visualOffset = !aircraft || self.CenterPosition.Z > 0 ? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0; + var worldVisualOffset = new WVec(0, 0, info.OffsetModifier * visualOffset); + + return r.Select(a => a.OffsetBy(worldVisualOffset)); + } + } +} diff --git a/OpenRA.Mods.RA/Render/WithShadow.cs b/OpenRA.Mods.RA/Render/WithShadow.cs index 7a32064b1a..a48e655c6d 100644 --- a/OpenRA.Mods.RA/Render/WithShadow.cs +++ b/OpenRA.Mods.RA/Render/WithShadow.cs @@ -37,13 +37,6 @@ namespace OpenRA.Mods.RA.Render public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) { - var ios = self.Trait(); - - /* rude hack */ - var flying = ios.CenterPosition.Z > 0; - var visualOffset = (ios is Helicopter && flying) - ? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0; - // Contrails shouldn't cast shadows var shadowSprites = r.Where(s => !s.IsDecoration) .Select(a => a.WithPalette(wr.Palette(info.Palette)) @@ -51,11 +44,7 @@ namespace OpenRA.Mods.RA.Render .WithZOffset(a.ZOffset + a.Pos.Z) .AsDecoration()); - var worldVisualOffset = new WVec(0,0,-43*visualOffset); - var flyingSprites = !flying ? r : - r.Select(a => a.OffsetBy(worldVisualOffset)); - - return shadowSprites.Concat(flyingSprites); + return shadowSprites.Concat(r); } } } diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 5f149a947a..dec4cdf776 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -32,7 +32,6 @@ TRAN: WithRotor@SECONDARY: Id: rotor_2 Offset: 597,0,85 - WithShadow: Cargo: Types: Infantry MaxWeight: 10 @@ -87,7 +86,6 @@ HELI: WithRotor: Offset: 0,0,85 WithMuzzleFlash: - WithShadow: LeavesHusk: HuskActor: HELI.Husk AutoTarget: @@ -133,7 +131,6 @@ ORCA: Count: 2 Period: 100 RenderUnit: - WithShadow: LeavesHusk: HuskActor: ORCA.Husk AutoTarget: @@ -159,7 +156,6 @@ C17: Armor: Type: Heavy RenderUnit: - WithShadow: Cargo: MaxWeight: 10 PipCount: 10 @@ -198,7 +194,6 @@ A10: Armor: Type: Heavy RenderUnit: - WithShadow: AttackBomber: Armaments: gun, bombs Guns: gun @@ -240,7 +235,6 @@ TRAN.Husk: Offset: 597,0,85 RenderUnit: Image: tran - WithShadow: HELI.Husk: Inherits: ^HelicopterHusk @@ -255,7 +249,6 @@ HELI.Husk: Offset: 0,0,85 RenderUnit: Image: heli - WithShadow: ORCA.Husk: Inherits: ^HelicopterHusk @@ -268,5 +261,4 @@ ORCA.Husk: Range: 10c0 RenderUnit: Image: orca - WithShadow: diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index aa64d00a73..110051fe62 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -147,6 +147,8 @@ UpgradeTypes: selfheal UpgradeMinEnabledLevel: 1 UpgradeManager: + WithShadow: + Hovers: ^Infantry: AppearsOnRadar: @@ -338,6 +340,7 @@ UpgradeTypes: selfheal UpgradeMinEnabledLevel: 1 UpgradeManager: + WithShadow: ^Ship: AppearsOnRadar: diff --git a/mods/d2k/rules/aircraft.yaml b/mods/d2k/rules/aircraft.yaml index d0e0f3a433..6e281ba59b 100644 --- a/mods/d2k/rules/aircraft.yaml +++ b/mods/d2k/rules/aircraft.yaml @@ -4,7 +4,10 @@ Cost: 1200 Tooltip: Name: Carryall - Description: Fully automated Carryall.\n Automatically transports your harvesters. + Description: Large winged, planet-bound ship\n Automatically lifts harvesters. + Buildable: + Queue: Aircraft + BuildPaletteOrder: 10 Health: HP: 250 Armor: diff --git a/mods/d2k/rules/atreides.yaml b/mods/d2k/rules/atreides.yaml index ab8e0dbfa0..c551ef0371 100644 --- a/mods/d2k/rules/atreides.yaml +++ b/mods/d2k/rules/atreides.yaml @@ -123,9 +123,7 @@ CARRYALLA: RenderUnit: Image: CARRYALL Buildable: - Queue: Armor - Prerequisites: ~heavya, refinery, hightech - BuildPaletteOrder: 10 + Prerequisites: refinery, ~hightecha CARRYALLA.starport: Inherits: CARRYALLA diff --git a/mods/d2k/rules/harkonnen.yaml b/mods/d2k/rules/harkonnen.yaml index c3a359d195..2a66d72cd8 100644 --- a/mods/d2k/rules/harkonnen.yaml +++ b/mods/d2k/rules/harkonnen.yaml @@ -127,9 +127,7 @@ CARRYALLH: RenderUnit: Image: CARRYALL Buildable: - Queue: Armor - Prerequisites: ~heavyh, refinery, hightech - BuildPaletteOrder: 10 + Prerequisites: refinery, ~hightechh CARRYALLH.starport: Inherits: CARRYALLH diff --git a/mods/d2k/rules/ordos.yaml b/mods/d2k/rules/ordos.yaml index 2545190566..d5c95157aa 100644 --- a/mods/d2k/rules/ordos.yaml +++ b/mods/d2k/rules/ordos.yaml @@ -203,9 +203,7 @@ CARRYALLO: RenderUnit: Image: CARRYALL Buildable: - Queue: Armor - Prerequisites: ~heavyo, refinery, hightech - BuildPaletteOrder: 10 + Prerequisites: refinery, ~hightecho CARRYALLO.starport: Inherits: CARRYALLO diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 91a3ca9f29..1cd31969d9 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -601,6 +601,11 @@ WALL: Tooltip: Name: High Tech Facility Description: Unlocks advanced technology + Production: + Produces: Aircraft + Exit: + SpawnOffset: 0,0,728 + ExitCell: 0,0 Building: Footprint: _x_ xxx xxx Dimensions: 3,3 @@ -613,8 +618,8 @@ WALL: Range: 4c0 ProvidesCustomPrerequisite: Prerequisite: hightech -# WithProductionOverlay@WELDING: -# Sequence: production-welding + WithProductionOverlay@WELDING: + Sequence: production-welding Power: Amount: -40 diff --git a/mods/ra/rules/aircraft.yaml b/mods/ra/rules/aircraft.yaml index aa4d76f978..704beba94a 100644 --- a/mods/ra/rules/aircraft.yaml +++ b/mods/ra/rules/aircraft.yaml @@ -11,7 +11,6 @@ BADR: Speed: 149 Repulsable: False RenderUnit: - WithShadow: Cargo: MaxWeight: 10 -Selectable: @@ -51,7 +50,6 @@ BADR.Bomber: Ammo: 7 RenderUnit: Image: badr - WithShadow: -Selectable: -GainsExperience: Tooltip: @@ -108,7 +106,6 @@ MIG: EnableStances: false RenderUnit: CameraPitch: 99 - WithShadow: LimitedAmmo: Ammo: 8 ReturnOnIdle: @@ -165,7 +162,6 @@ YAK: EnableStances: false RenderUnit: CameraPitch: 99 - WithShadow: LimitedAmmo: Ammo: 18 PipCount: 6 @@ -215,7 +211,6 @@ TRAN: WithRotor@SECONDARY: Id: rotor_2 Offset: 597,0,213 - WithShadow: Cargo: Types: Infantry MaxWeight: 8 @@ -262,7 +257,6 @@ HELI: RenderUnit: WithRotor: Offset: 0,0,85 - WithShadow: LimitedAmmo: Ammo: 8 Selectable: @@ -313,7 +307,6 @@ HIND: EnableStances: false RenderUnit: WithRotor: - WithShadow: LimitedAmmo: Ammo: 24 PipCount: 6 @@ -337,7 +330,6 @@ U2: Speed: 373 Repulsable: False RenderUnit: - WithShadow: AttackBomber: -Selectable: -GainsExperience: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index c71ab69a48..8208eb26b3 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -341,6 +341,7 @@ UpgradeMaxAcceptedLevel: 2 TimedUpgradeBar: Upgrade: invulnerability + WithShadow: ^Helicopter: Inherits: ^Plane @@ -348,6 +349,7 @@ GenericName: Helicopter GpsDot: String: Helicopter + Hovers: ^Building: AppearsOnRadar: diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index 6e1a86e246..8f90e7bed3 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -67,6 +67,7 @@ DSHP: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: ORCA: Inherits: ^Helicopter @@ -105,6 +106,7 @@ ORCA: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: ORCAB: Inherits: ^Helicopter @@ -142,6 +144,7 @@ ORCAB: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: ORCATRAN: Inherits: ^Helicopter @@ -173,6 +176,7 @@ ORCATRAN: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: TRNSPORT: Inherits: ^Helicopter @@ -200,6 +204,7 @@ TRNSPORT: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: SCRIN: Inherits: ^Helicopter @@ -277,4 +282,5 @@ APACHE: RenderSprites: RenderVoxels: WithVoxelBody: + Hovers: diff --git a/mods/ts/rules/vehicles.yaml b/mods/ts/rules/vehicles.yaml index e40f326ec0..9fd5e53224 100644 --- a/mods/ts/rules/vehicles.yaml +++ b/mods/ts/rules/vehicles.yaml @@ -156,6 +156,7 @@ HVR: RenderVoxels: WithVoxelBody: WithVoxelTurret: + Hovers: 4TNK: Inherits: ^Tank