diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index e628356864..cfaba5d447 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -114,11 +114,6 @@ namespace OpenRA.Mods.RA Location = cell; CenterPosition = cell.CenterPosition; - var seq = self.World.GetTerrainInfo(cell).IsWater ? "water" : "land"; - var rs = self.Trait(); - if (seq != rs.anim.CurrentSequence.Name) - rs.anim.PlayRepeating(seq); - if (self.IsInWorld) { self.World.ActorMap.AddInfluence(self, this); diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 980c6a412b..0e28d6d8a2 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -483,6 +483,7 @@ + diff --git a/OpenRA.Mods.RA/Render/WithCrateBody.cs b/OpenRA.Mods.RA/Render/WithCrateBody.cs new file mode 100755 index 0000000000..662fdc46c1 --- /dev/null +++ b/OpenRA.Mods.RA/Render/WithCrateBody.cs @@ -0,0 +1,47 @@ +#region Copyright & License Information +/* + * Copyright 2007-2013 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.Linq; +using OpenRA.Graphics; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Render +{ + class WithCrateBodyInfo : ITraitInfo, Requires + { + public readonly string[] Images = { "crate" }; + public readonly string[] XmasImages = { }; + + public object Create(ActorInitializer init) { return new WithCrateBody(init.self, this); } + } + + class WithCrateBody : INotifyParachuteLanded + { + Actor self; + Animation anim; + + public WithCrateBody(Actor self, WithCrateBodyInfo info) + { + this.self = self; + var rs = self.Trait(); + var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : info.Images; + anim = new Animation(images.Random(Game.CosmeticRandom)); + anim.Play("idle"); + rs.anims.Add("", anim); + } + + public void OnLanded() + { + var seq = self.World.GetTerrainInfo(self.Location).IsWater ? "water" : "land"; + anim.PlayRepeating(seq); + } + } +} diff --git a/mods/cnc/bits/xcrate.shp b/mods/cnc/bits/xcrate.shp new file mode 100644 index 0000000000..5e1e1422fd Binary files /dev/null and b/mods/cnc/bits/xcrate.shp differ diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 0f9110f9ac..bed2ed3d04 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -406,7 +406,9 @@ CRATE: SelectionShares: 0 NoBaseSelectionShares: 120 Unit: mcv - RenderSimple: + RenderSprites: + WithCrateBody: + XmasImages: xcratea, xcrateb, xcratec, xcrated BodyOrientation: mpspawn: diff --git a/mods/cnc/sequences/misc.yaml b/mods/cnc/sequences/misc.yaml index 809742e8d5..3821bfacd9 100644 --- a/mods/cnc/sequences/misc.yaml +++ b/mods/cnc/sequences/misc.yaml @@ -170,6 +170,38 @@ crate: Start: 0 ZOffset: -511 +xcratea: + idle: xcrate + Start: 0 + ZOffset: -511 + land: xcrate + Start: 0 + ZOffset: -511 + +xcrateb: + idle: xcrate + Start: 1 + ZOffset: -511 + land: xcrate + Start: 1 + ZOffset: -511 + +xcratec: + idle: xcrate + Start: 2 + ZOffset: -511 + land: xcrate + Start: 2 + ZOffset: -511 + +xcrated: + idle: xcrate + Start: 3 + ZOffset: -511 + land: xcrate + Start: 3 + ZOffset: -511 + crate-effects: airstrike: deviator Start: 0 diff --git a/mods/d2k/rules/system.yaml b/mods/d2k/rules/system.yaml index a9fc3dd967..47ed6ec808 100644 --- a/mods/d2k/rules/system.yaml +++ b/mods/d2k/rules/system.yaml @@ -561,7 +561,8 @@ CRATE: SelectionShares: 0 NoBaseSelectionShares: 9001 Unit: mcvo - RenderSimple: + RenderSprites: + WithCrateBody: ProximityCaptor: Types:Crate Passenger: diff --git a/mods/ra/bits/xcratea.shp b/mods/ra/bits/xcratea.shp new file mode 100644 index 0000000000..1086806511 Binary files /dev/null and b/mods/ra/bits/xcratea.shp differ diff --git a/mods/ra/bits/xcrateb.shp b/mods/ra/bits/xcrateb.shp new file mode 100644 index 0000000000..3edd4fce7f Binary files /dev/null and b/mods/ra/bits/xcrateb.shp differ diff --git a/mods/ra/bits/xcratec.shp b/mods/ra/bits/xcratec.shp new file mode 100644 index 0000000000..c83d6e6249 Binary files /dev/null and b/mods/ra/bits/xcratec.shp differ diff --git a/mods/ra/bits/xcrated.shp b/mods/ra/bits/xcrated.shp new file mode 100644 index 0000000000..131725ecd3 Binary files /dev/null and b/mods/ra/bits/xcrated.shp differ diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index d45c03dd77..829c741e2b 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -808,7 +808,9 @@ CRATE: GiveUnitCrateAction@4tnk: SelectionShares: 3 Unit: 4tnk - RenderSimple: + RenderSprites: + WithCrateBody: + XmasImages: xcratea, xcrateb, xcratec, xcrated ProximityCaptor: Types:Crate Passenger: diff --git a/mods/ra/sequences/misc.yaml b/mods/ra/sequences/misc.yaml index e1255f9ac6..2ebc09f4b3 100644 --- a/mods/ra/sequences/misc.yaml +++ b/mods/ra/sequences/misc.yaml @@ -232,6 +232,58 @@ crate: Start: 0 ZOffset: -511 +xcratea: + idle: + Start: 0 + ZOffset: -511 + land: + Start: 1 + ZOffset: -511 + water: + Start: 2 + Length: 4 + Tick: 500 + ZOffset: -511 + +xcrateb: + idle: + Start: 0 + ZOffset: -511 + land: + Start: 1 + ZOffset: -511 + water: + Start: 2 + Length: 4 + Tick: 500 + ZOffset: -511 + +xcratec: + idle: + Start: 0 + ZOffset: -511 + land: + Start: 1 + ZOffset: -511 + water: + Start: 2 + Length: 4 + Tick: 500 + ZOffset: -511 + +xcrated: + idle: + Start: 0 + ZOffset: -511 + land: + Start: 1 + ZOffset: -511 + water: + Start: 2 + Length: 4 + Tick: 500 + ZOffset: -511 + crate-effects: speed: speed Start: 0