diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index 600033f512..a12cf31c42 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -221,7 +221,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var font = Game.Renderer.Fonts[nameLabel.Font]; var nameSize = font.Measure(from); - var time = System.DateTime.Now; + var time = DateTime.Now; timeLabel.GetText = () => "{0:D2}:{1:D2}".F(time.Hour, time.Minute); nameLabel.GetColor = () => c; @@ -233,11 +233,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic // Hack around our hacky wordwrap behavior: need to resize the widget to fit the text text = WidgetUtils.WrapText(text, textLabel.Bounds.Width, font); textLabel.GetText = () => text; - var oldHeight = textLabel.Bounds.Height; - textLabel.Bounds.Height = font.Measure(text).Y; - var dh = textLabel.Bounds.Height - oldHeight; + var dh = font.Measure(text).Y - textLabel.Bounds.Height; if (dh > 0) + { + textLabel.Bounds.Height += dh; template.Bounds.Height += dh; + } chatPanel.AddChild(template); chatPanel.ScrollToBottom(); diff --git a/OpenRA.Mods.RA/Harvester.cs b/OpenRA.Mods.RA/Harvester.cs index f6cbab3209..33c96403b3 100644 --- a/OpenRA.Mods.RA/Harvester.cs +++ b/OpenRA.Mods.RA/Harvester.cs @@ -34,28 +34,19 @@ namespace OpenRA.Mods.RA { Dictionary contents = new Dictionary(); - [Sync] - public Actor LinkedProc = null; - + [Sync] public Actor LinkedProc = null; + [Sync] int currentUnloadTicks; public int2? LastHarvestedCell = null; - - [Sync] - public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } } - - [Sync] - int currentUnloadTicks; - + [Sync] public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } } readonly HarvesterInfo Info; + public Harvester(Actor self, HarvesterInfo info) { Info = info; self.QueueActivity( new CallFunc( () => ChooseNewProc(self, null))); } - public void ChooseNewProc(Actor self, Actor ignore) - { - LinkedProc = ClosestProc(self, ignore); - } + public void ChooseNewProc(Actor self, Actor ignore) { LinkedProc = ClosestProc(self, ignore); } public void ContinueHarvesting(Actor self) { @@ -78,7 +69,9 @@ namespace OpenRA.Mods.RA PathSearch.FromPoints(self.World, mi, self.Owner, refs.Select(r => r.Actor.Location + r.Trait.DeliverOffset), self.Location, false)); + path.Reverse(); + if (path.Count != 0) return refs.Where(x => x.Actor.Location + x.Trait.DeliverOffset == path[0]) .Select(a => a.Actor).FirstOrDefault(); @@ -182,10 +175,8 @@ namespace OpenRA.Mods.RA public void UnlinkProc(Actor self, Actor proc) { - if (LinkedProc != proc) - return; - - ChooseNewProc(self, proc); + if (LinkedProc == proc) + ChooseNewProc(self, proc); } PipType GetPipAt(int i) @@ -218,8 +209,9 @@ namespace OpenRA.Mods.RA class HarvestOrderTargeter : IOrderTargeter { - public string OrderID { get { return "Harvest";}} + public string OrderID { get { return "Harvest"; } } public int OrderPriority { get { return 10; } } + public bool IsQueued { get; protected set; } public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor) { @@ -241,7 +233,6 @@ namespace OpenRA.Mods.RA return true; } - public bool IsQueued { get; protected set; } } } } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 8e9ca767d9..4a22435b19 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -363,6 +363,7 @@ + diff --git a/OpenRA.Mods.RA/OreRefinery.cs b/OpenRA.Mods.RA/OreRefinery.cs index 06be5e338e..c35a63cc17 100644 --- a/OpenRA.Mods.RA/OreRefinery.cs +++ b/OpenRA.Mods.RA/OreRefinery.cs @@ -19,9 +19,7 @@ namespace OpenRA.Mods.RA { public class OreRefineryInfo : ITraitInfo { - public readonly int PipCount = 0; - public readonly PipType PipColor = PipType.Red; - public readonly int2 DockOffset = new int2 (1, 2); + public readonly int2 DockOffset = new int2(1, 2); public readonly bool ShowTicks = true; public readonly int TickLifetime = 30; @@ -40,20 +38,14 @@ namespace OpenRA.Mods.RA int currentDisplayTick = 0; int currentDisplayValue = 0; - [Sync] - public int Ore = 0; - - [Sync] - Actor dockedHarv = null; - [Sync] - bool preventDock = false; + [Sync] public int Ore = 0; + [Sync] Actor dockedHarv = null; + [Sync] bool preventDock = false; public bool AllowDocking { get { return !preventDock; } } public int2 DeliverOffset { get { return Info.DockOffset; } } - public virtual Activity DockSequence(Actor harv, Actor self) - { - return new RAHarvesterDockSequence(harv, self); - } + + public virtual Activity DockSequence(Actor harv, Actor self) { return new RAHarvesterDockSequence(harv, self); } public OreRefinery(Actor self, OreRefineryInfo info) { @@ -69,10 +61,7 @@ namespace OpenRA.Mods.RA .Where(a => a.Trait.LinkedProc == self); } - public bool CanGiveOre(int amount) - { - return PlayerResources.CanGiveOre(amount); - } + public bool CanGiveOre(int amount) { return PlayerResources.CanGiveOre(amount); } public void GiveOre(int amount) { diff --git a/OpenRA.Mods.RA/ParachuteAttachment.cs b/OpenRA.Mods.RA/ParachuteAttachment.cs index 4e44e2d659..3e1882fd79 100644 --- a/OpenRA.Mods.RA/ParachuteAttachment.cs +++ b/OpenRA.Mods.RA/ParachuteAttachment.cs @@ -8,10 +8,6 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.RA diff --git a/OpenRA.Mods.RA/PrimaryBuilding.cs b/OpenRA.Mods.RA/PrimaryBuilding.cs index d065d2dc62..85921f04b1 100755 --- a/OpenRA.Mods.RA/PrimaryBuilding.cs +++ b/OpenRA.Mods.RA/PrimaryBuilding.cs @@ -10,8 +10,8 @@ using System.Collections.Generic; using System.Linq; -using OpenRA.Traits; using OpenRA.Mods.RA.Orders; +using OpenRA.Traits; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/RALoadScreen.cs b/OpenRA.Mods.RA/RALoadScreen.cs index be408ae374..55dc98b3f1 100644 --- a/OpenRA.Mods.RA/RALoadScreen.cs +++ b/OpenRA.Mods.RA/RALoadScreen.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Drawing; -using System.Linq; using OpenRA.FileFormats; using OpenRA.Graphics; using OpenRA.Network; diff --git a/OpenRA.Mods.RA/RadarColorFromTerrain.cs b/OpenRA.Mods.RA/RadarColorFromTerrain.cs index da3dd40d08..930ec77f94 100644 --- a/OpenRA.Mods.RA/RadarColorFromTerrain.cs +++ b/OpenRA.Mods.RA/RadarColorFromTerrain.cs @@ -22,15 +22,13 @@ namespace OpenRA.Mods.RA public class RadarColorFromTerrain : IRadarColorModifier { Color c; + public RadarColorFromTerrain(Actor self, string terrain) { c = self.World.TileSet.Terrain[terrain].Color; } public bool VisibleOnRadar(Actor self) { return true; } - public Color RadarColorOverride(Actor self) - { - return c; - } + public Color RadarColorOverride(Actor self) { return c; } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/RallyPoint.cs b/OpenRA.Mods.RA/RallyPoint.cs index e357d1bb23..1c4d57b150 100755 --- a/OpenRA.Mods.RA/RallyPoint.cs +++ b/OpenRA.Mods.RA/RallyPoint.cs @@ -9,10 +9,8 @@ #endregion using System.Collections.Generic; -using System.Linq; -using OpenRA.Graphics; -using OpenRA.Traits; using OpenRA.Mods.RA.Effects; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -25,8 +23,7 @@ namespace OpenRA.Mods.RA public class RallyPoint : IIssueOrder, IResolveOrder, ISync { - [Sync] - public int2 rallyPoint; + [Sync] public int2 rallyPoint; public RallyPoint(Actor self) { diff --git a/OpenRA.Mods.RA/Reloads.cs b/OpenRA.Mods.RA/Reloads.cs index f66957dbb3..40598f927a 100644 --- a/OpenRA.Mods.RA/Reloads.cs +++ b/OpenRA.Mods.RA/Reloads.cs @@ -22,8 +22,7 @@ namespace OpenRA.Mods.RA public class Reloads : ITick { - [Sync] - int remainingTicks; + [Sync] int remainingTicks; ReloadsInfo Info; LimitedAmmo la; diff --git a/OpenRA.Mods.RA/Render/RenderInfantryPanic.cs b/OpenRA.Mods.RA/Render/RenderInfantryPanic.cs new file mode 100644 index 0000000000..4316606702 --- /dev/null +++ b/OpenRA.Mods.RA/Render/RenderInfantryPanic.cs @@ -0,0 +1,56 @@ +#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.Render +{ + class RenderInfantryPanicInfo : RenderInfantryInfo, Requires + { + public override object Create(ActorInitializer init) { return new RenderInfantryPanic(init.self, this); } + } + + class RenderInfantryPanic : RenderInfantry + { + readonly ScaredyCat sc; + bool wasPanic; + + public RenderInfantryPanic(Actor self, RenderInfantryPanicInfo info) + : base(self, info) + { + sc = self.Trait(); + } + + protected override string NormalizeInfantrySequence(Actor self, string baseSequence) + { + var prefix = sc != null && sc.Panicked ? "panic-" : ""; + + if (anim.HasSequence(prefix + baseSequence)) + return prefix + baseSequence; + else + return baseSequence; + } + + protected override bool AllowIdleAnimation(Actor self) + { + return base.AllowIdleAnimation(self) && !sc.Panicked; + } + + public override void Tick (Actor self) + { + if (wasPanic != sc.Panicked) + dirty = true; + + wasPanic = sc.Panicked; + base.Tick(self); + } + } +} + diff --git a/OpenRA.Mods.RA/RenderRangeCircle.cs b/OpenRA.Mods.RA/RenderRangeCircle.cs index a6895c5210..21c79d931a 100644 --- a/OpenRA.Mods.RA/RenderRangeCircle.cs +++ b/OpenRA.Mods.RA/RenderRangeCircle.cs @@ -9,7 +9,6 @@ #endregion using System.Drawing; -using System.Linq; using OpenRA.Graphics; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Repairable.cs b/OpenRA.Mods.RA/Repairable.cs index 972660b23f..f29e2a2438 100644 --- a/OpenRA.Mods.RA/Repairable.cs +++ b/OpenRA.Mods.RA/Repairable.cs @@ -11,7 +11,6 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; -using OpenRA.Effects; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Move; diff --git a/OpenRA.Mods.RA/RepairableNear.cs b/OpenRA.Mods.RA/RepairableNear.cs index 7e08097401..89204f1501 100644 --- a/OpenRA.Mods.RA/RepairableNear.cs +++ b/OpenRA.Mods.RA/RepairableNear.cs @@ -21,8 +21,7 @@ namespace OpenRA.Mods.RA { class RepairableNearInfo : ITraitInfo, Requires { - [ActorReference] - public readonly string[] Buildings = { "spen", "syrd" }; + [ActorReference] public readonly string[] Buildings = { "spen", "syrd" }; public object Create( ActorInitializer init ) { return new RepairableNear( init.self ); } } diff --git a/OpenRA.Mods.RA/Reservable.cs b/OpenRA.Mods.RA/Reservable.cs index c847228386..27d91d61a8 100755 --- a/OpenRA.Mods.RA/Reservable.cs +++ b/OpenRA.Mods.RA/Reservable.cs @@ -9,8 +9,8 @@ #endregion using System; -using OpenRA.Traits; using OpenRA.Mods.RA.Air; +using OpenRA.Traits; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/ScaredyCat.cs b/OpenRA.Mods.RA/ScaredyCat.cs index 9eded38312..ed9e0d5230 100644 --- a/OpenRA.Mods.RA/ScaredyCat.cs +++ b/OpenRA.Mods.RA/ScaredyCat.cs @@ -9,7 +9,6 @@ #endregion using OpenRA.Mods.RA.Move; -using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -25,64 +24,17 @@ namespace OpenRA.Mods.RA { readonly ScaredyCatInfo Info; public bool Panicked = false; - public ScaredyCat(Actor self, ScaredyCatInfo info) - { - Info = info; - } + + public ScaredyCat(Actor self, ScaredyCatInfo info) { Info = info; } public void TickIdle(Actor self) { - if (!Panicked) - return; + if (!Panicked) return; var target = Util.SubPxVector[self.World.SharedRandom.Next(255)]* Info.MoveRadius / 1024 + self.Location; self.Trait().ResolveOrder(self, new Order("Move", self, false) { TargetLocation = target }); } - public void Damaged(Actor self, AttackInfo e) - { - Panicked = true; - } - } - - class RenderInfantryPanicInfo : RenderInfantryInfo, Requires - { - public override object Create(ActorInitializer init) { return new RenderInfantryPanic(init.self, this); } - } - - class RenderInfantryPanic : RenderInfantry - { - readonly ScaredyCat sc; - bool wasPanic; - - public RenderInfantryPanic(Actor self, RenderInfantryPanicInfo info) - : base(self, info) - { - sc = self.Trait(); - } - - protected override string NormalizeInfantrySequence(Actor self, string baseSequence) - { - var prefix = sc != null && sc.Panicked ? "panic-" : ""; - - if (anim.HasSequence(prefix + baseSequence)) - return prefix + baseSequence; - else - return baseSequence; - } - - protected override bool AllowIdleAnimation(Actor self) - { - return base.AllowIdleAnimation(self) && !sc.Panicked; - } - - public override void Tick (Actor self) - { - if (wasPanic != sc.Panicked) - dirty = true; - - wasPanic = sc.Panicked; - base.Tick(self); - } + public void Damaged(Actor self, AttackInfo e) { Panicked = true; } } } diff --git a/OpenRA.Mods.RA/Sellable.cs b/OpenRA.Mods.RA/Sellable.cs index 2b301ec016..db0fcca9eb 100644 --- a/OpenRA.Mods.RA/Sellable.cs +++ b/OpenRA.Mods.RA/Sellable.cs @@ -8,12 +8,9 @@ */ #endregion -using System; -using System.Collections.Generic; -using OpenRA.Orders; -using OpenRA.Traits; -using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Render; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -25,6 +22,7 @@ namespace OpenRA.Mods.RA class Sellable : IResolveOrder { bool selling = false; + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Sell" && !selling) diff --git a/OpenRA.Mods.RA/ShroudPalette.cs b/OpenRA.Mods.RA/ShroudPalette.cs index e479ba1823..d9881e4411 100644 --- a/OpenRA.Mods.RA/ShroudPalette.cs +++ b/OpenRA.Mods.RA/ShroudPalette.cs @@ -10,8 +10,8 @@ using System.Drawing; using OpenRA.FileFormats; -using OpenRA.Traits; using OpenRA.Graphics; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -25,10 +25,8 @@ namespace OpenRA.Mods.RA class ShroudPalette : IPalette { readonly ShroudPaletteInfo info; - public ShroudPalette( ShroudPaletteInfo info ) - { - this.info = info; - } + + public ShroudPalette( ShroudPaletteInfo info ) { this.info = info; } public void InitPalette( WorldRenderer wr ) { diff --git a/OpenRA.Mods.RA/TakeCover.cs b/OpenRA.Mods.RA/TakeCover.cs index 9eed4f941e..6133243c02 100644 --- a/OpenRA.Mods.RA/TakeCover.cs +++ b/OpenRA.Mods.RA/TakeCover.cs @@ -9,8 +9,8 @@ #endregion using OpenRA.GameRules; -using OpenRA.Traits; using OpenRA.Mods.RA.Render; +using OpenRA.Traits; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/TargetableBuilding.cs b/OpenRA.Mods.RA/TargetableBuilding.cs index f31cc9cf8e..057e9e2bbb 100755 --- a/OpenRA.Mods.RA/TargetableBuilding.cs +++ b/OpenRA.Mods.RA/TargetableBuilding.cs @@ -18,19 +18,19 @@ namespace OpenRA.Mods.RA class TargetableBuildingInfo : ITraitInfo, Requires { public readonly string[] TargetTypes = { }; + public object Create( ActorInitializer init ) { return new TargetableBuilding( this ); } } class TargetableBuilding : ITargetable { readonly TargetableBuildingInfo info; - public TargetableBuilding( TargetableBuildingInfo info ) - { - this.info = info; - } + + public TargetableBuilding( TargetableBuildingInfo info ) { this.info = info; } public string[] TargetTypes { get { return info.TargetTypes; } } public bool TargetableBy(Actor self, Actor byActor) { return true; } + public IEnumerable TargetableCells( Actor self ) { return self.Trait().OccupiedCells().Select(c => c.First); diff --git a/OpenRA.Mods.RA/TargetableSubmarine.cs b/OpenRA.Mods.RA/TargetableSubmarine.cs index 3a24998fbb..904d1f3b3c 100644 --- a/OpenRA.Mods.RA/TargetableSubmarine.cs +++ b/OpenRA.Mods.RA/TargetableSubmarine.cs @@ -16,6 +16,7 @@ namespace OpenRA.Mods.RA public class TargetableSubmarineInfo : TargetableUnitInfo, Requires { public readonly string[] CloakedTargetTypes = {}; + public override object Create( ActorInitializer init ) { return new TargetableSubmarine(init.self, this); } } @@ -26,8 +27,8 @@ namespace OpenRA.Mods.RA public override string[] TargetTypes { - get { return (Cloak.Cloaked) ? info.CloakedTargetTypes - : info.TargetTypes;} + get { return Cloak.Cloaked ? info.CloakedTargetTypes + : info.TargetTypes;} } } } diff --git a/OpenRA.Mods.RA/TargetableUnit.cs b/OpenRA.Mods.RA/TargetableUnit.cs index 4380f8a922..eefba6aa96 100755 --- a/OpenRA.Mods.RA/TargetableUnit.cs +++ b/OpenRA.Mods.RA/TargetableUnit.cs @@ -8,10 +8,8 @@ */ #endregion -using System; using System.Collections.Generic; using System.Linq; -using System.Text; using OpenRA.Traits; namespace OpenRA.Mods.RA diff --git a/OpenRA.Mods.RA/TransformOnCapture.cs b/OpenRA.Mods.RA/TransformOnCapture.cs index 9d159c943c..206a84b913 100644 --- a/OpenRA.Mods.RA/TransformOnCapture.cs +++ b/OpenRA.Mods.RA/TransformOnCapture.cs @@ -8,19 +8,16 @@ */ #endregion -using System.Collections.Generic; using OpenRA.Mods.RA.Activities; -using OpenRA.Mods.RA.Buildings; -using OpenRA.Mods.RA.Orders; using OpenRA.Traits; namespace OpenRA.Mods.RA { class TransformOnCaptureInfo : ITraitInfo { - [ActorReference] - public readonly string IntoActor = null; + [ActorReference] public readonly string IntoActor = null; public readonly int ForceHealthPercentage = 0; + public virtual object Create(ActorInitializer init) { return new TransformOnCapture(this); } } @@ -28,14 +25,14 @@ namespace OpenRA.Mods.RA { TransformOnCaptureInfo Info; - public TransformOnCapture(TransformOnCaptureInfo info) - { - Info = info; - } + public TransformOnCapture(TransformOnCaptureInfo info) { Info = info; } - public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { - self.QueueActivity(new Transform(self, Info.IntoActor) {ForceHealthPercentage = Info.ForceHealthPercentage, Facing = self.Trait().Facing}); + self.QueueActivity(new Transform(self, Info.IntoActor) { + ForceHealthPercentage = Info.ForceHealthPercentage, + Facing = self.Trait().Facing + }); } } } diff --git a/OpenRA.Mods.RA/TransformOnPassenger.cs b/OpenRA.Mods.RA/TransformOnPassenger.cs index 8a49518c1c..1257bb7e70 100644 --- a/OpenRA.Mods.RA/TransformOnPassenger.cs +++ b/OpenRA.Mods.RA/TransformOnPassenger.cs @@ -10,8 +10,6 @@ using System.Linq; using OpenRA.FileFormats; -using OpenRA.Mods.RA.Buildings; -using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Activities; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Transforms.cs b/OpenRA.Mods.RA/Transforms.cs index 488be91324..68533b3177 100644 --- a/OpenRA.Mods.RA/Transforms.cs +++ b/OpenRA.Mods.RA/Transforms.cs @@ -12,15 +12,14 @@ using System.Collections.Generic; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Orders; -using OpenRA.Traits; using OpenRA.Mods.RA.Render; +using OpenRA.Traits; namespace OpenRA.Mods.RA { class TransformsInfo : ITraitInfo { - [ActorReference] - public readonly string IntoActor = null; + [ActorReference] public readonly string IntoActor = null; public readonly int2 Offset = int2.Zero; public readonly int Facing = 96; public readonly string[] TransformSounds = {}; diff --git a/OpenRA.Mods.RA/Turreted.cs b/OpenRA.Mods.RA/Turreted.cs index 84aac24be7..eb4ac8e314 100755 --- a/OpenRA.Mods.RA/Turreted.cs +++ b/OpenRA.Mods.RA/Turreted.cs @@ -45,13 +45,13 @@ namespace OpenRA.Mods.RA facing = init.self.TraitOrDefault(); } - public void Tick( Actor self ) + public void Tick(Actor self) { var df = desiredFacing ?? ( facing != null ? facing.Facing : turretFacing ); turretFacing = Util.TickFacing(turretFacing, df, info.ROT); } - public bool FaceTarget( Actor self, Target target ) + public bool FaceTarget(Actor self, Target target) { desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turretFacing ); return turretFacing == desiredFacing; diff --git a/OpenRA.Mods.RA/Valued.cs b/OpenRA.Mods.RA/Valued.cs index 4f693c7a9d..a27ca266d9 100755 --- a/OpenRA.Mods.RA/Valued.cs +++ b/OpenRA.Mods.RA/Valued.cs @@ -17,16 +17,16 @@ namespace OpenRA.Mods.RA public readonly int Cost = 0; } + public class Valued { } + public class TooltipInfo : ITraitInfo { public readonly string Description = ""; public readonly string Name = ""; public readonly string Icon = null; - public virtual object Create (ActorInitializer init) { return new Tooltip(init.self, this); } -} - - public class Valued { } + public virtual object Create(ActorInitializer init) { return new Tooltip(init.self, this); } + } public class Tooltip : IToolTip { @@ -34,12 +34,10 @@ namespace OpenRA.Mods.RA TooltipInfo Info; public string Name() { return Info.Name; } - public Player Owner() { return self.Owner; } - public Stance Stance() { return self.World.LocalPlayer.Stances[self.Owner]; } - public Tooltip( Actor self, TooltipInfo info ) + public Tooltip(Actor self, TooltipInfo info) { this.self = self; Info = info; diff --git a/OpenRA.Mods.RA/WaterPaletteRotation.cs b/OpenRA.Mods.RA/WaterPaletteRotation.cs index 65fb14bc2b..dbe6ae9b8b 100644 --- a/OpenRA.Mods.RA/WaterPaletteRotation.cs +++ b/OpenRA.Mods.RA/WaterPaletteRotation.cs @@ -16,6 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { class WaterPaletteRotationInfo : TraitInfo {} + class WaterPaletteRotation : ITick, IPaletteModifier { float t = 0; diff --git a/OpenRA.Mods.RA/Weapon.cs b/OpenRA.Mods.RA/Weapon.cs index 146236b2f7..1b712a6e07 100644 --- a/OpenRA.Mods.RA/Weapon.cs +++ b/OpenRA.Mods.RA/Weapon.cs @@ -110,15 +110,14 @@ namespace OpenRA.Mods.RA if (limitedAmmo != null && !limitedAmmo.HasAmmo()) return; - if( !Combat.IsInRange( self.CenterLocation, Info.Range, target ) ) - return; - if( Combat.IsInRange( self.CenterLocation, Info.MinRange, target ) ) - return; + if (!Combat.IsInRange(self.CenterLocation, Info.Range, target)) return; + if (Combat.IsInRange(self.CenterLocation, Info.MinRange, target)) return; if (!IsValidAgainst(self.World, target)) return; var barrel = Barrels[Burst % Barrels.Length]; var destMove = target.IsActor ? target.Actor.TraitOrDefault() : null; + var turreted = self.TraitOrDefault(); var args = new ProjectileArgs { @@ -134,7 +133,7 @@ namespace OpenRA.Mods.RA destAltitude = destMove != null ? destMove.Altitude : 0, facing = barrel.Facing + - (self.HasTrait() ? self.Trait().turretFacing : + (turreted != null ? turreted.turretFacing : facing != null ? facing.Facing : Util.GetFacing(target.CenterLocation - self.CenterLocation, 0)), firepowerModifier = self.TraitsImplementing()