From eefd7dba2cca4fcab5b16c922d05e5d45decd851 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 14 Dec 2014 10:56:35 +1300 Subject: [PATCH] Fix some minor style issues in Attack*. --- OpenRA.Mods.RA/Attack/AttackBase.cs | 11 ++++++----- OpenRA.Mods.RA/Attack/AttackGarrisoned.cs | 13 ++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenRA.Mods.RA/Attack/AttackBase.cs b/OpenRA.Mods.RA/Attack/AttackBase.cs index a1bf0f5abe..a948404b8c 100644 --- a/OpenRA.Mods.RA/Attack/AttackBase.cs +++ b/OpenRA.Mods.RA/Attack/AttackBase.cs @@ -35,14 +35,15 @@ namespace OpenRA.Mods.RA public abstract class AttackBase : IIssueOrder, IResolveOrder, IOrderVoice, ISync { [Sync] public bool IsAttacking { get; internal set; } - public IEnumerable Armaments { get { return GetArmaments(); } } + public IEnumerable Armaments { get { return getArmaments(); } } + public readonly AttackBaseInfo Info; + protected Lazy facing; protected Lazy building; - protected Lazy positionable; - protected Func> GetArmaments; + protected Lazy positionable; + protected Func> getArmaments; readonly Actor self; - public readonly AttackBaseInfo Info; public AttackBase(Actor self, AttackBaseInfo info) { @@ -52,7 +53,7 @@ namespace OpenRA.Mods.RA var armaments = Exts.Lazy(() => self.TraitsImplementing() .Where(a => info.Armaments.Contains(a.Info.Name))); - GetArmaments = () => armaments.Value; + getArmaments = () => armaments.Value; facing = Exts.Lazy(() => self.TraitOrDefault()); building = Exts.Lazy(() => self.TraitOrDefault()); diff --git a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs index e1c25ee926..3d7a701a34 100644 --- a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs @@ -29,13 +29,13 @@ namespace OpenRA.Mods.RA public class AttackGarrisonedInfo : AttackFollowInfo, Requires { [Desc("Fire port offsets in local coordinates.")] - public readonly WVec[] PortOffsets = {}; + public readonly WVec[] PortOffsets = { }; [Desc("Fire port yaw angles.")] - public readonly WAngle[] PortYaws = {}; + public readonly WAngle[] PortYaws = { }; [Desc("Fire port yaw cone angle.")] - public readonly WAngle[] PortCones = {}; + public readonly WAngle[] PortCones = { }; public readonly string MuzzlePalette = "effect"; @@ -54,7 +54,6 @@ namespace OpenRA.Mods.RA Dictionary paxPos; Dictionary paxRender; - public AttackGarrisoned(Actor self, AttackGarrisonedInfo info) : base(self, info) { @@ -66,8 +65,7 @@ namespace OpenRA.Mods.RA paxPos = new Dictionary(); paxRender = new Dictionary(); - GetArmaments = () => armaments; - + getArmaments = () => armaments; if (info.PortOffsets.Length == 0) throw new InvalidOperationException("PortOffsets must have at least one entry."); @@ -110,7 +108,6 @@ namespace OpenRA.Mods.RA armaments.RemoveAll(a => a.Actor == passenger); } - FirePort SelectFirePort(Actor self, WAngle targetYaw) { // Pick a random port that faces the target @@ -171,6 +168,7 @@ namespace OpenRA.Mods.RA muzzles.Add(muzzleFlash); muzzleAnim.PlayThen(sequence, () => muzzles.Remove(muzzleFlash)); } + foreach (var npa in self.TraitsImplementing()) npa.Attacking(self, target, a, barrel); } @@ -179,6 +177,7 @@ namespace OpenRA.Mods.RA public IEnumerable Render(Actor self, WorldRenderer wr) { var pal = wr.Palette(info.MuzzlePalette); + // Display muzzle flashes foreach (var m in muzzles) foreach (var r in m.Render(self, wr, pal, 1f))