Merge pull request #7033 from Mailaender/d2k-carryall-tweaks

Tweaked spice harvester carryalls
This commit is contained in:
Paul Chote
2014-12-07 11:09:55 +13:00
15 changed files with 81 additions and 40 deletions

View File

@@ -151,6 +151,7 @@ namespace OpenRA.Mods.D2k
// Create a new animation for our carryable unit // Create a new animation for our carryable unit
anim = new Animation(self.World, RenderSprites.GetImage(carryable.Info), RenderSprites.MakeFacingFunc(self)); anim = new Animation(self.World, RenderSprites.GetImage(carryable.Info), RenderSprites.MakeFacingFunc(self));
anim.PlayRepeating("idle"); anim.PlayRepeating("idle");
anim.IsDecoration = true;
} }
// Called when released // Called when released

View File

@@ -460,6 +460,7 @@
<Compile Include="UtilityCommands\Extensions.cs" /> <Compile Include="UtilityCommands\Extensions.cs" />
<Compile Include="Lint\CheckMapRules.cs" /> <Compile Include="Lint\CheckMapRules.cs" />
<Compile Include="Activities\Air\HeliFlyCircle.cs" /> <Compile Include="Activities\Air\HeliFlyCircle.cs" />
<Compile Include="Render\Hovers.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj"> <ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">

View File

@@ -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<IMoveInfo>
{
[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<Aircraft>();
}
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> 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));
}
}
}

View File

@@ -37,13 +37,6 @@ namespace OpenRA.Mods.RA.Render
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r) public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{ {
var ios = self.Trait<IOccupySpace>();
/* 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 // Contrails shouldn't cast shadows
var shadowSprites = r.Where(s => !s.IsDecoration) var shadowSprites = r.Where(s => !s.IsDecoration)
.Select(a => a.WithPalette(wr.Palette(info.Palette)) .Select(a => a.WithPalette(wr.Palette(info.Palette))
@@ -51,11 +44,7 @@ namespace OpenRA.Mods.RA.Render
.WithZOffset(a.ZOffset + a.Pos.Z) .WithZOffset(a.ZOffset + a.Pos.Z)
.AsDecoration()); .AsDecoration());
var worldVisualOffset = new WVec(0,0,-43*visualOffset); return shadowSprites.Concat(r);
var flyingSprites = !flying ? r :
r.Select(a => a.OffsetBy(worldVisualOffset));
return shadowSprites.Concat(flyingSprites);
} }
} }
} }

View File

@@ -32,7 +32,6 @@ TRAN:
WithRotor@SECONDARY: WithRotor@SECONDARY:
Id: rotor_2 Id: rotor_2
Offset: 597,0,85 Offset: 597,0,85
WithShadow:
Cargo: Cargo:
Types: Infantry Types: Infantry
MaxWeight: 10 MaxWeight: 10
@@ -87,7 +86,6 @@ HELI:
WithRotor: WithRotor:
Offset: 0,0,85 Offset: 0,0,85
WithMuzzleFlash: WithMuzzleFlash:
WithShadow:
LeavesHusk: LeavesHusk:
HuskActor: HELI.Husk HuskActor: HELI.Husk
AutoTarget: AutoTarget:
@@ -133,7 +131,6 @@ ORCA:
Count: 2 Count: 2
Period: 100 Period: 100
RenderUnit: RenderUnit:
WithShadow:
LeavesHusk: LeavesHusk:
HuskActor: ORCA.Husk HuskActor: ORCA.Husk
AutoTarget: AutoTarget:
@@ -159,7 +156,6 @@ C17:
Armor: Armor:
Type: Heavy Type: Heavy
RenderUnit: RenderUnit:
WithShadow:
Cargo: Cargo:
MaxWeight: 10 MaxWeight: 10
PipCount: 10 PipCount: 10
@@ -198,7 +194,6 @@ A10:
Armor: Armor:
Type: Heavy Type: Heavy
RenderUnit: RenderUnit:
WithShadow:
AttackBomber: AttackBomber:
Armaments: gun, bombs Armaments: gun, bombs
Guns: gun Guns: gun
@@ -240,7 +235,6 @@ TRAN.Husk:
Offset: 597,0,85 Offset: 597,0,85
RenderUnit: RenderUnit:
Image: tran Image: tran
WithShadow:
HELI.Husk: HELI.Husk:
Inherits: ^HelicopterHusk Inherits: ^HelicopterHusk
@@ -255,7 +249,6 @@ HELI.Husk:
Offset: 0,0,85 Offset: 0,0,85
RenderUnit: RenderUnit:
Image: heli Image: heli
WithShadow:
ORCA.Husk: ORCA.Husk:
Inherits: ^HelicopterHusk Inherits: ^HelicopterHusk
@@ -268,5 +261,4 @@ ORCA.Husk:
Range: 10c0 Range: 10c0
RenderUnit: RenderUnit:
Image: orca Image: orca
WithShadow:

View File

@@ -147,6 +147,8 @@
UpgradeTypes: selfheal UpgradeTypes: selfheal
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
UpgradeManager: UpgradeManager:
WithShadow:
Hovers:
^Infantry: ^Infantry:
AppearsOnRadar: AppearsOnRadar:
@@ -338,6 +340,7 @@
UpgradeTypes: selfheal UpgradeTypes: selfheal
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
UpgradeManager: UpgradeManager:
WithShadow:
^Ship: ^Ship:
AppearsOnRadar: AppearsOnRadar:

View File

@@ -4,7 +4,10 @@
Cost: 1200 Cost: 1200
Tooltip: Tooltip:
Name: Carryall 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: Health:
HP: 250 HP: 250
Armor: Armor:

View File

@@ -123,9 +123,7 @@ CARRYALLA:
RenderUnit: RenderUnit:
Image: CARRYALL Image: CARRYALL
Buildable: Buildable:
Queue: Armor Prerequisites: refinery, ~hightecha
Prerequisites: ~heavya, refinery, hightech
BuildPaletteOrder: 10
CARRYALLA.starport: CARRYALLA.starport:
Inherits: CARRYALLA Inherits: CARRYALLA

View File

@@ -127,9 +127,7 @@ CARRYALLH:
RenderUnit: RenderUnit:
Image: CARRYALL Image: CARRYALL
Buildable: Buildable:
Queue: Armor Prerequisites: refinery, ~hightechh
Prerequisites: ~heavyh, refinery, hightech
BuildPaletteOrder: 10
CARRYALLH.starport: CARRYALLH.starport:
Inherits: CARRYALLH Inherits: CARRYALLH

View File

@@ -203,9 +203,7 @@ CARRYALLO:
RenderUnit: RenderUnit:
Image: CARRYALL Image: CARRYALL
Buildable: Buildable:
Queue: Armor Prerequisites: refinery, ~hightecho
Prerequisites: ~heavyo, refinery, hightech
BuildPaletteOrder: 10
CARRYALLO.starport: CARRYALLO.starport:
Inherits: CARRYALLO Inherits: CARRYALLO

View File

@@ -601,6 +601,11 @@ WALL:
Tooltip: Tooltip:
Name: High Tech Facility Name: High Tech Facility
Description: Unlocks advanced technology Description: Unlocks advanced technology
Production:
Produces: Aircraft
Exit:
SpawnOffset: 0,0,728
ExitCell: 0,0
Building: Building:
Footprint: _x_ xxx xxx Footprint: _x_ xxx xxx
Dimensions: 3,3 Dimensions: 3,3
@@ -613,8 +618,8 @@ WALL:
Range: 4c0 Range: 4c0
ProvidesCustomPrerequisite: ProvidesCustomPrerequisite:
Prerequisite: hightech Prerequisite: hightech
# WithProductionOverlay@WELDING: WithProductionOverlay@WELDING:
# Sequence: production-welding Sequence: production-welding
Power: Power:
Amount: -40 Amount: -40

View File

@@ -11,7 +11,6 @@ BADR:
Speed: 149 Speed: 149
Repulsable: False Repulsable: False
RenderUnit: RenderUnit:
WithShadow:
Cargo: Cargo:
MaxWeight: 10 MaxWeight: 10
-Selectable: -Selectable:
@@ -51,7 +50,6 @@ BADR.Bomber:
Ammo: 7 Ammo: 7
RenderUnit: RenderUnit:
Image: badr Image: badr
WithShadow:
-Selectable: -Selectable:
-GainsExperience: -GainsExperience:
Tooltip: Tooltip:
@@ -108,7 +106,6 @@ MIG:
EnableStances: false EnableStances: false
RenderUnit: RenderUnit:
CameraPitch: 99 CameraPitch: 99
WithShadow:
LimitedAmmo: LimitedAmmo:
Ammo: 8 Ammo: 8
ReturnOnIdle: ReturnOnIdle:
@@ -165,7 +162,6 @@ YAK:
EnableStances: false EnableStances: false
RenderUnit: RenderUnit:
CameraPitch: 99 CameraPitch: 99
WithShadow:
LimitedAmmo: LimitedAmmo:
Ammo: 18 Ammo: 18
PipCount: 6 PipCount: 6
@@ -215,7 +211,6 @@ TRAN:
WithRotor@SECONDARY: WithRotor@SECONDARY:
Id: rotor_2 Id: rotor_2
Offset: 597,0,213 Offset: 597,0,213
WithShadow:
Cargo: Cargo:
Types: Infantry Types: Infantry
MaxWeight: 8 MaxWeight: 8
@@ -262,7 +257,6 @@ HELI:
RenderUnit: RenderUnit:
WithRotor: WithRotor:
Offset: 0,0,85 Offset: 0,0,85
WithShadow:
LimitedAmmo: LimitedAmmo:
Ammo: 8 Ammo: 8
Selectable: Selectable:
@@ -313,7 +307,6 @@ HIND:
EnableStances: false EnableStances: false
RenderUnit: RenderUnit:
WithRotor: WithRotor:
WithShadow:
LimitedAmmo: LimitedAmmo:
Ammo: 24 Ammo: 24
PipCount: 6 PipCount: 6
@@ -337,7 +330,6 @@ U2:
Speed: 373 Speed: 373
Repulsable: False Repulsable: False
RenderUnit: RenderUnit:
WithShadow:
AttackBomber: AttackBomber:
-Selectable: -Selectable:
-GainsExperience: -GainsExperience:

View File

@@ -341,6 +341,7 @@
UpgradeMaxAcceptedLevel: 2 UpgradeMaxAcceptedLevel: 2
TimedUpgradeBar: TimedUpgradeBar:
Upgrade: invulnerability Upgrade: invulnerability
WithShadow:
^Helicopter: ^Helicopter:
Inherits: ^Plane Inherits: ^Plane
@@ -348,6 +349,7 @@
GenericName: Helicopter GenericName: Helicopter
GpsDot: GpsDot:
String: Helicopter String: Helicopter
Hovers:
^Building: ^Building:
AppearsOnRadar: AppearsOnRadar:

View File

@@ -67,6 +67,7 @@ DSHP:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:
ORCA: ORCA:
Inherits: ^Helicopter Inherits: ^Helicopter
@@ -105,6 +106,7 @@ ORCA:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:
ORCAB: ORCAB:
Inherits: ^Helicopter Inherits: ^Helicopter
@@ -142,6 +144,7 @@ ORCAB:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:
ORCATRAN: ORCATRAN:
Inherits: ^Helicopter Inherits: ^Helicopter
@@ -173,6 +176,7 @@ ORCATRAN:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:
TRNSPORT: TRNSPORT:
Inherits: ^Helicopter Inherits: ^Helicopter
@@ -200,6 +204,7 @@ TRNSPORT:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:
SCRIN: SCRIN:
Inherits: ^Helicopter Inherits: ^Helicopter
@@ -277,4 +282,5 @@ APACHE:
RenderSprites: RenderSprites:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
Hovers:

View File

@@ -156,6 +156,7 @@ HVR:
RenderVoxels: RenderVoxels:
WithVoxelBody: WithVoxelBody:
WithVoxelTurret: WithVoxelTurret:
Hovers:
4TNK: 4TNK:
Inherits: ^Tank Inherits: ^Tank