From 52e265557c56d4a0b3c546e8221e8814dd2441bd Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 27 Nov 2010 15:50:46 +1300 Subject: [PATCH] Oil Derricks spurt fire when dead. --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 1 + OpenRA.Mods.Cnc/WithFire.cs | 33 ++++++++++++++++++++++++++ OpenRA.Mods.RA/LeavesHusk.cs | 13 ++++++---- mods/cnc/rules/tech.yaml | 15 ++++++++++++ mods/cnc/sequences/map.yaml | 9 +++++++ 5 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 OpenRA.Mods.Cnc/WithFire.cs diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index cf36dab275..0807395528 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -65,6 +65,7 @@ + diff --git a/OpenRA.Mods.Cnc/WithFire.cs b/OpenRA.Mods.Cnc/WithFire.cs new file mode 100644 index 0000000000..d996f33662 --- /dev/null +++ b/OpenRA.Mods.Cnc/WithFire.cs @@ -0,0 +1,33 @@ +#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; +using OpenRA.Traits; +using OpenRA.Graphics; + +namespace OpenRA.Mods.Cnc +{ + class WithFireInfo : ITraitInfo + { + public object Create(ActorInitializer init) { return new WithFire(init.self); } + } + + class WithFire + { + public WithFire(Actor self) + { + var rs = self.Trait(); + var roof = new Animation(rs.GetImage(self)); + roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop")); + rs.anims.Add( "fire", new RenderSimple.AnimationWithOffset( roof, () => new float2(7,-15), null ) { ZOffset = 24 } ); + } + } +} diff --git a/OpenRA.Mods.RA/LeavesHusk.cs b/OpenRA.Mods.RA/LeavesHusk.cs index 3c286aca65..b5b3598b3a 100644 --- a/OpenRA.Mods.RA/LeavesHusk.cs +++ b/OpenRA.Mods.RA/LeavesHusk.cs @@ -27,14 +27,17 @@ namespace OpenRA.Mods.RA self.World.AddFrameEndTask(w => { var info = self.Info.Traits.Get(); - - var husk = w.CreateActor(info.HuskActor, new TypeDictionary + var td = new TypeDictionary { new LocationInit( self.Location ), new OwnerInit( self.Owner ), - new FacingInit( self.Trait().Facing ), - }); - + new SkipMakeAnimsInit() + }; + + if (self.HasTrait()) + td.Add(new FacingInit( self.Trait().Facing )); + + var husk = w.CreateActor(info.HuskActor, td); var turreted = self.TraitOrDefault(); if (turreted != null) foreach (var p in husk.TraitsImplementing()) diff --git a/mods/cnc/rules/tech.yaml b/mods/cnc/rules/tech.yaml index 4168196ae0..46cc12fb79 100644 --- a/mods/cnc/rules/tech.yaml +++ b/mods/cnc/rules/tech.yaml @@ -2,6 +2,21 @@ V19: Inherits: ^CivBuilding RenderBuilding: + Building: + Footprint: x + Dimensions: 1,1 + -DeadBuildingState: + Tooltip: + Name: Oil Derrick + LeavesHusk: + HuskActor: V19.Husk + +V19.Husk: + Inherits: ^CivBuilding + -DeadBuildingState: + -Health: + RenderBuilding: + WithFire: Building: Footprint: x Dimensions: 1,1 diff --git a/mods/cnc/sequences/map.yaml b/mods/cnc/sequences/map.yaml index 1d8636a5dc..db28f28f96 100644 --- a/mods/cnc/sequences/map.yaml +++ b/mods/cnc/sequences/map.yaml @@ -495,6 +495,15 @@ v19: dead: Start: 28 +v19.husk: + idle: v19 + Start: 28 + fire-start: flmspt + Start: 0 + Length: * + fire-loop: flmspt + Start: 50 + Length: * arco: idle: Start: 0