diff --git a/OpenRA.FileFormats/Map/Walkability.cs b/OpenRA.FileFormats/Map/Walkability.cs index 4e9c1f71c2..832c374cf3 100644 --- a/OpenRA.FileFormats/Map/Walkability.cs +++ b/OpenRA.FileFormats/Map/Walkability.cs @@ -18,9 +18,10 @@ */ #endregion +using System; using System.Collections.Generic; using System.Linq; -using System; + namespace OpenRA.FileFormats { public enum TerrainType : byte diff --git a/OpenRA.Game/Traits/Render/RenderUnit.cs b/OpenRA.Game/Traits/Render/RenderUnit.cs index ebbdd89a16..f4c9c23b3a 100644 --- a/OpenRA.Game/Traits/Render/RenderUnit.cs +++ b/OpenRA.Game/Traits/Render/RenderUnit.cs @@ -23,7 +23,7 @@ using OpenRA.Graphics; namespace OpenRA.Traits { - class RenderUnitInfo : RenderSimpleInfo + public class RenderUnitInfo : RenderSimpleInfo { public override object Create(Actor self) { return new RenderUnit(self); } } diff --git a/OpenRA.Game/Traits/Unit.cs b/OpenRA.Game/Traits/Unit.cs index 0c948fdf53..7da4a09529 100755 --- a/OpenRA.Game/Traits/Unit.cs +++ b/OpenRA.Game/Traits/Unit.cs @@ -20,7 +20,7 @@ namespace OpenRA.Traits { - class UnitInfo : OwnedActorInfo, ITraitInfo + public class UnitInfo : OwnedActorInfo, ITraitInfo { public readonly int InitialFacing = 128; public readonly int ROT = 255; diff --git a/OpenRA.Mods.RA/LeavesHusk.cs b/OpenRA.Mods.RA/LeavesHusk.cs new file mode 100644 index 0000000000..e249e9d93d --- /dev/null +++ b/OpenRA.Mods.RA/LeavesHusk.cs @@ -0,0 +1,42 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + class LeavesHuskInfo : TraitInfo { public readonly string HuskActor = null; } + + class LeavesHusk : INotifyDamage + { + public void Damaged(Actor self, AttackInfo e) + { + if (e.DamageState == DamageState.Dead) + self.World.AddFrameEndTask(w => + { + var info = self.Info.Traits.Get(); + var husk = w.CreateActor(info.HuskActor, self.Location, self.Owner); + husk.CenterLocation = self.CenterLocation; + husk.traits.Get().Altitude = self.traits.Get().Altitude; + husk.traits.Get().Facing = self.traits.Get().Facing; + }); + } + } +} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 6789361c26..89e63b3087 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -62,6 +62,7 @@ + @@ -94,6 +95,7 @@ + diff --git a/OpenRA.Mods.RA/ThrowsParticles.cs b/OpenRA.Mods.RA/ThrowsParticles.cs new file mode 100644 index 0000000000..5ec4fbc584 --- /dev/null +++ b/OpenRA.Mods.RA/ThrowsParticles.cs @@ -0,0 +1,76 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using OpenRA.Traits; +using OpenRA.Graphics; + +namespace OpenRA.Mods.RA +{ + class ThrowsParticleInfo : ITraitInfo + { + public readonly string Anim = null; + public readonly int[] Offset = new[] { 0, 0, 0, 0 }; + public readonly int[] Spread = new[] { 0, 0 }; + public readonly float Speed = 20; + public readonly string AnimKey = null; + public object Create(Actor self) { return new ThrowsParticle(self, this); } + } + + class ThrowsParticle : ITick + { + ThrowsParticleInfo info; + float2 pos; + float alt; + + float2 v; + float va; + + const float gravity = 1.3f; + + public ThrowsParticle(Actor self, ThrowsParticleInfo info) { this.info = info; } + + public void Tick(Actor self) + { + if (info != null) + { + alt = 0; + pos = Util.GetTurretPosition(self, self.traits.Get(), info.Offset, 0); + var ru = self.traits.Get(); + + v = Game.CosmeticRandom.Gauss2D(1) * info.Spread.RelOffset(); + va = info.Speed; + + var anim = new Animation(ru.GetImage(self), () => self.traits.Get().Facing); + anim.PlayRepeating(info.Anim); + + ru.anims.Add(info.AnimKey, new RenderSimple.AnimationWithOffset( + anim, () => pos - new float2(0, alt), null)); + + info = null; + } + + pos += v; + v = .9f * v; + va -= gravity; + alt += va; + if (alt < 0) alt = 0; + } + } +} diff --git a/mods/ra/system.yaml b/mods/ra/system.yaml index 1ab871d9f6..463a5e648c 100644 --- a/mods/ra/system.yaml +++ b/mods/ra/system.yaml @@ -1,6 +1,6 @@ Player: ProductionQueue: - BuildSpeed: .4 + BuildSpeed: .04 LowPowerSlowdown: 3 PlaceBuilding: GpsPower: diff --git a/mods/ra/vehicles.yaml b/mods/ra/vehicles.yaml index c8f8d3d563..57f6a94ab9 100644 --- a/mods/ra/vehicles.yaml +++ b/mods/ra/vehicles.yaml @@ -82,6 +82,8 @@ V2RL: Recoil: 2 RenderUnitTurreted: AutoTarget: + LeavesHusk: + HuskActor: 1TNK.Husk 2TNK: Inherits: ^Vehicle @@ -107,6 +109,8 @@ V2RL: Recoil: 3 RenderUnitTurreted: AutoTarget: + LeavesHusk: + HuskActor: 2TNK.Husk 3TNK: Inherits: ^Vehicle @@ -132,6 +136,8 @@ V2RL: Recoil: 3 RenderUnitTurreted: AutoTarget: + LeavesHusk: + HuskActor: 3TNK.Husk 4TNK: Inherits: ^Vehicle @@ -160,6 +166,8 @@ V2RL: Recoil: 4 RenderUnitTurreted: AutoTarget: + LeavesHusk: + HuskActor: 4TNK.Husk ARTY: Inherits: ^Vehicle @@ -645,3 +653,75 @@ U2: WithShadow: IronCurtainable: -Selectable: + +1TNK.Husk: + Inherits: ^Vehicle + Valued: + Description: Husk (Light Tank) + Unit: + HP: 80 + Armor: heavy + ROT: 0 + RenderUnit: + Image: 1tnk + Selectable: + Priority: -1 + ThrowsParticle@turret: + Anim: turret + Spread: 3,3 + Speed: 6 + AnimKey: turret + +2TNK.Husk: + Inherits: ^Vehicle + Valued: + Description: Husk (Medium Tank) + Unit: + HP: 80 + Armor: heavy + ROT: 0 + RenderUnit: + Image: 2tnk + Selectable: + Priority: -1 + ThrowsParticle@turret: + Anim: turret + Spread: 3,3 + Speed: 6 + AnimKey: turret + +3TNK.Husk: + Inherits: ^Vehicle + Valued: + Description: Husk (Heavy Tank) + Unit: + HP: 80 + Armor: heavy + ROT: 0 + RenderUnit: + Image: 3tnk + Selectable: + Priority: -1 + ThrowsParticle@turret: + Anim: turret + Spread: 3,3 + Speed: 6 + AnimKey: turret + +4TNK.Husk: + Inherits: ^Vehicle + Valued: + Description: Husk (Mammoth Tank) + Unit: + HP: 80 + Armor: heavy + ROT: 0 + RenderUnit: + Image: 4tnk + Selectable: + Priority: -1 + ThrowsParticle@turret: + Anim: turret + Spread: 3,3 + Speed: 6 + AnimKey: turret \ No newline at end of file