diff --git a/OpenRA.Mods.RA/AI/AttackOrFleeFuzzy.cs b/OpenRA.Mods.RA/AI/AttackOrFleeFuzzy.cs index c133dbd968..6b1533d45e 100644 --- a/OpenRA.Mods.RA/AI/AttackOrFleeFuzzy.cs +++ b/OpenRA.Mods.RA/AI/AttackOrFleeFuzzy.cs @@ -12,8 +12,8 @@ using System; using System.Collections.Generic; using System.Linq; using AI.Fuzzy.Library; -using OpenRA.Mods.RA.Traits; using OpenRA.GameRules; +using OpenRA.Mods.RA.Traits; using OpenRA.Traits; namespace OpenRA.Mods.RA.AI @@ -201,6 +201,7 @@ namespace OpenRA.Mods.RA.AI if (warhead != null) sumOfDamage += warhead.Damage; } + return sumOfDamage; }); } diff --git a/OpenRA.Mods.RA/AI/BaseBuilder.cs b/OpenRA.Mods.RA/AI/BaseBuilder.cs index cdf7853976..6821704c2e 100644 --- a/OpenRA.Mods.RA/AI/BaseBuilder.cs +++ b/OpenRA.Mods.RA/AI/BaseBuilder.cs @@ -73,10 +73,9 @@ namespace OpenRA.Mods.RA.AI HackyAI.BotDebug("AI: {0} is starting production of {1}".F(player, item.Name)); world.IssueOrder(Order.StartProduction(queue.Actor, item.Name, 1)); } - - // Production is complete else if (currentBuilding.Done) { + // Production is complete // Choose the placement logic // HACK: HACK HACK HACK var type = BuildingType.Building; diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 87ebaac91f..d5d96485ab 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -735,6 +735,7 @@ namespace OpenRA.Mods.RA.AI foreach (var kv in powers) { var sp = kv.Value; + // Add power to dictionary if not in delay dictionary yet if (!waitingPowers.ContainsKey(sp)) waitingPowers.Add(sp, 0); @@ -743,7 +744,7 @@ namespace OpenRA.Mods.RA.AI waitingPowers[sp]--; // If we have recently tried and failed to find a use location for a power, then do not try again until later - var isDelayed = (waitingPowers[sp] > 0); + var isDelayed = waitingPowers[sp] > 0; if (sp.Ready && !isDelayed && powerDecisions.ContainsKey(sp.Info.OrderName)) { var powerDecision = powerDecisions[sp.Info.OrderName]; @@ -780,7 +781,7 @@ namespace OpenRA.Mods.RA.AI } } - ///Scans the map in chunks, evaluating all actors in each. + /// Scans the map in chunks, evaluating all actors in each. CPos? FindCoarseAttackLocationToSupportPower(SupportPowerInstance readyPower) { CPos? bestLocation = null; @@ -815,7 +816,7 @@ namespace OpenRA.Mods.RA.AI return bestLocation; } - ///Detail scans an area, evaluating positions. + /// Detail scans an area, evaluating positions. CPos? FindFineAttackLocationToSupportPower(SupportPowerInstance readyPower, CPos checkPos, int extendedRange = 1) { CPos? bestLocation = null; @@ -829,11 +830,11 @@ namespace OpenRA.Mods.RA.AI var checkRadius = powerDecision.CoarseScanRadius; var fineCheck = powerDecision.FineScanRadius; - for (var i = (0 - extendedRange); i <= (checkRadius + extendedRange); i += fineCheck) + for (var i = 0 - extendedRange; i <= (checkRadius + extendedRange); i += fineCheck) { var x = checkPos.X + i; - for (var j = (0 - extendedRange); j <= (checkRadius + extendedRange); j += fineCheck) + for (var j = 0 - extendedRange; j <= (checkRadius + extendedRange); j += fineCheck) { var y = checkPos.Y + j; var pos = world.Map.CenterOfCell(new CPos(x, y)); diff --git a/OpenRA.Mods.RA/AI/SupportPowerDecision.cs b/OpenRA.Mods.RA/AI/SupportPowerDecision.cs index 13ff51dfb4..c6e22db160 100644 --- a/OpenRA.Mods.RA/AI/SupportPowerDecision.cs +++ b/OpenRA.Mods.RA/AI/SupportPowerDecision.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA [Desc("What support power does this decision apply to?")] public readonly string OrderName = "AirstrikePowerInfoOrder"; - [Desc("What is the coarse scan radius of this power?","For finding the general target area, before doing a detail scan","Should be 10 or more to avoid lag")] + [Desc("What is the coarse scan radius of this power?", "For finding the general target area, before doing a detail scan", "Should be 10 or more to avoid lag")] public readonly int CoarseScanRadius = 20; [Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")] @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA return ret; } - ///Evaluates the attractiveness of a position according to all considerations + /// Evaluates the attractiveness of a position according to all considerations public int GetAttractiveness(WPos pos, Player firedBy) { var answer = 0; @@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA return answer; } - ///Evaluates the attractiveness of a group of actors according to all considerations + /// Evaluates the attractiveness of a group of actors according to all considerations public int GetAttractiveness(IEnumerable actors, Player firedBy) { var answer = 0; @@ -95,10 +95,10 @@ namespace OpenRA.Mods.RA public int GetNextScanTime(HackyAI ai) { return ai.random.Next(MinimumScanTimeInterval, MaximumScanTimeInterval); } - ///Makes up part of a decision, describing how to evaluate a target. + /// Makes up part of a decision, describing how to evaluate a target. class Consideration { - public enum DecisionMetric { Health, Value, None }; + public enum DecisionMetric { Health, Value, None } [Desc("Against whom should this power be used?", "Allowed keywords: Ally, Neutral, Enemy")] public readonly Stance Against = Stance.Enemy; @@ -120,7 +120,7 @@ namespace OpenRA.Mods.RA FieldLoader.Load(this, yaml); } - ///Evaluates a single actor according to the rules defined in this consideration + /// Evaluates a single actor according to the rules defined in this consideration public int GetAttractiveness(Actor a, Stance stance, Player firedBy) { if (stance != Against) @@ -152,6 +152,7 @@ namespace OpenRA.Mods.RA return Attractiveness; } } + return 0; } } diff --git a/OpenRA.Mods.RA/Activities/Air/FallToEarth.cs b/OpenRA.Mods.RA/Activities/Air/FallToEarth.cs index 9a304d9f96..d5c4e328b2 100644 --- a/OpenRA.Mods.RA/Activities/Air/FallToEarth.cs +++ b/OpenRA.Mods.RA/Activities/Air/FallToEarth.cs @@ -37,6 +37,7 @@ namespace OpenRA.Mods.RA.Activities if (info.Explosion != null) { var weapon = self.World.Map.Rules.Weapons[info.Explosion.ToLowerInvariant()]; + // Use .FromPos since this actor is killed. Cannot use Target.FromActor weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty()); } diff --git a/OpenRA.Mods.RA/Activities/Air/Fly.cs b/OpenRA.Mods.RA/Activities/Air/Fly.cs index c0a571eda4..6705f43998 100644 --- a/OpenRA.Mods.RA/Activities/Air/Fly.cs +++ b/OpenRA.Mods.RA/Activities/Air/Fly.cs @@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA.Activities var desiredFacing = Util.GetFacing(d, plane.Facing); // Don't turn until we've reached the cruise altitude - if (plane.CenterPosition.Z < plane.Info.CruiseAltitude.Range) + if (plane.CenterPosition.Z < plane.Info.CruiseAltitude.Range) desiredFacing = plane.Facing; FlyToward(self, plane, desiredFacing, plane.Info.CruiseAltitude); diff --git a/OpenRA.Mods.RA/Activities/Air/FlyAttack.cs b/OpenRA.Mods.RA/Activities/Air/FlyAttack.cs index f5fff81eab..0cf9763580 100644 --- a/OpenRA.Mods.RA/Activities/Air/FlyAttack.cs +++ b/OpenRA.Mods.RA/Activities/Air/FlyAttack.cs @@ -46,6 +46,7 @@ namespace OpenRA.Mods.RA.Activities else inner = Util.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn)); } + inner = Util.RunActivity(self, inner); return this; diff --git a/OpenRA.Mods.RA/Activities/Air/HeliReturn.cs b/OpenRA.Mods.RA/Activities/Air/HeliReturn.cs index 5e5561428b..ac25e49de4 100644 --- a/OpenRA.Mods.RA/Activities/Air/HeliReturn.cs +++ b/OpenRA.Mods.RA/Activities/Air/HeliReturn.cs @@ -55,6 +55,7 @@ namespace OpenRA.Mods.RA.Activities heli.UnReserve(); heli.Reservation = res.Reserve(dest, self, heli); } + var exit = dest.Info.Traits.WithInterface().FirstOrDefault(); var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero; diff --git a/OpenRA.Mods.RA/Activities/Attack.cs b/OpenRA.Mods.RA/Activities/Attack.cs index 844cc30e36..f5007a573f 100755 --- a/OpenRA.Mods.RA/Activities/Attack.cs +++ b/OpenRA.Mods.RA/Activities/Attack.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Activities public override Activity Tick(Actor self) { var ret = InnerTick(self, attack); - attack.IsAttacking = (ret == this); + attack.IsAttacking = ret == this; return ret; } diff --git a/OpenRA.Mods.RA/Activities/DeliverResources.cs b/OpenRA.Mods.RA/Activities/DeliverResources.cs index 04e2d8f02c..0fe4f01aa3 100755 --- a/OpenRA.Mods.RA/Activities/DeliverResources.cs +++ b/OpenRA.Mods.RA/Activities/DeliverResources.cs @@ -19,11 +19,10 @@ namespace OpenRA.Mods.RA.Activities { public class DeliverResources : Activity { + const int NextChooseTime = 100; bool isDocking; int chosenTicks; - const int NextChooseTime = 100; - public override Activity Tick(Actor self) { if (NextActivity != null) diff --git a/OpenRA.Mods.RA/Activities/Demolish.cs b/OpenRA.Mods.RA/Activities/Demolish.cs index 56306ea98b..0c263ffb67 100644 --- a/OpenRA.Mods.RA/Activities/Demolish.cs +++ b/OpenRA.Mods.RA/Activities/Demolish.cs @@ -12,8 +12,8 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Activities; using OpenRA.Effects; -using OpenRA.Traits; using OpenRA.Mods.RA.Traits; +using OpenRA.Traits; namespace OpenRA.Mods.RA.Activities { diff --git a/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs b/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs index 010c05c165..1abdcbc376 100644 --- a/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs @@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA.Activities }); } } + return this; } } diff --git a/OpenRA.Mods.RA/Activities/FindResources.cs b/OpenRA.Mods.RA/Activities/FindResources.cs index 7618a85122..a954452a8f 100755 --- a/OpenRA.Mods.RA/Activities/FindResources.cs +++ b/OpenRA.Mods.RA/Activities/FindResources.cs @@ -69,6 +69,7 @@ namespace OpenRA.Mods.RA.Activities var resType = resLayer.GetResource(loc); if (resType == null) return 1; + // Can the harvester collect this kind of resource? if (!harvInfo.Resources.Contains(resType.Info.Name)) return 1; @@ -81,8 +82,7 @@ namespace OpenRA.Mods.RA.Activities return 0; }) - .FromPoint(self.Location) - ); + .FromPoint(self.Location)); if (path.Count == 0) { diff --git a/OpenRA.Mods.RA/Activities/LayMines.cs b/OpenRA.Mods.RA/Activities/LayMines.cs index 3e4432beea..0a84e9e9dc 100644 --- a/OpenRA.Mods.RA/Activities/LayMines.cs +++ b/OpenRA.Mods.RA/Activities/LayMines.cs @@ -18,7 +18,6 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Activities { // assumes you have Minelayer on that unit - class LayMines : Activity { public override Activity Tick(Actor self) @@ -30,6 +29,7 @@ namespace OpenRA.Mods.RA.Activities if (!limitedAmmo.HasAmmo()) { var info = self.Info.Traits.Get(); + // rearm & repair at fix, then back out here to refill the minefield some more var buildings = info.RearmBuildings; var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally @@ -56,16 +56,16 @@ namespace OpenRA.Mods.RA.Activities if (ml.Minefield.Length > 0) { - for (var n = 0; n < 20; n++) // dont get stuck forever here + // dont get stuck forever here + for (var n = 0; n < 20; n++) { var p = ml.Minefield.Random(self.World.SharedRandom); if (ShouldLayMine(self, p)) - return Util.SequenceActivities( movement.MoveTo(p, 0), this ); + return Util.SequenceActivities(movement.MoveTo(p, 0), this); } } // TODO: return somewhere likely to be safe (near fix) so we're not sitting out in the minefield. - return new Wait(20); // nothing to do here } diff --git a/OpenRA.Mods.RA/Activities/Leap.cs b/OpenRA.Mods.RA/Activities/Leap.cs index 8174277cb6..3b4fccbab2 100644 --- a/OpenRA.Mods.RA/Activities/Leap.cs +++ b/OpenRA.Mods.RA/Activities/Leap.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.RA.Activities mobile.IsMoving = false; self.World.ActorMap.GetUnitsAt(mobile.toCell, mobile.toSubCell) - .Except(new []{self}).Where(t => weapon.IsValidAgainst(t, self)) + .Except(new[] { self }).Where(t => weapon.IsValidAgainst(t, self)) .Do(t => t.Kill(self)); return NextActivity; diff --git a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs index 4c0f0479cf..29a8436b3a 100644 --- a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs +++ b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA { public class RAHarvesterDockSequence : Activity { - enum State { Wait, Turn, Dock, Loop, Undock, Complete }; + enum State { Wait, Turn, Dock, Loop, Undock, Complete } readonly Actor proc; readonly int angle; @@ -82,10 +82,9 @@ namespace OpenRA.Mods.RA base.Cancel(self); } - public override IEnumerable GetTargets( Actor self ) + public override IEnumerable GetTargets(Actor self) { yield return Target.FromActor(proc); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index 4fedc95fbb..d04b6a3bbc 100755 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -22,6 +22,7 @@ namespace OpenRA.Mods.RA.Activities public class Teleport : Activity { + const int maxCellSearchRange = Map.MaxTilesInCircleRange; Actor teleporter; CPos destination; int? maximumDistance; @@ -29,8 +30,6 @@ namespace OpenRA.Mods.RA.Activities bool screenFlash; string sound; - const int maxCellSearchRange = Map.MaxTilesInCircleRange; - public Teleport(Actor teleporter, CPos destination, int? maximumDistance, bool killCargo, bool screenFlash, string sound) { if (maximumDistance > maxCellSearchRange) @@ -74,6 +73,7 @@ namespace OpenRA.Mods.RA.Activities while (!cargo.IsEmpty(self)) { var a = cargo.Unload(self); + // Kill all the units that are unloaded into the void // Kill() handles kill and death statistics a.Kill(teleporter); diff --git a/OpenRA.Mods.RA/Activities/UnloadCargo.cs b/OpenRA.Mods.RA/Activities/UnloadCargo.cs index 68eb89dd75..fac7cb756f 100644 --- a/OpenRA.Mods.RA/Activities/UnloadCargo.cs +++ b/OpenRA.Mods.RA/Activities/UnloadCargo.cs @@ -74,6 +74,7 @@ namespace OpenRA.Mods.RA.Activities foreach (var nbm in blocker.TraitsImplementing()) nbm.OnNotifyBlockingMove(blocker, self); } + return Util.SequenceActivities(new Wait(10), this); } diff --git a/OpenRA.Mods.RA/Armament.cs b/OpenRA.Mods.RA/Armament.cs index 4b5cec1d9a..83d53a6755 100644 --- a/OpenRA.Mods.RA/Armament.cs +++ b/OpenRA.Mods.RA/Armament.cs @@ -37,9 +37,9 @@ namespace OpenRA.Mods.RA.Traits public readonly int FireDelay = 0; [Desc("Muzzle position relative to turret or body. (forward, right, up) triples")] - public readonly WVec[] LocalOffset = {}; + public readonly WVec[] LocalOffset = { }; [Desc("Muzzle yaw relative to turret or body.")] - public readonly WAngle[] LocalYaw = {}; + public readonly WAngle[] LocalYaw = { }; [Desc("Move the turret backwards when firing.")] public readonly WRange Recoil = WRange.Zero; [Desc("Recoil recovery per-frame")] diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index b50a8330b6..62fe21bc00 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -9,15 +9,14 @@ #endregion using System; -using System.Linq; using System.Collections.Generic; -using OpenRA.Traits; -using OpenRA.Primitives; +using System.Linq; using OpenRA.Mods.Common.Orders; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Traits; - +using OpenRA.Primitives; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -89,6 +88,7 @@ namespace OpenRA.Mods.RA totalWeight = cargo.Sum(c => GetWeight(c)); } + facing = Exts.Lazy(self.TraitOrDefault); } @@ -329,6 +329,7 @@ namespace OpenRA.Mods.RA foreach (var npe in self.TraitsImplementing()) npe.PassengerEntered(self, c); } + initialized = true; } diff --git a/OpenRA.Mods.RA/CashTrickler.cs b/OpenRA.Mods.RA/CashTrickler.cs index 60e6f51063..2fc44d9637 100644 --- a/OpenRA.Mods.RA/CashTrickler.cs +++ b/OpenRA.Mods.RA/CashTrickler.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA [Desc("Amount of money awarded for capturing the actor.")] public readonly int CaptureAmount = 0; - public object Create (ActorInitializer init) { return new CashTrickler(this); } + public object Create(ActorInitializer init) { return new CashTrickler(this); } } class CashTrickler : ITick, ISync, INotifyCapture diff --git a/OpenRA.Mods.RA/Crushable.cs b/OpenRA.Mods.RA/Crushable.cs index 26a9816c3c..348ffd3800 100644 --- a/OpenRA.Mods.RA/Crushable.cs +++ b/OpenRA.Mods.RA/Crushable.cs @@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Traits wda.SpawnDeathAnimation(self, wda.Info.CrushedSequence, palette); } + self.Kill(crusher); } diff --git a/OpenRA.Mods.RA/DetectCloaked.cs b/OpenRA.Mods.RA/DetectCloaked.cs index f1fe349ea2..48c83d5cd5 100644 --- a/OpenRA.Mods.RA/DetectCloaked.cs +++ b/OpenRA.Mods.RA/DetectCloaked.cs @@ -22,5 +22,5 @@ namespace OpenRA.Mods.RA public readonly int Range = 5; } - class DetectCloaked {} + class DetectCloaked { } } diff --git a/OpenRA.Mods.RA/Effects/GpsSatellite.cs b/OpenRA.Mods.RA/Effects/GpsSatellite.cs index d8835763a5..bf1af5f60d 100644 --- a/OpenRA.Mods.RA/Effects/GpsSatellite.cs +++ b/OpenRA.Mods.RA/Effects/GpsSatellite.cs @@ -16,8 +16,8 @@ namespace OpenRA.Mods.RA.Effects { class GpsSatellite : IEffect { - WPos pos; readonly Animation anim; + WPos pos; public GpsSatellite(World world, WPos pos) { @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Effects anim.PlayRepeating("idle"); } - public void Tick( World world ) + public void Tick(World world) { anim.Tick(); pos += new WVec(0, 0, 427); diff --git a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs index c15ed7ead1..8971425583 100644 --- a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs +++ b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs @@ -16,9 +16,9 @@ namespace OpenRA.Mods.RA.Effects { class SatelliteLaunch : IEffect { - int frame = 0; readonly Animation doors; readonly WPos pos; + int frame = 0; public SatelliteLaunch(Actor a) { @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Effects pos = a.CenterPosition; } - public void Tick( World world ) + public void Tick(World world) { doors.Tick(); diff --git a/OpenRA.Mods.RA/Effects/TeslaZap.cs b/OpenRA.Mods.RA/Effects/TeslaZap.cs index 9c01f42b4b..7d68a66cbc 100644 --- a/OpenRA.Mods.RA/Effects/TeslaZap.cs +++ b/OpenRA.Mods.RA/Effects/TeslaZap.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Effects public readonly string Palette = "effect"; public readonly int BrightZaps = 1; public readonly int DimZaps = 2; - public IEffect Create(ProjectileArgs args) { return new TeslaZap( this, args ); } + public IEffect Create(ProjectileArgs args) { return new TeslaZap(this, args); } } class TeslaZap : IEffect @@ -61,6 +61,7 @@ namespace OpenRA.Mods.RA.Effects var pos = Args.GuidedTarget.IsValidFor(Args.SourceActor) ? Args.GuidedTarget.CenterPosition : Args.PassiveTarget; zap = new TeslaZapRenderable(Args.Source, 0, pos - Args.Source, Info.Image, Info.BrightZaps, Info.DimZaps, Info.Palette); } + yield return zap; } } diff --git a/OpenRA.Mods.RA/EjectOnDeath.cs b/OpenRA.Mods.RA/EjectOnDeath.cs index 4e822de16a..f317ff3c85 100644 --- a/OpenRA.Mods.RA/EjectOnDeath.cs +++ b/OpenRA.Mods.RA/EjectOnDeath.cs @@ -47,8 +47,7 @@ namespace OpenRA.Mods.RA.Traits var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) }); - - + if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot)) { if (cp.Z > 0) diff --git a/OpenRA.Mods.RA/EmitInfantryOnSell.cs b/OpenRA.Mods.RA/EmitInfantryOnSell.cs index af0492aec4..436b9606c5 100644 --- a/OpenRA.Mods.RA/EmitInfantryOnSell.cs +++ b/OpenRA.Mods.RA/EmitInfantryOnSell.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Traits var health = self.TraitOrDefault(); var dudesValue = info.ValuePercent * cost; if (health != null) - dudesValue = dudesValue*health.HP / health.MaxHP; + dudesValue = dudesValue * health.HP / health.MaxHP; dudesValue /= 100; var eligibleLocations = FootprintUtils.Tiles(self).ToList(); diff --git a/OpenRA.Mods.RA/ExternalCapturableBar.cs b/OpenRA.Mods.RA/ExternalCapturableBar.cs index d6a528171f..ad4b47b4c8 100644 --- a/OpenRA.Mods.RA/ExternalCapturableBar.cs +++ b/OpenRA.Mods.RA/ExternalCapturableBar.cs @@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA.Traits return (float)cap.CaptureProgressTime / (cap.Info.CaptureCompleteTime * 25); } + public Color GetColor() { return Color.Orange; } } } diff --git a/OpenRA.Mods.RA/GainsExperience.cs b/OpenRA.Mods.RA/GainsExperience.cs index e21d48db47..2393252601 100644 --- a/OpenRA.Mods.RA/GainsExperience.cs +++ b/OpenRA.Mods.RA/GainsExperience.cs @@ -11,8 +11,8 @@ using System; using System.Collections.Generic; using System.Linq; -using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Effects; +using OpenRA.Mods.Common.Traits; using OpenRA.Mods.RA.Effects; using OpenRA.Primitives; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/GivesBounty.cs b/OpenRA.Mods.RA/GivesBounty.cs index cacdb2a659..447c506b2c 100644 --- a/OpenRA.Mods.RA/GivesBounty.cs +++ b/OpenRA.Mods.RA/GivesBounty.cs @@ -9,8 +9,8 @@ #endregion using System.Linq; -using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Effects; +using OpenRA.Mods.Common.Traits; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA [Desc("Higher ranked units give higher bounties.")] public readonly int LevelMod = 125; [Desc("Destroying creeps and enemies is rewarded.")] - public readonly Stance[] Stances = {Stance.Neutral, Stance.Enemy}; + public readonly Stance[] Stances = { Stance.Neutral, Stance.Enemy }; } class GivesBounty : INotifyKilled @@ -49,6 +49,7 @@ namespace OpenRA.Mods.RA if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return; var cost = self.GetSellValue(); + // 2 hundreds because of GetMultiplier and info.Percentage. var bounty = cost * GetMultiplier(self) * info.Percentage / 10000; diff --git a/OpenRA.Mods.RA/InvulnerabilityUpgrade.cs b/OpenRA.Mods.RA/InvulnerabilityUpgrade.cs index 3e7aa0d0d1..3382b0cf04 100644 --- a/OpenRA.Mods.RA/InvulnerabilityUpgrade.cs +++ b/OpenRA.Mods.RA/InvulnerabilityUpgrade.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA public class InvulnerabilityUpgrade : UpgradableTrait, IDamageModifier { public InvulnerabilityUpgrade(InvulnerabilityUpgradeInfo info) - : base (info) { } + : base(info) { } public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { diff --git a/OpenRA.Mods.RA/Lint/CheckActorReferences.cs b/OpenRA.Mods.RA/Lint/CheckActorReferences.cs index e7aa82cff2..bd7afe4f02 100644 --- a/OpenRA.Mods.RA/Lint/CheckActorReferences.cs +++ b/OpenRA.Mods.RA/Lint/CheckActorReferences.cs @@ -65,5 +65,4 @@ namespace OpenRA.Mods.RA .F(actorInfo.Name, traitInfo.GetType().Name, fieldInfo.Name, type, v)); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Lint/CheckActors.cs b/OpenRA.Mods.RA/Lint/CheckActors.cs index c6c259f3d0..a6b941107f 100644 --- a/OpenRA.Mods.RA/Lint/CheckActors.cs +++ b/OpenRA.Mods.RA/Lint/CheckActors.cs @@ -24,5 +24,4 @@ namespace OpenRA.Mods.RA emitError("Actor {0} is not defined by any rule.".F(actor)); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Lint/CheckMapCordon.cs b/OpenRA.Mods.RA/Lint/CheckMapCordon.cs index 2e5e9f0572..cc6ffcf09c 100644 --- a/OpenRA.Mods.RA/Lint/CheckMapCordon.cs +++ b/OpenRA.Mods.RA/Lint/CheckMapCordon.cs @@ -21,9 +21,8 @@ namespace OpenRA.Mods.RA if (map.Bounds.Left == 0 || map.Bounds.Top == 0 || map.Bounds.Right == map.MapSize.X || map.Bounds.Bottom == map.MapSize.Y) emitError("This map does not define a valid cordon.\n" - +"A one cell (or greater) border is required on all four sides " - +"between the playable bounds and the map edges"); + + "A one cell (or greater) border is required on all four sides " + + "between the playable bounds and the map edges"); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Lint/CheckMapRules.cs b/OpenRA.Mods.RA/Lint/CheckMapRules.cs index 895a2d4eaa..8f34bb1cf9 100644 --- a/OpenRA.Mods.RA/Lint/CheckMapRules.cs +++ b/OpenRA.Mods.RA/Lint/CheckMapRules.cs @@ -27,5 +27,4 @@ namespace OpenRA.Mods.RA } } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Lint/CheckPlayers.cs b/OpenRA.Mods.RA/Lint/CheckPlayers.cs index 5c5bacd985..6f366535be 100644 --- a/OpenRA.Mods.RA/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.RA/Lint/CheckPlayers.cs @@ -35,5 +35,4 @@ namespace OpenRA.Mods.RA emitError("Invalid race {0} chosen for player {1}.".F(player.Value.Race, player.Value.Name)); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Lint/CheckSequences.cs b/OpenRA.Mods.RA/Lint/CheckSequences.cs index 9c438e7870..0fa416729c 100644 --- a/OpenRA.Mods.RA/Lint/CheckSequences.cs +++ b/OpenRA.Mods.RA/Lint/CheckSequences.cs @@ -19,9 +19,7 @@ namespace OpenRA.Mods.RA { public void Run(Action emitError, Action emitWarning, Map map) { - var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions, - Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)) - .Aggregate(MiniYaml.MergeLiberal)); + var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions, Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); foreach (var actorInfo in map.Rules.Actors) foreach (var renderInfo in actorInfo.Value.Traits.WithInterface()) diff --git a/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs b/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs index 18fbf4c205..e43fe1ae3d 100644 --- a/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs +++ b/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA if (traits.Length == 0) emitWarning("Actor {0} has no traits. Is this intended?".F(actorInfo.Key)); } - catch(Exception e) + catch (Exception e) { emitError("Actor {0} is not constructible; failure: {1}".F(actorInfo.Key, e.Message)); } diff --git a/OpenRA.Mods.RA/Orders/BeaconOrderGenerator.cs b/OpenRA.Mods.RA/Orders/BeaconOrderGenerator.cs index 4b0058f980..9f5c232b0b 100644 --- a/OpenRA.Mods.RA/Orders/BeaconOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/BeaconOrderGenerator.cs @@ -19,7 +19,6 @@ namespace OpenRA.Mods.RA.Orders { if (mi.Button != MouseButton.Left) world.CancelInputMode(); - else if (!world.ShroudObscures(xy)) { world.CancelInputMode(); diff --git a/OpenRA.Mods.RA/Orders/GlobalButtonOrderGenerator.cs b/OpenRA.Mods.RA/Orders/GlobalButtonOrderGenerator.cs index 95daf08be2..0286fa1639 100755 --- a/OpenRA.Mods.RA/Orders/GlobalButtonOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/GlobalButtonOrderGenerator.cs @@ -68,11 +68,11 @@ namespace OpenRA.Mods.RA.Orders public class PowerDownOrderGenerator : GlobalButtonOrderGenerator { - public PowerDownOrderGenerator() : base( "powerdown", "PowerDown" ) { } + public PowerDownOrderGenerator() : base("powerdown", "PowerDown") { } } public class SellOrderGenerator : GlobalButtonOrderGenerator { - public SellOrderGenerator() : base( "sell", "Sell" ) { } + public SellOrderGenerator() : base("sell", "Sell") { } } } diff --git a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs index d8724357e2..499bdedb42 100644 --- a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs @@ -104,6 +104,7 @@ namespace OpenRA.Mods.RA.Orders yield return r; var cells = new Dictionary(); + // Linebuild for walls. // Requires a 1x1 footprint if (rules.Actors[Building].Traits.Contains()) diff --git a/OpenRA.Mods.RA/ParaDrop.cs b/OpenRA.Mods.RA/ParaDrop.cs index 5e4a0ad51d..ea00a39d6b 100644 --- a/OpenRA.Mods.RA/ParaDrop.cs +++ b/OpenRA.Mods.RA/ParaDrop.cs @@ -11,8 +11,8 @@ using System; using System.Collections.Generic; using OpenRA.Mods.RA.Activities; -using OpenRA.Mods.RA.Traits; using OpenRA.Mods.RA.Effects; +using OpenRA.Mods.RA.Traits; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA if (!inDropRange || cargo.IsEmpty(self)) return; - if (droppedAt.Contains(self.Location) || checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location)) + if (droppedAt.Contains(self.Location) || (checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location))) return; if (!self.World.Map.Contains(self.Location)) diff --git a/OpenRA.Mods.RA/Passenger.cs b/OpenRA.Mods.RA/Passenger.cs index 7729972c0f..5e0efab180 100644 --- a/OpenRA.Mods.RA/Passenger.cs +++ b/OpenRA.Mods.RA/Passenger.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA public EnterTransportTargeter(string order, int priority, Func canTarget, Func useEnterCursor, AlternateTransportsMode mode) - : base (order, priority, canTarget, useEnterCursor) { this.mode = mode; } + : base(order, priority, canTarget, useEnterCursor) { this.mode = mode; } public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor) { @@ -58,7 +58,7 @@ namespace OpenRA.Mods.RA public EnterTransportsTargeter(string order, int priority, Func canTarget, Func useEnterCursor, AlternateTransportsMode mode) - : base (order, priority, canTarget, useEnterCursor) { this.mode = mode; } + : base(order, priority, canTarget, useEnterCursor) { this.mode = mode; } public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor) { @@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA case AlternateTransportsMode.Always: break; } + return base.CanTargetActor(self, target, modifiers, ref cursor); } } diff --git a/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs b/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs index f761bfa979..3890eee8a9 100644 --- a/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs +++ b/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs @@ -75,5 +75,4 @@ namespace OpenRA.Mods.RA.Traits lastAttackTime = self.World.WorldTick; } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs b/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs index 3b3e5e564f..8bd623cb62 100644 --- a/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs +++ b/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs @@ -67,5 +67,4 @@ namespace OpenRA.Mods.RA.Traits lastAttackTime = self.World.WorldTick; } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Player/PlaceBuilding.cs b/OpenRA.Mods.RA/Player/PlaceBuilding.cs index 33fe5f6844..ad82c867fe 100644 --- a/OpenRA.Mods.RA/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.RA/Player/PlaceBuilding.cs @@ -39,8 +39,7 @@ namespace OpenRA.Mods.RA if (queue == null) return; - - + var buildingInfo = unit.Traits.Get(); if (order.OrderString == "LineBuild") diff --git a/OpenRA.Mods.RA/Player/PlayerStatistics.cs b/OpenRA.Mods.RA/Player/PlayerStatistics.cs index 21a78dbae9..89a0c8da01 100644 --- a/OpenRA.Mods.RA/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.RA/Player/PlayerStatistics.cs @@ -37,6 +37,7 @@ namespace OpenRA.Mods.RA return player.PlayerActor.Trait().Earned - earnedAtBeginningOfMinute; } } + public Queue EarnedSamples = new Queue(100); int earnedAtBeginningOfMinute; @@ -104,6 +105,7 @@ namespace OpenRA.Mods.RA case "Pong": return; } + if (order.OrderString.StartsWith("Dev")) return; OrderCount++; @@ -132,6 +134,7 @@ namespace OpenRA.Mods.RA attackerStats.UnitsKilled++; defenderStats.UnitsDead++; } + if (self.HasTrait()) { var cost = self.Info.Traits.Get().Cost; diff --git a/OpenRA.Mods.RA/ProximityCaptor.cs b/OpenRA.Mods.RA/ProximityCaptor.cs index 0289740be7..1b343e637b 100644 --- a/OpenRA.Mods.RA/ProximityCaptor.cs +++ b/OpenRA.Mods.RA/ProximityCaptor.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA [Desc("Actor can capture ProximityCapturable actors.")] public class ProximityCaptorInfo : ITraitInfo { - public readonly string[] Types = {}; + public readonly string[] Types = { }; public object Create(ActorInitializer init) { return new ProximityCaptor(this); } } diff --git a/OpenRA.Mods.RA/ProximityCapturable.cs b/OpenRA.Mods.RA/ProximityCapturable.cs index 6a9907ddd7..b9e0cbc722 100644 --- a/OpenRA.Mods.RA/ProximityCapturable.cs +++ b/OpenRA.Mods.RA/ProximityCapturable.cs @@ -70,7 +70,8 @@ namespace OpenRA.Mods.RA // no.. So find a new one var captor = GetInRange(self); - if (captor != null) // got one + // got one + if (captor != null) { ChangeOwnership(self, captor); return; diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs index d5d2a4baf3..ef4bd17086 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Traits public override void Tick(Actor self) { base.Tick(self); - if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any( a => a != self )) + if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any(a => a != self)) { isOpen = false; roof.PlayBackwardsThen(NormalizeSequence(self, "build-top"), diff --git a/OpenRA.Mods.RA/Render/RenderHarvester.cs b/OpenRA.Mods.RA/Render/RenderHarvester.cs index c98823c35f..6e812c6674 100644 --- a/OpenRA.Mods.RA/Render/RenderHarvester.cs +++ b/OpenRA.Mods.RA/Render/RenderHarvester.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Traits { class RenderHarvesterInfo : RenderUnitInfo, Requires { - public readonly string[] ImagesByFullness = {"harv"}; + public readonly string[] ImagesByFullness = { "harv" }; public override object Create(ActorInitializer init) { return new RenderHarvester(init.self, this); } } @@ -58,4 +58,4 @@ namespace OpenRA.Mods.RA.Traits public void MovingToRefinery(Actor self, CPos targetCell, Activity next) { } public void MovementCancelled(Actor self) { } } -} \ No newline at end of file +} diff --git a/OpenRA.Mods.RA/Render/RenderInfantry.cs b/OpenRA.Mods.RA/Render/RenderInfantry.cs index a953cace2a..cd1989147b 100644 --- a/OpenRA.Mods.RA/Render/RenderInfantry.cs +++ b/OpenRA.Mods.RA/Render/RenderInfantry.cs @@ -11,8 +11,8 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Graphics; -using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Graphics; +using OpenRA.Mods.Common.Traits; using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits diff --git a/OpenRA.Mods.RA/Render/WithActiveAnimation.cs b/OpenRA.Mods.RA/Render/WithActiveAnimation.cs index cfd6148893..986bc88075 100644 --- a/OpenRA.Mods.RA/Render/WithActiveAnimation.cs +++ b/OpenRA.Mods.RA/Render/WithActiveAnimation.cs @@ -67,6 +67,7 @@ namespace OpenRA.Mods.RA.Traits { buildComplete = false; } + public void Sold(Actor self) { } } -} \ No newline at end of file +} diff --git a/OpenRA.Mods.RA/Render/WithBarrel.cs b/OpenRA.Mods.RA/Render/WithBarrel.cs index 86482894a2..e2c35170fd 100644 --- a/OpenRA.Mods.RA/Render/WithBarrel.cs +++ b/OpenRA.Mods.RA/Render/WithBarrel.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.RA.Traits var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero; var quantizedBody = body.QuantizeOrientation(self, self.Orientation); - var quantizedTurret = body.QuantizeOrientation(self, turretOrientation); + var quantizedTurret = body.QuantizeOrientation(self, turretOrientation); return turretOffset + body.LocalToWorld(localOffset.Rotate(quantizedTurret).Rotate(quantizedBody)); } diff --git a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs index 494983bdd3..258e390039 100644 --- a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs @@ -87,6 +87,7 @@ namespace OpenRA.Mods.RA.Traits { buildComplete = false; } + public void OnTransform(Actor self) { } public void AfterTransform(Actor self) { } @@ -95,4 +96,4 @@ namespace OpenRA.Mods.RA.Traits overlay.ReplaceAnim(RenderSprites.NormalizeSequence(overlay, e.DamageState, overlay.CurrentSequence.Name)); } } -} \ No newline at end of file +} diff --git a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs index 3d38dc75bf..6f090195a3 100644 --- a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs +++ b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Traits { var barrel = b; var turreted = self.TraitsImplementing() - .FirstOrDefault(t => t.Name == arm.Info.Turret); + .FirstOrDefault(t => t.Name == arm.Info.Turret); // Workaround for broken ternary operators in certain versions of mono (3.10 and // certain versions of the 3.8 series): https://bugzilla.xamarin.com/show_bug.cgi?id=23319 diff --git a/OpenRA.Mods.RA/Render/WithTurret.cs b/OpenRA.Mods.RA/Render/WithTurret.cs index 4df64128cd..a376244dab 100755 --- a/OpenRA.Mods.RA/Render/WithTurret.cs +++ b/OpenRA.Mods.RA/Render/WithTurret.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Traits if (!info.Recoils) return t.Position(self); - var recoil = arms.Aggregate(WRange.Zero, (a,b) => a + b.Recoil); + var recoil = arms.Aggregate(WRange.Zero, (a, b) => a + b.Recoil); var localOffset = new WVec(-recoil, WRange.Zero, WRange.Zero); var bodyOrientation = body.QuantizeOrientation(self, self.Orientation); var turretOrientation = body.QuantizeOrientation(self, t.LocalOrientation(self)); @@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Traits anim.ReplaceAnim(sequence); } - static public int ZOffsetFromCenter(Actor self, WPos pos, int offset) + public static int ZOffsetFromCenter(Actor self, WPos pos, int offset) { var delta = self.CenterPosition - pos; return delta.Y + delta.Z + offset; diff --git a/OpenRA.Mods.RA/RenderDetectionCircle.cs b/OpenRA.Mods.RA/RenderDetectionCircle.cs index 6af05e9036..a6a1ef07a9 100644 --- a/OpenRA.Mods.RA/RenderDetectionCircle.cs +++ b/OpenRA.Mods.RA/RenderDetectionCircle.cs @@ -37,8 +37,7 @@ namespace OpenRA.Mods.RA.Traits WRange.FromCells(self.Info.Traits.Get().Range), 0, Color.FromArgb(128, Color.LimeGreen), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); } } } diff --git a/OpenRA.Mods.RA/RenderJammerCircle.cs b/OpenRA.Mods.RA/RenderJammerCircle.cs index 37d9e8a105..e6c3809279 100644 --- a/OpenRA.Mods.RA/RenderJammerCircle.cs +++ b/OpenRA.Mods.RA/RenderJammerCircle.cs @@ -87,5 +87,4 @@ namespace OpenRA.Mods.RA.Traits } } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/RenderRangeCircle.cs b/OpenRA.Mods.RA/RenderRangeCircle.cs index d0626e6891..5db5e34aff 100644 --- a/OpenRA.Mods.RA/RenderRangeCircle.cs +++ b/OpenRA.Mods.RA/RenderRangeCircle.cs @@ -42,8 +42,7 @@ namespace OpenRA.Mods.RA.Traits range, 0, Color.FromArgb(128, Color.Yellow), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); foreach (var a in w.ActorsWithTrait()) if (a.Actor.Owner == a.Actor.World.LocalPlayer) @@ -76,8 +75,7 @@ namespace OpenRA.Mods.RA.Traits attack.GetMaximumRange(), 0, Color.FromArgb(128, Color.Yellow), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); } } } diff --git a/OpenRA.Mods.RA/RenderShroudCircle.cs b/OpenRA.Mods.RA/RenderShroudCircle.cs index 825faaf5a4..58fb73e371 100644 --- a/OpenRA.Mods.RA/RenderShroudCircle.cs +++ b/OpenRA.Mods.RA/RenderShroudCircle.cs @@ -26,8 +26,7 @@ namespace OpenRA.Mods.RA.Traits ai.Traits.Get().Range, 0, Color.FromArgb(128, Color.Cyan), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); foreach (var a in w.ActorsWithTrait()) if (a.Actor.Owner == a.Actor.World.LocalPlayer) @@ -54,9 +53,7 @@ namespace OpenRA.Mods.RA.Traits self.Info.Traits.Get().Range, 0, Color.FromArgb(128, Color.Cyan), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Repairable.cs b/OpenRA.Mods.RA/Repairable.cs index 864477b3b7..ea05aa79a2 100644 --- a/OpenRA.Mods.RA/Repairable.cs +++ b/OpenRA.Mods.RA/Repairable.cs @@ -44,23 +44,23 @@ namespace OpenRA.Mods.RA.Traits target => CanRepairAt(target), _ => CanRepair()); } } - public Order IssueOrder( Actor self, IOrderTargeter order, Target target, bool queued ) + public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) { - if( order.OrderID == "Repair" ) + if (order.OrderID == "Repair") return new Order(order.OrderID, self, queued) { TargetActor = target.Actor }; return null; } - bool CanRepairAt( Actor target ) + bool CanRepairAt(Actor target) { - return self.Info.Traits.Get().RepairBuildings.Contains( target.Info.Name ); + return self.Info.Traits.Get().RepairBuildings.Contains(target.Info.Name); } bool CanRepair() { var li = self.TraitOrDefault(); - return (Health.DamageState > DamageState.Undamaged || (li != null && !li.FullAmmo()) ); + return Health.DamageState > DamageState.Undamaged || (li != null && !li.FullAmmo()); } public string VoicePhraseForOrder(Actor self, Order order) diff --git a/OpenRA.Mods.RA/RepairableNear.cs b/OpenRA.Mods.RA/RepairableNear.cs index 4ff48107bc..284ec445a7 100644 --- a/OpenRA.Mods.RA/RepairableNear.cs +++ b/OpenRA.Mods.RA/RepairableNear.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Traits [ActorReference] public readonly string[] Buildings = { "spen", "syrd" }; public readonly int CloseEnough = 4; /* cells */ - public object Create( ActorInitializer init ) { return new RepairableNear( init.self, this ); } + public object Create(ActorInitializer init) { return new RepairableNear(init.self, this); } } class RepairableNear : IIssueOrder, IResolveOrder @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Traits readonly Actor self; readonly RepairableNearInfo info; - public RepairableNear( Actor self, RepairableNearInfo info ) { this.self = self; this.info = info; } + public RepairableNear(Actor self, RepairableNearInfo info) { this.self = self; this.info = info; } public IEnumerable Orders { @@ -42,17 +42,17 @@ namespace OpenRA.Mods.RA.Traits } } - public Order IssueOrder( Actor self, IOrderTargeter order, Target target, bool queued ) + public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) { - if( order.OrderID == "RepairNear" ) + if (order.OrderID == "RepairNear") return new Order(order.OrderID, self, queued) { TargetActor = target.Actor }; return null; } - bool CanRepairAt( Actor target ) + bool CanRepairAt(Actor target) { - return info.Buildings.Contains( target.Info.Name ); + return info.Buildings.Contains(target.Info.Name); } bool ShouldRepair() @@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA.Traits var target = Target.FromOrder(self.World, order); self.CancelActivity(); - self.QueueActivity(movement.MoveWithinRange(target, new WRange(1024*info.CloseEnough))); + self.QueueActivity(movement.MoveWithinRange(target, new WRange(1024 * info.CloseEnough))); self.QueueActivity(new Repair(order.TargetActor)); self.SetTargetLine(target, Color.Green, false); diff --git a/OpenRA.Mods.RA/Scripting/Global/ReinforcementsGlobal.cs b/OpenRA.Mods.RA/Scripting/Global/ReinforcementsGlobal.cs index 29b716e75f..2c0f4c66b8 100644 --- a/OpenRA.Mods.RA/Scripting/Global/ReinforcementsGlobal.cs +++ b/OpenRA.Mods.RA/Scripting/Global/ReinforcementsGlobal.cs @@ -8,10 +8,10 @@ */ #endregion -using Eluant; using System; using System.Collections.Generic; using System.Linq; +using Eluant; using OpenRA; using OpenRA.Activities; using OpenRA.Effects; diff --git a/OpenRA.Mods.RA/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/CombatProperties.cs index 47c261cbef..8a5ea4565e 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/CombatProperties.cs @@ -8,9 +8,9 @@ */ #endregion -using Eluant; using System; using System.Linq; +using Eluant; using OpenRA.Activities; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.RA.Activities; diff --git a/OpenRA.Mods.RA/Scripting/Properties/HarvesterProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/HarvesterProperties.cs index 4f27c8caf4..42e51c79cf 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/HarvesterProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/HarvesterProperties.cs @@ -8,8 +8,8 @@ */ #endregion -using OpenRA.Scripting; using OpenRA.Mods.RA.Traits; +using OpenRA.Scripting; using OpenRA.Traits; namespace OpenRA.Mods.RA.Scripting diff --git a/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs index 954c8f113f..993ff4aab1 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs @@ -11,8 +11,8 @@ using System; using System.Linq; using Eluant; -using OpenRA.Scripting; using OpenRA.Mods.RA.Traits; +using OpenRA.Scripting; namespace OpenRA.Mods.RA.Scripting { diff --git a/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs index ddcbdfbfba..fabd0aca88 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs @@ -8,10 +8,10 @@ */ #endregion -using Eluant; using System; using System.Collections.Generic; using System.Linq; +using Eluant; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Scripting; using OpenRA.Mods.Common.Traits; diff --git a/OpenRA.Mods.RA/SelfHealing.cs b/OpenRA.Mods.RA/SelfHealing.cs index 3a04785e1e..381efc10bf 100644 --- a/OpenRA.Mods.RA/SelfHealing.cs +++ b/OpenRA.Mods.RA/SelfHealing.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA [Sync] int damageTicks; public SelfHealing(Actor self, SelfHealingInfo info) - : base (info) + : base(info) { health = self.Trait(); } diff --git a/OpenRA.Mods.RA/Sellable.cs b/OpenRA.Mods.RA/Sellable.cs index 34de9f7cd6..39e021afac 100644 --- a/OpenRA.Mods.RA/Sellable.cs +++ b/OpenRA.Mods.RA/Sellable.cs @@ -15,7 +15,6 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { - [Desc("Actor can be sold")] public class SellableInfo : UpgradableTraitInfo, ITraitInfo { diff --git a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs index db83ae96b1..ef2277c82b 100644 --- a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs @@ -164,8 +164,7 @@ namespace OpenRA.Mods.RA.Traits Info.BeaconPalettePrefix, Info.BeaconPoster, Info.BeaconPosterPalette, - () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance - ); + () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance); w.Add(beacon); } diff --git a/OpenRA.Mods.RA/SupportPowers/NukePower.cs b/OpenRA.Mods.RA/SupportPowers/NukePower.cs index a2dc1c61ac..c1c1c21903 100755 --- a/OpenRA.Mods.RA/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/NukePower.cs @@ -110,10 +110,8 @@ namespace OpenRA.Mods.RA.Traits Info.BeaconPalettePrefix, Info.BeaconPoster, Info.BeaconPosterPalette, - () => missile.FractionComplete - ); - - + () => missile.FractionComplete); + Action removeBeacon = () => self.World.AddFrameEndTask(w => { w.Remove(beacon); diff --git a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs index 3bb3211c7f..e1de2258a7 100644 --- a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits [ActorReference] [Desc("Troops to be delivered. They will be distributed between the planes if SquadSize > 1.")] - public string[] DropItems = { }; + public readonly string[] DropItems = { }; [Desc("Risks stuck units when they don't have the Paratrooper trait.")] public readonly bool AllowImpassableCells = false; @@ -184,8 +184,7 @@ namespace OpenRA.Mods.RA.Traits Info.BeaconPalettePrefix, Info.BeaconPoster, Info.BeaconPosterPalette, - () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance - ); + () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance); w.Add(beacon); } diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPower.cs b/OpenRA.Mods.RA/SupportPowers/SupportPower.cs index f72425fe25..be28949ebf 100755 --- a/OpenRA.Mods.RA/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPower.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Traits public readonly string LongDesc = ""; public readonly bool AllowMultiple = false; public readonly bool OneShot = false; - public readonly string[] Prerequisites = {}; + public readonly string[] Prerequisites = { }; public readonly string BeginChargeSound = null; public readonly string EndChargeSound = null; diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs index 2e5acb3fa0..86c279d486 100644 --- a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs @@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Traits if (Manager.DevMode.FastCharge && RemainingTime > 25) RemainingTime = 25; - if (RemainingTime > 0) --RemainingTime; + if (RemainingTime > 0) + --RemainingTime; if (!notifiedCharging) { power.Charging(power.self, Key); diff --git a/OpenRA.Mods.RA/TakeCover.cs b/OpenRA.Mods.RA/TakeCover.cs index 535a286ce6..e5895c1497 100644 --- a/OpenRA.Mods.RA/TakeCover.cs +++ b/OpenRA.Mods.RA/TakeCover.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Traits bool isProne { get { return remainingProneTime > 0; } } public bool IsModifyingSequence { get { return isProne; } } - public string SequencePrefix { get { return info.ProneSequencePrefix ; } } + public string SequencePrefix { get { return info.ProneSequencePrefix; } } public TakeCover(ActorInitializer init, TakeCoverInfo info) : base(init, info) @@ -46,7 +46,8 @@ namespace OpenRA.Mods.RA.Traits public void Damaged(Actor self, AttackInfo e) { - if (e.Damage > 0 && (e.Warhead == null || !e.Warhead.PreventProne)) /* Don't go prone when healed */ + /* Don't go prone when healed */ + if (e.Damage > 0 && (e.Warhead == null || !e.Warhead.PreventProne)) { if (!isProne) localOffset = info.ProneOffset; diff --git a/OpenRA.Mods.RA/ThrowsParticle.cs b/OpenRA.Mods.RA/ThrowsParticle.cs index c2b958d143..bdfa318508 100644 --- a/OpenRA.Mods.RA/ThrowsParticle.cs +++ b/OpenRA.Mods.RA/ThrowsParticle.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA.Traits var body = self.Trait(); // TODO: Carry orientation over from the parent instead of just facing - var bodyFacing = init.Contains() ? init.Get() : 0; + var bodyFacing = init.Contains() ? init.Get() : 0; facing = Turreted.GetInitialTurretFacing(init, 0); // Calculate final position diff --git a/OpenRA.Mods.RA/Traits/AcceptsSupplies.cs b/OpenRA.Mods.RA/Traits/AcceptsSupplies.cs index a755eb5c2b..891ee18421 100644 --- a/OpenRA.Mods.RA/Traits/AcceptsSupplies.cs +++ b/OpenRA.Mods.RA/Traits/AcceptsSupplies.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { [Desc("Tag trait for SupplyTruck: actors.")] - class AcceptsSuppliesInfo : TraitInfo {} + class AcceptsSuppliesInfo : TraitInfo { } - class AcceptsSupplies {} + class AcceptsSupplies { } } diff --git a/OpenRA.Mods.RA/Traits/Air/Aircraft.cs b/OpenRA.Mods.RA/Traits/Air/Aircraft.cs index 6807bc10eb..c6c83a397b 100644 --- a/OpenRA.Mods.RA/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Traits/Air/Aircraft.cs @@ -176,6 +176,7 @@ namespace OpenRA.Mods.RA.Traits { SetPosition(self, self.World.Map.CenterOfCell(cell) + new WVec(0, 0, CenterPosition.Z)); } + public void SetVisualPosition(Actor self, WPos pos) { SetPosition(self, pos); } public void AddedToWorld(Actor self) diff --git a/OpenRA.Mods.RA/Traits/Air/Plane.cs b/OpenRA.Mods.RA/Traits/Air/Plane.cs index 2e7c7d6313..28ba03c1a9 100644 --- a/OpenRA.Mods.RA/Traits/Air/Plane.cs +++ b/OpenRA.Mods.RA/Traits/Air/Plane.cs @@ -70,6 +70,7 @@ namespace OpenRA.Mods.RA.Traits return WVec.Zero; var dot = WVec.Dot(currentDir, repulsionForce) / length; + // avoid stalling the plane return dot >= 0 ? repulsionForce : WVec.Zero; } diff --git a/OpenRA.Mods.RA/Traits/Buildings/OreRefinery.cs b/OpenRA.Mods.RA/Traits/Buildings/OreRefinery.cs index 1fd8572c15..c1d8cc6321 100644 --- a/OpenRA.Mods.RA/Traits/Buildings/OreRefinery.cs +++ b/OpenRA.Mods.RA/Traits/Buildings/OreRefinery.cs @@ -114,10 +114,11 @@ namespace OpenRA.Mods.RA.Traits { if (!preventDock) { - harv.QueueActivity(new CallFunc( () => dockedHarv = harv, false)); + harv.QueueActivity(new CallFunc(() => dockedHarv = harv, false)); harv.QueueActivity(DockSequence(harv, self)); - harv.QueueActivity(new CallFunc( () => dockedHarv = null, false)); + harv.QueueActivity(new CallFunc(() => dockedHarv = null, false)); } + harv.QueueActivity(new CallFunc(() => harv.Trait().ContinueHarvesting(harv))); } diff --git a/OpenRA.Mods.RA/Traits/Buildings/PrimaryBuilding.cs b/OpenRA.Mods.RA/Traits/Buildings/PrimaryBuilding.cs index 4c46100604..f33b26b3a1 100644 --- a/OpenRA.Mods.RA/Traits/Buildings/PrimaryBuilding.cs +++ b/OpenRA.Mods.RA/Traits/Buildings/PrimaryBuilding.cs @@ -8,10 +8,10 @@ */ #endregion -using System.Linq; using System.Collections.Generic; -using OpenRA.Traits; +using System.Linq; using OpenRA.Mods.Common.Orders; +using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { diff --git a/OpenRA.Mods.RA/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Traits/Buildings/RepairableBuilding.cs index f19dcb0403..dbf0743f56 100644 --- a/OpenRA.Mods.RA/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Traits/Buildings/RepairableBuilding.cs @@ -12,8 +12,8 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using OpenRA.Mods.RA.Effects; using OpenRA.Mods.Common.Traits; +using OpenRA.Mods.RA.Effects; using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Traits public bool RepairActive = false; public RepairableBuilding(Actor self, RepairableBuildingInfo info) - : base (info) + : base(info) { Health = self.Trait(); } diff --git a/OpenRA.Mods.RA/Traits/Buildings/Reservable.cs b/OpenRA.Mods.RA/Traits/Buildings/Reservable.cs index f00800a0d9..37e4b47fda 100644 --- a/OpenRA.Mods.RA/Traits/Buildings/Reservable.cs +++ b/OpenRA.Mods.RA/Traits/Buildings/Reservable.cs @@ -38,11 +38,10 @@ namespace OpenRA.Mods.RA.Traits // NOTE: we really dont care about the GC eating DisposableActions that apply to a world *other* than // the one we're playing in. - return new DisposableAction( () => { reservedFor = null; reservedForAircraft = null; }, () => Game.RunAfterTick( - () => { if (Game.IsCurrentWorld( self.World )) throw new InvalidOperationException( + () => { if (Game.IsCurrentWorld(self.World)) throw new InvalidOperationException( "Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})" .F(forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID)); })); } diff --git a/OpenRA.Mods.RA/Traits/Cloak.cs b/OpenRA.Mods.RA/Traits/Cloak.cs index 5ec80675cb..0e086e7141 100644 --- a/OpenRA.Mods.RA/Traits/Cloak.cs +++ b/OpenRA.Mods.RA/Traits/Cloak.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Traits CPos? lastPos; public Cloak(Actor self, CloakInfo info) - : base (info) + : base(info) { this.self = self; diff --git a/OpenRA.Mods.RA/Traits/DemoTruck.cs b/OpenRA.Mods.RA/Traits/DemoTruck.cs index 0e03669503..09bdf56501 100644 --- a/OpenRA.Mods.RA/Traits/DemoTruck.cs +++ b/OpenRA.Mods.RA/Traits/DemoTruck.cs @@ -8,8 +8,8 @@ */ #endregion -using System.Drawing; using System.Collections.Generic; +using System.Drawing; using OpenRA.Activities; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Orders; @@ -68,7 +68,6 @@ namespace OpenRA.Mods.RA.Traits self.QueueActivity(new MoveAdjacentTo(self, target)); self.QueueActivity(new CallFunc(() => Explode(self))); } - else if (order.OrderString == "Detonate") Explode(self); } diff --git a/OpenRA.Mods.RA/Traits/Harvester.cs b/OpenRA.Mods.RA/Traits/Harvester.cs index 225a5cf76e..ae3b814d5e 100644 --- a/OpenRA.Mods.RA/Traits/Harvester.cs +++ b/OpenRA.Mods.RA/Traits/Harvester.cs @@ -13,8 +13,8 @@ using System.Drawing; using System.Linq; using OpenRA.Activities; using OpenRA.Mods.Common.Activities; -using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Orders; +using OpenRA.Mods.Common.Traits; using OpenRA.Mods.RA.Activities; using OpenRA.Traits; @@ -47,6 +47,7 @@ namespace OpenRA.Mods.RA.Traits IExplodeModifier, IOrderVoice, ISpeedModifier, ISync, INotifyResourceClaimLost, INotifyIdle, INotifyBlockingMove { + readonly HarvesterInfo Info; Dictionary contents = new Dictionary(); [Sync] public Actor OwnerLinkedProc = null; @@ -56,7 +57,6 @@ namespace OpenRA.Mods.RA.Traits public CPos? LastHarvestedCell = null; public CPos? LastOrderLocation = null; [Sync] public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit * c.Value); } } - readonly HarvesterInfo Info; bool idleSmart = true; public Harvester(Actor self, HarvesterInfo info) @@ -118,8 +118,7 @@ namespace OpenRA.Mods.RA.Traits from r in self.World.ActorsWithTrait() where r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor) let linkedHarvs = self.World.ActorsWithTrait().Where(a => a.Trait.LinkedProc == r.Actor).Count() - select new { Location = r.Actor.Location + r.Trait.DeliverOffset, Actor = r.Actor, Occupancy = linkedHarvs } - ).ToDictionary(r => r.Location); + select new { Location = r.Actor.Location + r.Trait.DeliverOffset, Actor = r.Actor, Occupancy = linkedHarvs }).ToDictionary(r => r.Location); // Start a search from each refinery's delivery location: var mi = self.Info.Traits.Get(); @@ -130,13 +129,13 @@ namespace OpenRA.Mods.RA.Traits if (!refs.ContainsKey(loc)) return 0; var occupancy = refs[loc].Occupancy; + // 4 harvesters clogs up the refinery's delivery location: if (occupancy >= 3) return int.MaxValue; // Prefer refineries with less occupancy (multiplier is to offset distance cost): return occupancy * 12; - }) - ); + })); // Reverse the found-path to find the refinery location instead of our location: path.Reverse(); @@ -192,6 +191,7 @@ namespace OpenRA.Mods.RA.Traits { // I'm blocking someone else from moving to my location: var act = self.GetCurrentActivity(); + // If I'm just waiting around then get out of the way: if (act is Wait) { @@ -319,6 +319,7 @@ namespace OpenRA.Mods.RA.Traits { // A bot order gives us a CPos.Zero TargetLocation, so find some good resources for him: var loc = FindNextResourceForBot(self); + // No more resources? Oh well. if (!loc.HasValue) return; @@ -386,6 +387,7 @@ namespace OpenRA.Mods.RA.Traits var resType = resLayer.GetResource(loc); if (resType == null) return 1; + // Can the harvester collect this kind of resource? if (!harvInfo.Resources.Contains(resType.Info.Name)) return 1; @@ -398,8 +400,7 @@ namespace OpenRA.Mods.RA.Traits return 0; }) - .FromPoint(self.Location) - ); + .FromPoint(self.Location)); if (path.Count == 0) return (CPos?)null; @@ -459,6 +460,7 @@ namespace OpenRA.Mods.RA.Traits return false; var location = self.World.Map.CellContaining(target.CenterPosition); + // Don't leak info about resources under the shroud if (!self.Owner.Shroud.IsExplored(location)) return false; diff --git a/OpenRA.Mods.RA/Traits/HarvesterHuskModifier.cs b/OpenRA.Mods.RA/Traits/HarvesterHuskModifier.cs index 81e4cbdb15..caeae1f197 100644 --- a/OpenRA.Mods.RA/Traits/HarvesterHuskModifier.cs +++ b/OpenRA.Mods.RA/Traits/HarvesterHuskModifier.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits public readonly string FullHuskActor = null; public readonly int FullnessThreshold = 50; - public object Create( ActorInitializer init ) { return new HarvesterHuskModifier(this); } + public object Create(ActorInitializer init) { return new HarvesterHuskModifier(this); } } public class HarvesterHuskModifier : IHuskModifier diff --git a/OpenRA.Mods.RA/Traits/MadTank.cs b/OpenRA.Mods.RA/Traits/MadTank.cs index 569591c844..cf2d412c2e 100644 --- a/OpenRA.Mods.RA/Traits/MadTank.cs +++ b/OpenRA.Mods.RA/Traits/MadTank.cs @@ -8,9 +8,9 @@ */ #endregion -using System.Linq; -using System.Drawing; using System.Collections.Generic; +using System.Drawing; +using System.Linq; using OpenRA.Activities; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Orders; @@ -72,9 +72,11 @@ namespace OpenRA.Mods.RA.Traits if (info.ThumpDamageWeapon != null) { var weapon = self.World.Map.Rules.Weapons[info.ThumpDamageWeapon.ToLowerInvariant()]; + // Use .FromPos since this weapon needs to affect more than just the MadTank actor weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty()); } + screenShaker.AddEffect(info.ThumpShakeTime, self.CenterPosition, info.ThumpShakeIntensity, info.ThumpShakeMultiplier); tick = 0; } @@ -112,9 +114,11 @@ namespace OpenRA.Mods.RA.Traits if (info.DetonationWeapon != null) { var weapon = self.World.Map.Rules.Weapons[info.DetonationWeapon.ToLowerInvariant()]; + // Use .FromPos since this actor is killed. Cannot use Target.FromActor weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty()); } + self.Kill(self); }); } @@ -164,7 +168,6 @@ namespace OpenRA.Mods.RA.Traits self.QueueActivity(new MoveAdjacentTo(self, target)); self.QueueActivity(new CallFunc(StartDetonationSequence)); } - else if (order.OrderString == "Detonate") { self.CancelActivity(); diff --git a/OpenRA.Mods.RA/Traits/Mine.cs b/OpenRA.Mods.RA/Traits/Mine.cs index b74a41a018..d51ba1c362 100644 --- a/OpenRA.Mods.RA/Traits/Mine.cs +++ b/OpenRA.Mods.RA/Traits/Mine.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits this.info = info; } - public void WarnCrush(Actor crusher) {} + public void WarnCrush(Actor crusher) { } public void OnCrush(Actor crusher) { diff --git a/OpenRA.Mods.RA/Traits/Minelayer.cs b/OpenRA.Mods.RA/Traits/Minelayer.cs index 525d6e51ba..5a81415c80 100644 --- a/OpenRA.Mods.RA/Traits/Minelayer.cs +++ b/OpenRA.Mods.RA/Traits/Minelayer.cs @@ -9,8 +9,8 @@ #endregion using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.Common.Orders; using OpenRA.Mods.RA.Activities; diff --git a/OpenRA.Mods.RA/Traits/Mobile.cs b/OpenRA.Mods.RA/Traits/Mobile.cs index 504c918970..18e2aab377 100644 --- a/OpenRA.Mods.RA/Traits/Mobile.cs +++ b/OpenRA.Mods.RA/Traits/Mobile.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits TransientActors, BlockedByMovers, All = TransientActors | BlockedByMovers - }; + } [Desc("Unit is able to move.")] public class MobileInfo : ITraitInfo, IOccupySpaceInfo, IFacingInfo, IMoveInfo, UsesInit, UsesInit, UsesInit @@ -159,7 +159,7 @@ namespace OpenRA.Mods.RA.Traits if (otherMobile == null) return false; // Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions: - var dp = CVec.Dot((selfMobile.toCell - self.Location), (otherMobile.toCell - other.Location)); + var dp = CVec.Dot(selfMobile.toCell - self.Location, otherMobile.toCell - other.Location); if (dp <= 0) return false; return true; @@ -177,7 +177,7 @@ namespace OpenRA.Mods.RA.Traits { var canIgnoreMovingAllies = self != null && !check.HasFlag(CellConditions.BlockedByMovers); var needsCellExclusively = self == null || Crushes == null || !Crushes.Any(); - foreach(var a in world.ActorMap.GetUnitsAt(cell)) + foreach (var a in world.ActorMap.GetUnitsAt(cell)) { if (a == ignoreActor) continue; @@ -239,7 +239,7 @@ namespace OpenRA.Mods.RA.Traits } if (!SharesCell) - return world.ActorMap.AnyUnitsAt(cell, SubCell.FullCell)? SubCell.Invalid : SubCell.FullCell; + return world.ActorMap.AnyUnitsAt(cell, SubCell.FullCell) ? SubCell.Invalid : SubCell.FullCell; return world.ActorMap.FreeSubCell(cell, preferredSubCell); } @@ -257,8 +257,6 @@ namespace OpenRA.Mods.RA.Traits CPos __fromCell, __toCell; public SubCell fromSubCell, toSubCell; - //int __altitude; - [Sync] public int Facing { get { return __facing; } @@ -333,6 +331,7 @@ namespace OpenRA.Mods.RA.Traits if (preferred != SubCell.FullCell) return SubCell.FullCell; } + return preferred; } @@ -388,6 +387,7 @@ namespace OpenRA.Mods.RA.Traits return new Order("Move", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) }; } + return null; } @@ -504,7 +504,7 @@ namespace OpenRA.Mods.RA.Traits public SubCell GetAvailableSubCell(CPos a, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, bool checkTransientActors = true) { - return Info.GetAvailableSubCell(self.World, self, a, preferredSubCell, ignoreActor, checkTransientActors? CellConditions.All : CellConditions.None); + return Info.GetAvailableSubCell(self.World, self, a, preferredSubCell, ignoreActor, checkTransientActors ? CellConditions.All : CellConditions.None); } public bool CanEnterCell(CPos cell, Actor ignoreActor = null, bool checkTransientActors = true) diff --git a/OpenRA.Mods.RA/Traits/PortableChrono.cs b/OpenRA.Mods.RA/Traits/PortableChrono.cs index 949ade55e1..4795a721e3 100644 --- a/OpenRA.Mods.RA/Traits/PortableChrono.cs +++ b/OpenRA.Mods.RA/Traits/PortableChrono.cs @@ -8,8 +8,8 @@ */ #endregion -using System.Drawing; using System.Collections.Generic; +using System.Drawing; using OpenRA.Graphics; using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Orders; @@ -130,6 +130,7 @@ namespace OpenRA.Mods.RA.Traits cursor = "chrono-target"; return true; } + return false; } @@ -186,8 +187,7 @@ namespace OpenRA.Mods.RA.Traits WRange.FromCells(self.Trait().Info.MaxDistance), 0, Color.FromArgb(128, Color.LawnGreen), - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); } public string GetCursor(World world, CPos xy, MouseInput mi) diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs index 4f2ee9f45d..ca64de2bed 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Traits public readonly int Duration = 30; public readonly bool KillCargo = true; - public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.self,this); } + public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.self, this); } } class ChronoshiftPower : SupportPower @@ -255,19 +255,21 @@ namespace OpenRA.Mods.RA.Traits foreach (var unit in power.UnitsInRange(sourceLocation)) { var targetCell = unit.Location + (xy - sourceLocation); - if (manager.self.Owner.Shroud.IsExplored(targetCell) && unit.Trait().CanChronoshiftTo(unit,targetCell)) + if (manager.self.Owner.Shroud.IsExplored(targetCell) && unit.Trait().CanChronoshiftTo(unit, targetCell)) { canTeleport = true; break; } } + if (!canTeleport) { // Check the terrain types. This will allow chronoshifts to occur on empty terrain to terrain of // a similar type. This also keeps the cursor from changing in non-visible property, alerting the // chronoshifter of enemy unit presence - canTeleport = power.SimilarTerrain(sourceLocation,xy); + canTeleport = power.SimilarTerrain(sourceLocation, xy); } + return canTeleport; } diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs index e67bfec052..9a20bc1cbd 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits [Desc("Required for GpsPower. Attach this to the player actor.")] class GpsWatcherInfo : ITraitInfo { - public object Create (ActorInitializer init) { return new GpsWatcher(init.self.Owner); } + public object Create(ActorInitializer init) { return new GpsWatcher(init.self.Owner); } } class GpsWatcher : ISync, IFogVisibilityModifier @@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA.Traits void RefreshGranted() { - Granted = (actors.Count > 0 && Launched); + Granted = actors.Count > 0 && Launched; GrantedAllies = owner.World.ActorsWithTrait().Any(p => p.Actor.Owner.IsAlliedWith(owner) && p.Trait.Granted); if (Granted || GrantedAllies) @@ -119,7 +119,7 @@ namespace OpenRA.Mods.RA.Traits public void Killed(Actor self, AttackInfo e) { RemoveGps(self); } - public void Selling(Actor self) {} + public void Selling(Actor self) { } public void Sold(Actor self) { RemoveGps(self); } void RemoveGps(Actor self) diff --git a/OpenRA.Mods.RA/Traits/TargetableSubmarine.cs b/OpenRA.Mods.RA/Traits/TargetableSubmarine.cs index c01561a577..7b3718f804 100644 --- a/OpenRA.Mods.RA/Traits/TargetableSubmarine.cs +++ b/OpenRA.Mods.RA/Traits/TargetableSubmarine.cs @@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA.Traits { public class TargetableSubmarineInfo : TargetableUnitInfo, Requires { - public readonly string[] CloakedTargetTypes = {}; + public readonly string[] CloakedTargetTypes = { }; public override object Create(ActorInitializer init) { return new TargetableSubmarine(init.self, this); } } @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Traits public override string[] TargetTypes { get { return cloak.Cloaked ? info.CloakedTargetTypes - : info.TargetTypes;} + : info.TargetTypes; } } } } diff --git a/OpenRA.Mods.RA/Traits/World/DomainIndex.cs b/OpenRA.Mods.RA/Traits/World/DomainIndex.cs index ef840c1a3a..0ae87bec53 100644 --- a/OpenRA.Mods.RA/Traits/World/DomainIndex.cs +++ b/OpenRA.Mods.RA/Traits/World/DomainIndex.cs @@ -13,14 +13,14 @@ using System.Diagnostics; using System.Drawing; using System.Linq; using OpenRA.Graphics; -using OpenRA.Traits; using OpenRA.Support; +using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { [Desc("Identify untraversable regions of the map for faster pathfinding, especially with AI.", "This trait is required. Every mod needs it attached to the world actor.")] - class DomainIndexInfo : TraitInfo {} + class DomainIndexInfo : TraitInfo { } public class DomainIndex : IWorldLoaded { diff --git a/OpenRA.Mods.RA/Traits/World/PathFinder.cs b/OpenRA.Mods.RA/Traits/World/PathFinder.cs index b4d6dbd466..ad4fd65644 100644 --- a/OpenRA.Mods.RA/Traits/World/PathFinder.cs +++ b/OpenRA.Mods.RA/Traits/World/PathFinder.cs @@ -27,7 +27,8 @@ namespace OpenRA.Mods.RA.Traits public class PathFinder { - readonly static List emptyPath = new List(0); + const int MaxPathAge = 50; /* x 40ms ticks */ + static readonly List emptyPath = new List(0); readonly World world; public PathFinder(World world) { this.world = world; } @@ -42,7 +43,6 @@ namespace OpenRA.Mods.RA.Traits } List CachedPaths = new List(); - const int MaxPathAge = 50; /* x 40ms ticks */ public List FindUnitPath(CPos from, CPos target, Actor self) { @@ -75,8 +75,7 @@ namespace OpenRA.Mods.RA.Traits .Reverse(); var pb = FindBidiPath( fromPoint, - fromPointReverse - ); + fromPointReverse); CheckSanePath2(pb, from, target); @@ -92,7 +91,7 @@ namespace OpenRA.Mods.RA.Traits { var mi = self.Info.Traits.Get(); var targetCell = self.World.Map.CellContaining(target); - var rangeSquared = range.Range*range.Range; + var rangeSquared = range.Range * range.Range; // Correct for SubCell offset target -= self.World.Map.OffsetOfSubCell(srcSub); @@ -116,8 +115,7 @@ namespace OpenRA.Mods.RA.Traits var path = FindBidiPath( PathSearch.FromPoints(world, mi, self, tilesInRange, src, true), - PathSearch.FromPoint(world, mi, self, src, targetCell, true).Reverse() - ); + PathSearch.FromPoint(world, mi, self, src, targetCell, true).Reverse()); return path; } @@ -231,6 +229,7 @@ namespace OpenRA.Mods.RA.Traits ret.Add(q); q = ca[q].Path; } + ret.Add(q); ret.Reverse(); diff --git a/OpenRA.Mods.RA/Traits/World/PathSearch.cs b/OpenRA.Mods.RA/Traits/World/PathSearch.cs index 152981d7a6..a9ba4518c2 100644 --- a/OpenRA.Mods.RA/Traits/World/PathSearch.cs +++ b/OpenRA.Mods.RA/Traits/World/PathSearch.cs @@ -339,7 +339,6 @@ namespace OpenRA.Mods.RA.Traits result.CopyValuesFrom(defaultCellInfoLayer); } - return result; } diff --git a/OpenRA.Mods.RA/TransformOnPassenger.cs b/OpenRA.Mods.RA/TransformOnPassenger.cs index 9cb4e2ca01..59cc2dce34 100644 --- a/OpenRA.Mods.RA/TransformOnPassenger.cs +++ b/OpenRA.Mods.RA/TransformOnPassenger.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA { public class TransformOnPassengerInfo : ITraitInfo { - [ActorReference] public readonly string[] PassengerTypes = {}; + [ActorReference] public readonly string[] PassengerTypes = { }; [ActorReference] public readonly string OnEnter = null; [ActorReference] public readonly string OnExit = null; public readonly bool SkipMakeAnims = false; @@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA { if (info.PassengerTypes.Contains(passenger.Info.Name) && transformTo != null) { - self.World.AddFrameEndTask( w => + self.World.AddFrameEndTask(w => { var facing = self.TraitOrDefault(); var transform = new Transform(self, transformTo) { SkipMakeAnims = info.SkipMakeAnims }; diff --git a/OpenRA.Mods.RA/Warheads/GrantUpgradeWarhead.cs b/OpenRA.Mods.RA/Warheads/GrantUpgradeWarhead.cs index c551eec29d..9bc6142929 100644 --- a/OpenRA.Mods.RA/Warheads/GrantUpgradeWarhead.cs +++ b/OpenRA.Mods.RA/Warheads/GrantUpgradeWarhead.cs @@ -12,9 +12,9 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Effects; using OpenRA.GameRules; -using OpenRA.Traits; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.RA.Effects; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA public override void DoImpact(Target target, Actor firedBy, IEnumerable damageModifiers) { - var actors = target.Type == TargetType.Actor ? new [] { target.Actor } : + var actors = target.Type == TargetType.Actor ? new[] { target.Actor } : firedBy.World.FindActorsInCircle(target.CenterPosition, Range); foreach (var a in actors) diff --git a/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs index 451f10537a..e756545c99 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs @@ -10,10 +10,10 @@ using System; using System.Linq; +using OpenRA.Mods.Common.Widgets; using OpenRA.Mods.RA.Widgets; using OpenRA.Network; using OpenRA.Widgets; -using OpenRA.Mods.Common.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic { diff --git a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs index caaa25ae53..482f188f33 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs @@ -46,8 +46,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic tooltipContainer.BeforeRender = () => { var latencyPrefixSize = latencyPrefix.Bounds.X + latencyPrefixFont.Measure(latencyPrefix.GetText() + " ").X; - var width = Math.Max(locationFont.Measure(location.GetText()).X, Math.Max(adminFont.Measure(admin.GetText()).X, - Math.Max(addressFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X))); + var width = Math.Max(locationFont.Measure(location.GetText()).X, Math.Max(adminFont.Measure(admin.GetText()).X, Math.Max(addressFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X))); widget.Bounds.Width = width + 2 * margin; latency.Bounds.Width = widget.Bounds.Width; ip.Bounds.Width = widget.Bounds.Width; diff --git a/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs index f9fdd12fc5..0eee3235cc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs @@ -9,8 +9,8 @@ #endregion using System; -using OpenRA.Support; using OpenRA.Mods.RA.Traits; +using OpenRA.Support; using OpenRA.Traits; using OpenRA.Widgets; diff --git a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs index 3f4e575e78..6a0ad75dc6 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Func setupItem = (s, template) => { var item = ScrollItemWidget.Setup(template, - () => s == world.LocalPlayer.Stances[ p ], + () => s == world.LocalPlayer.Stances[p], () => SetStance(dropdown, p, s)); item.Get("LABEL").GetText = () => s.ToString(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs index b410d9774f..59420c4671 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs @@ -76,8 +76,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic dataReceived = i.BytesReceived / (float)(1L << (mag * 10)); dataSuffix = SizeSuffixes[mag]; } - - + progressBar.Indeterminate = false; progressBar.Percentage = i.ProgressPercentage; @@ -143,6 +142,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (!string.IsNullOrEmpty(line)) mirrorList.Add(line); } + mirror = mirrorList.Random(new MersenneTwister()); // Save the package to a temp file diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoBriefingLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoBriefingLogic.cs index 0857335da8..4826f52de5 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoBriefingLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoBriefingLogic.cs @@ -10,9 +10,9 @@ using System; using System.Linq; -using OpenRA.Widgets; -using OpenRA.Traits; using OpenRA.Mods.RA; +using OpenRA.Traits; +using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic { diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoLogic.cs index 6bdfbed4e1..eeda972a82 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoLogic.cs @@ -10,13 +10,13 @@ using System; using System.Linq; -using OpenRA.Widgets; -using OpenRA.Traits; using OpenRA.Mods.RA; +using OpenRA.Traits; +using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic { - public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug }; + public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug } class GameInfoLogic { diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs index ec58663ce5..fa9e8b8a19 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs @@ -9,8 +9,8 @@ #endregion using System; -using System.Linq; using System.Drawing; +using System.Linq; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; using OpenRA.Widgets; diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 7b8c3e2023..857f5f1103 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -11,9 +11,9 @@ using System; using System.Drawing; using System.Linq; -using OpenRA.Widgets; -using OpenRA.Traits; using OpenRA.Mods.RA; +using OpenRA.Traits; +using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic { diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerBarLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerBarLogic.cs index afe3f0962e..1ba18a4fd1 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerBarLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerBarLogic.cs @@ -9,8 +9,8 @@ #endregion using System.Drawing; -using OpenRA.Mods.Common.Widgets; using OpenRA.Mods.Common.Traits; +using OpenRA.Mods.Common.Widgets; using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic diff --git a/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs index 7651ca9a64..79f5591bcd 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs @@ -9,8 +9,8 @@ #endregion using System.Drawing; -using OpenRA.Mods.Common.Widgets; using OpenRA.Mods.Common.Traits; +using OpenRA.Mods.Common.Widgets; using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs index 0e1dccd959..246cd7d3af 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs @@ -123,6 +123,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic return false; }; } + chatScrollPanel = chatChrome.Get("CHAT_SCROLLPANEL"); chatTemplate = chatScrollPanel.Get("CHAT_TEMPLATE"); chatScrollPanel.RemoveChildren(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs index 5e933a9f7e..04c9db614f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs @@ -46,6 +46,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black)); exitDelay += 40 * mpe.Info.FadeLength; } + Game.RunAfterDelay(exitDelay, () => { Game.Disconnect(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/InstallFromCDLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/InstallFromCDLogic.cs index cef9cccbe5..3befb18db1 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/InstallFromCDLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/InstallFromCDLogic.cs @@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var onError = (Action)(s => Game.RunAfterTick(() => { - statusLabel.GetText = () => "Error: "+s; + statusLabel.GetText = () => "Error: " + s; backButton.IsDisabled = () => false; retryButton.IsDisabled = () => false; })); @@ -121,7 +121,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic continueLoading(); }); } - catch(Exception e) + catch (Exception e) { onError("Installation failed.\n{0}".F(e.Message)); Log.Write("debug", e.ToString()); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index f3928801d8..7ab9f319a4 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -653,7 +653,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic }).Start(); } else if (Game.Settings.Game.AllowDownloading) - Game.modData.MapCache.QueryRemoteMapDetails(new [] { uid }); + Game.modData.MapCache.QueryRemoteMapDetails(new[] { uid }); } void UpdatePlayerList() diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyMapPreviewLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyMapPreviewLogic.cs index a9a40e1fc2..e433a8dcd0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyMapPreviewLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyMapPreviewLogic.cs @@ -143,7 +143,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (lobby.Map.Status == MapStatus.DownloadError) lobby.Map.Install(); else if (lobby.Map.Status == MapStatus.Unavailable) - Game.modData.MapCache.QueryRemoteMapDetails(new [] { lobby.Map.Uid }); + Game.modData.MapCache.QueryRemoteMapDetails(new[] { lobby.Map.Uid }); }; retry.GetText = () => lobby.Map.Status == MapStatus.DownloadError ? "Retry Install" : "Retry Search"; diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index b7216a5200..39e4839a74 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -41,11 +41,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic public static void ShowSlotDropDown(Ruleset rules, DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client, OrderManager orderManager) { - var options = new Dictionary>() {{"Slot", new List() + var options = new Dictionary>() { { "Slot", new List() { - new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)), - new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed) - }}}; + new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => (!slot.Closed && client == null)), + new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed) + } } }; var bots = new List(); if (slot.AllowBots) @@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic () => client != null && client.Bot == bot)); } } + options.Add(bots.Any() ? "Bots" : "Bots Disabled", bots); Func setupItem = (o, itemTemplate) => @@ -350,8 +351,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic orderManager.IssueOrders( orderManager.LobbyInfo.Clients.Where( c => c.IsObserver && !c.IsAdmin).Select( - client => Order.Command(String.Format("kick {0} {1}", client.Index, client.Name - ))).ToArray()); + client => Order.Command("kick {0} {1}".F(client.Index, client.Name))).ToArray()); after(); }; @@ -431,8 +431,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { var dropdown = parent.Get("SPAWN"); dropdown.IsDisabled = () => s.LockSpawn || orderManager.LocalClient.IsReady; - dropdown.OnMouseDown = _ => ShowSpawnDropDown(dropdown, c, orderManager, Enumerable.Range(0, map.SpawnPoints.Count + 1) - .Except(orderManager.LobbyInfo.Clients.Where(client => client != c && client.SpawnPoint != 0).Select(client => client.SpawnPoint))); + dropdown.OnMouseDown = _ => ShowSpawnDropDown(dropdown, c, orderManager, Enumerable.Range(0, map.SpawnPoints.Count + 1).Except(orderManager.LobbyInfo.Clients.Where(client => client != c && client.SpawnPoint != 0).Select(client => client.SpawnPoint))); dropdown.GetText = () => (c.SpawnPoint == 0) ? "-" : Convert.ToChar('A' - 1 + c.SpawnPoint).ToString(); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs index 3474f065c3..f7241fb9ce 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs @@ -86,6 +86,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic mapFilter = mapfilterInput.Text = null; EnumerateMaps(onSelect, filter); } + return true; }; mapfilterInput.OnEnterKey = () => { approving(); return true; }; diff --git a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs index 692b1ede52..cdbc4250c3 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic currentSong = song; // TODO: We leak the currentSong MusicInfo across map load, so compare the Filename instead. - var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong.Filename == song.Filename, () => { currentSong = song; Play(); }, () => {}); + var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong.Filename == song.Filename, () => { currentSong = song; Play(); }, () => { }); item.Get("TITLE").GetText = () => song.Title; item.Get("LENGTH").GetText = () => SongLengthLabel(song); musicList.AddChild(item); diff --git a/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs index 77a81533b8..40b583879a 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs @@ -168,8 +168,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic players.Select(p => new LineGraphSeries( p.PlayerName, p.Color.RGB, - (p.PlayerActor.TraitOrDefault() ?? new PlayerStatistics(p.PlayerActor)).EarnedSamples.Select(s => (float)s) - )); + (p.PlayerActor.TraitOrDefault() ?? new PlayerStatistics(p.PlayerActor)).EarnedSamples.Select(s => (float)s))); playerStatsPanel.AddChild(template); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs index 15e3a0e314..4a9c068fad 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class ServerBrowserLogic { - readonly static Action DoNothing = () => { }; + static readonly Action DoNothing = () => { }; GameServer currentServer; ScrollItemWidget serverTemplate; @@ -159,7 +159,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Game.RunAfterTick(() => RefreshServerListInner(games)); }; - currentQuery = new Download(Game.Settings.Server.MasterServer + "games", _ => {}, onComplete); + currentQuery = new Download(Game.Settings.Server.MasterServer + "games", _ => { }, onComplete); } int GroupSortOrder(GameServer testEntry) @@ -191,7 +191,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (modGames.All(Filtered)) continue; - var header = ScrollItemWidget.Setup(headerTemplate, () => true, () => {}); + var header = ScrollItemWidget.Setup(headerTemplate, () => true, () => { }); var headerTitle = modGames.First().ModLabel; header.Get("LABEL").GetText = () => headerTitle; @@ -246,7 +246,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (ip != null) { ip.GetText = () => game.Address; - ip.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : ip.TextColor; + ip.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : ip.TextColor; } var location = item.GetOrNull("LOCATION"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/ServerCreationLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ServerCreationLogic.cs index e1d3731a7c..614b5f5163 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ServerCreationLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ServerCreationLogic.cs @@ -44,8 +44,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() { { "initialMap", preview.Uid }, - { "onExit", () => {} }, - { "onSelect", (Action)(uid => preview = Game.modData.MapCache[uid]) } + { "onExit", () => { } }, + { "onSelect", (Action)(uid => preview = Game.modData.MapCache[uid]) } }); }; diff --git a/OpenRA.Mods.RA/Widgets/Logic/SimpleTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SimpleTooltipLogic.cs index ef1a186fe1..b17474dad5 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SimpleTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SimpleTooltipLogic.cs @@ -30,12 +30,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (textWidth != cachedWidth) { label.Bounds.Width = textWidth; - widget.Bounds.Width = 2*label.Bounds.X + textWidth; + widget.Bounds.Width = 2 * label.Bounds.X + textWidth; } }; label.GetText = () => labelText; } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/SpawnSelectorTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SpawnSelectorTooltipLogic.cs index 2668a5dc16..9fcafe2561 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SpawnSelectorTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SpawnSelectorTooltipLogic.cs @@ -63,10 +63,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (textWidth != cachedWidth) { label.Bounds.Width = textWidth; - widget.Bounds.Width = 2*label.Bounds.X + textWidth; + widget.Bounds.Width = 2 * label.Bounds.X + textWidth; } - widget.Bounds.Width = Math.Max(teamWidth + 2*labelMargin, label.Bounds.Right + labelMargin); + widget.Bounds.Width = Math.Max(teamWidth + 2 * labelMargin, label.Bounds.Right + labelMargin); team.Bounds.Width = widget.Bounds.Width; }; @@ -78,5 +78,4 @@ namespace OpenRA.Mods.RA.Widgets.Logic team.IsVisible = () => playerTeam > 0; } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/TabCompletionLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/TabCompletionLogic.cs index f8ce12aa3a..ae52a16d7a 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/TabCompletionLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/TabCompletionLogic.cs @@ -60,6 +60,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic suffix = ": "; toComplete = text; } + candidates = Names.Where(x => x.StartsWith(toComplete, StringComparison.InvariantCultureIgnoreCase)).ToList(); } else diff --git a/OpenRA.Mods.RA/Widgets/Logic/WorldTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/WorldTooltipLogic.cs index f62eddbab8..41fbcd979f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/WorldTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/WorldTooltipLogic.cs @@ -55,16 +55,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic o = viewport.ActorTooltip.Owner; showOwner = !o.NonCombatant && viewport.ActorTooltip.TooltipInfo.IsOwnerRowVisible; - var stance = o == null || world.RenderPlayer == null? Stance.None : o.Stances[world.RenderPlayer]; + var stance = o == null || world.RenderPlayer == null ? Stance.None : o.Stances[world.RenderPlayer]; labelText = viewport.ActorTooltip.TooltipInfo.TooltipForPlayerStance(stance); break; } + case WorldTooltipType.FrozenActor: { o = viewport.FrozenActorTooltip.TooltipOwner; showOwner = !o.NonCombatant && viewport.FrozenActorTooltip.TooltipInfo.IsOwnerRowVisible; - var stance = o == null || world.RenderPlayer == null? Stance.None : o.Stances[world.RenderPlayer]; + var stance = o == null || world.RenderPlayer == null ? Stance.None : o.Stances[world.RenderPlayer]; labelText = viewport.FrozenActorTooltip.TooltipInfo.TooltipForPlayerStance(stance); break; } @@ -74,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (textWidth != cachedWidth) { label.Bounds.Width = textWidth; - widget.Bounds.Width = 2*label.Bounds.X + textWidth; + widget.Bounds.Width = 2 * label.Bounds.X + textWidth; } if (showOwner) @@ -100,4 +101,3 @@ namespace OpenRA.Mods.RA.Widgets.Logic } } } - diff --git a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs index 379bfa5f33..e15050b68b 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs @@ -53,6 +53,7 @@ namespace OpenRA.Mods.RA.Widgets { return; } + var queues = world.ActorsWithTrait() .Where(a => a.Actor.Owner == player) .Select((a, i) => new { a.Trait, i }); diff --git a/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs index 037a199ad9..6619f56186 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs @@ -33,7 +33,6 @@ namespace OpenRA.Mods.RA.Widgets [ObjectCreator.UseCtor] public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer) { - this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary(); @@ -57,6 +56,7 @@ namespace OpenRA.Mods.RA.Widgets { return; } + var powers = player.PlayerActor.Trait().Powers .Select((a, i) => new { a, i }); foreach (var power in powers) diff --git a/OpenRA.Mods.RA/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/ProductionPaletteWidget.cs index a1ac3f0e00..34891ee614 100644 --- a/OpenRA.Mods.RA/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ProductionPaletteWidget.cs @@ -14,8 +14,8 @@ using System.Drawing; using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; -using OpenRA.Mods.RA.Traits; using OpenRA.Mods.RA.Orders; +using OpenRA.Mods.RA.Traits; using OpenRA.Network; using OpenRA.Widgets; @@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Widgets [Translate] public readonly string HoldText = ""; public int IconCount { get; private set; } - public event Action OnIconCountChanged = (a, b) => {}; + public event Action OnIconCountChanged = (a, b) => { }; public ProductionIcon TooltipIcon { get; private set; } public readonly World World; @@ -293,13 +293,9 @@ namespace OpenRA.Mods.RA.Widgets if (first.Done) { if (ReadyTextStyle == ReadyTextStyleOptions.Solid || orderManager.LocalFrameNumber / 9 % 2 == 0) - overlayFont.DrawTextWithContrast(ReadyText, - icon.Pos + readyOffset, - Color.White, Color.Black, 1); + overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, Color.White, Color.Black, 1); else if (ReadyTextStyle == ReadyTextStyleOptions.AlternatingColor) - overlayFont.DrawTextWithContrast(ReadyText, - icon.Pos + readyOffset, - ReadyTextAltColor, Color.Black, 1); + overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, ReadyTextAltColor, Color.Black, 1); } else if (first.Paused) overlayFont.DrawTextWithContrast(HoldText, diff --git a/OpenRA.Mods.RA/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.RA/Widgets/SupportPowersWidget.cs index e482152ad0..6ed02c6a17 100644 --- a/OpenRA.Mods.RA/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SupportPowersWidget.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Widgets public readonly string TooltipTemplate = "SUPPORT_POWER_TOOLTIP"; public int IconCount { get; private set; } - public event Action OnIconCountChanged = (a, b) => {}; + public event Action OnIconCountChanged = (a, b) => { }; readonly WorldRenderer worldRenderer; readonly SupportPowerManager spm; @@ -191,4 +191,4 @@ namespace OpenRA.Mods.RA.Widgets return true; } } -} \ No newline at end of file +} diff --git a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs index 067c360a48..f11f8da7b2 100644 --- a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs @@ -63,8 +63,7 @@ namespace OpenRA.Mods.RA.Widgets if (key == ks.ToSelectionKey) return ToSelection(); - - + // Put all functions that aren't unit-specific before this line! if (!world.Selection.Actors.Any()) return false; diff --git a/OpenRA.Mods.RA/WithRangeCircle.cs b/OpenRA.Mods.RA/WithRangeCircle.cs index 7b7e5e8148..1d6ed8c474 100644 --- a/OpenRA.Mods.RA/WithRangeCircle.cs +++ b/OpenRA.Mods.RA/WithRangeCircle.cs @@ -36,8 +36,7 @@ namespace OpenRA.Mods.RA.Traits Range, 0, Color, - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); foreach (var a in w.ActorsWithTrait()) if (a.Actor.Owner == a.Actor.World.LocalPlayer && a.Trait.Info.Type == Type) @@ -69,9 +68,7 @@ namespace OpenRA.Mods.RA.Traits Info.Range, 0, Info.Color, - Color.FromArgb(96, Color.Black) - ); + Color.FromArgb(96, Color.Black)); } } -} - +} \ No newline at end of file