merge ParachuteAttachment and Parachutable

This commit is contained in:
Matthias Mailänder
2014-06-22 14:49:00 +02:00
parent e04ff18060
commit ff1be8daea
6 changed files with 22 additions and 29 deletions

View File

@@ -28,12 +28,13 @@ namespace OpenRA.Mods.RA.Effects
{ {
this.cargo = cargo; this.cargo = cargo;
var pai = cargo.Info.Traits.GetOrDefault<ParachuteAttachmentInfo>(); var parachutableInfo = cargo.Info.Traits.GetOrDefault<ParachutableInfo>();
paraAnim = new Animation(cargo.World, pai != null ? pai.ParachuteSprite : "parach"); var sprite = parachutableInfo != null ? parachutableInfo.ParachuteSprite : "parach";
paraAnim = new Animation(cargo.World, sprite);
paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));
if (pai != null) if (parachutableInfo != null)
parachuteOffset = pai.Offset; parachuteOffset = parachutableInfo.ParachuteOffset;
// Adjust x,y to match the target subcell // Adjust x,y to match the target subcell
cargo.Trait<IPositionable>().SetPosition(cargo, cargo.World.Map.CellContaining(dropPosition)); cargo.Trait<IPositionable>().SetPosition(cargo, cargo.World.Map.CellContaining(dropPosition));

View File

@@ -279,7 +279,6 @@
<Compile Include="PaletteFromFile.cs" /> <Compile Include="PaletteFromFile.cs" />
<Compile Include="PaletteFromRGBA.cs" /> <Compile Include="PaletteFromRGBA.cs" />
<Compile Include="ParaDrop.cs" /> <Compile Include="ParaDrop.cs" />
<Compile Include="ParachuteAttachment.cs" />
<Compile Include="Passenger.cs" /> <Compile Include="Passenger.cs" />
<Compile Include="Player\PlayerStatistics.cs" /> <Compile Include="Player\PlayerStatistics.cs" />
<Compile Include="Player\ActorGroupProxy.cs" /> <Compile Include="Player\ActorGroupProxy.cs" />

View File

@@ -26,6 +26,9 @@ namespace OpenRA.Mods.RA
public readonly string WaterCorpseSequence = "small_splash"; public readonly string WaterCorpseSequence = "small_splash";
public readonly string WaterCorpsePalette = "effect"; public readonly string WaterCorpsePalette = "effect";
public readonly string ParachuteSprite = "parach";
public readonly WVec ParachuteOffset = WVec.Zero;
public object Create(ActorInitializer init) { return new Parachutable(init, this); } public object Create(ActorInitializer init) { return new Parachutable(init, this); }
} }

View File

@@ -1,22 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 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 OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class ParachuteAttachmentInfo : TraitInfo<ParachuteAttachment>
{
public readonly string ParachuteSprite = "parach";
public readonly WVec Offset = WVec.Zero;
}
class ParachuteAttachment {}
}

View File

@@ -252,6 +252,19 @@ namespace OpenRA.Utility
node.Key = "StoresResources"; node.Key = "StoresResources";
} }
// ParachuteAttachment was merged into Parachutable
if (engineVersion < 20140701)
{
if (depth == 1 && node.Key == "ParachuteAttachment")
{
node.Key = "Parachutable";
foreach (var subnode in node.Value.Nodes)
if (subnode.Key == "Offset")
subnode.Key = "ParachuteOffset";
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -151,8 +151,6 @@
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String: Infantry String: Infantry
ParachuteAttachment:
Offset: 0,0,427
CrushableInfantry: CrushableInfantry:
CrushSound: squishy2.aud CrushSound: squishy2.aud
UpdatesPlayerStatistics: UpdatesPlayerStatistics:
@@ -178,6 +176,7 @@
DeathSound: Zapped DeathSound: Zapped
InfDeaths: 6 InfDeaths: 6
Parachutable: Parachutable:
ParachuteOffset: 0,0,427
^Ship: ^Ship:
AppearsOnRadar: AppearsOnRadar: