diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index a559931c26..e93c8cacca 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -26,8 +26,6 @@ namespace OpenRA public readonly uint ActorID; Lazy occupySpace; - IHasLocation HasLocation; - Lazy Move; Lazy Facing; public Cached Bounds; @@ -37,21 +35,13 @@ namespace OpenRA public CPos Location { get { return occupySpace.Value.TopLeft; } } - public PPos CenterLocation - { - get - { - if (HasLocation == null) - HasLocation = Trait(); - return HasLocation.PxPosition; - } - } + public PPos CenterLocation { get { return occupySpace.Value.PxPosition; } } public WPos CenterPosition { get { - var altitude = Move.Value != null ? Move.Value.Altitude : 0; + var altitude = occupySpace.Value != null ? occupySpace.Value.Altitude : 0; return CenterLocation.ToWPos(altitude); } } @@ -93,7 +83,6 @@ namespace OpenRA AddTrait(trait.Create(init)); } - Move = Lazy.New(() => TraitOrDefault()); Facing = Lazy.New(() => TraitOrDefault()); Size = Lazy.New(() => @@ -152,13 +141,13 @@ namespace OpenRA loc += new PVecInt(si.Bounds[2], si.Bounds[3]); } - var move = Move.Value; - if (move != null) + var ios = occupySpace.Value; + if (ios != null) { - loc -= new PVecInt(0, move.Altitude); + loc -= new PVecInt(0, ios.Altitude); if (useAltitude) - size = new PVecInt(size.X, size.Y + move.Altitude); + size = new PVecInt(size.X, size.Y + ios.Altitude); } return new Rectangle(loc.X, loc.Y, size.X, size.Y); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 56ec0c1f01..4e1457d89d 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -96,12 +96,16 @@ namespace OpenRA.Traits public interface IVisibilityModifier { bool IsVisible(Actor self, Player byPlayer); } public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } - public interface IHasLocation { PPos PxPosition { get; } } - public interface IOccupySpace : IHasLocation + public interface IOccupySpace { + PPos PxPosition { get; } CPos TopLeft { get; } IEnumerable> OccupiedCells(); + + // TODO: We shouldn't expose the setter here + // This will be going away soon, so isn't a big deal + int Altitude { get; set; } } public static class IOccupySpaceExts @@ -134,7 +138,7 @@ namespace OpenRA.Traits public interface ITags { IEnumerable GetTags(); } public interface ISelectionBar { float GetValue(); Color GetColor(); } - public interface ITeleportable : IHasLocation /* crap name! */ + public interface ITeleportable : IOccupySpace { bool CanEnterCell(CPos location); void SetPosition(Actor self, CPos cell); @@ -142,7 +146,6 @@ namespace OpenRA.Traits void AdjustPxPosition(Actor self, PPos px); /* works like SetPxPosition, but visual only */ } - public interface IMove : ITeleportable { int Altitude { get; set; } } public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); } public interface IFacing diff --git a/OpenRA.Game/Traits/Waypoint.cs b/OpenRA.Game/Traits/Waypoint.cs index 96b29fb8f5..d60b8079cd 100644 --- a/OpenRA.Game/Traits/Waypoint.cs +++ b/OpenRA.Game/Traits/Waypoint.cs @@ -31,5 +31,6 @@ namespace OpenRA.Traits public IEnumerable> OccupiedCells() { yield break; } public PPos PxPosition { get { return Util.CenterOfCell(location); } } + public int Altitude { get { return 0; } set { } } } } diff --git a/OpenRA.Game/Traits/World/SpatialBins.cs b/OpenRA.Game/Traits/World/SpatialBins.cs index 563311cf6e..a6b17a508c 100644 --- a/OpenRA.Game/Traits/World/SpatialBins.cs +++ b/OpenRA.Game/Traits/World/SpatialBins.cs @@ -45,7 +45,7 @@ namespace OpenRA.Traits for (var i = 0; i <= bins.GetUpperBound(0); i++) bins[i, j].Clear(); - foreach (var a in self.World.ActorsWithTrait()) + foreach (var a in self.World.ActorsWithTrait()) { var bounds = a.Actor.ExtendedBounds.Value; diff --git a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs index 35b81831e8..4b1e8276e6 100644 --- a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs @@ -205,7 +205,7 @@ namespace OpenRA.Mods.Cnc.Missions { if (b.Destroyed) return; w2.Add(b); - b.TraitsImplementing().FirstOrDefault().SetPosition(b, a.Location); + b.TraitsImplementing().FirstOrDefault().SetPosition(b, a.Location); b.QueueActivity(mobile.MoveTo(unload, 2)); }); } diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index 1f23828606..d0f8c6d517 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2012 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -135,7 +135,7 @@ namespace OpenRA.Mods.Cnc.Missions IEnumerable UnitsNearActor(Actor actor, int range) { return world.FindActorsInCircle(actor.CenterPosition, WRange.FromCells(range)) - .Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); + .Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); } void NODReinforceNthA() @@ -198,4 +198,4 @@ namespace OpenRA.Mods.Cnc.Missions Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV))); } } -} +} diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 430811ce58..f759199a26 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -763,7 +763,7 @@ namespace OpenRA.Mods.RA.AI if (!buildableThings.Any()) return null; var myUnits = p.World - .ActorsWithTrait() + .ActorsWithTrait() .Where(a => a.Actor.Owner == p) .Select(a => a.Actor.Info.Name).ToArray(); @@ -783,7 +783,7 @@ namespace OpenRA.Mods.RA.AI int CountUnits(string unit, Player owner) { - return world.ActorsWithTrait().Where(a => a.Actor.Owner == owner && a.Actor.Info.Name == unit).Count(); + return world.ActorsWithTrait().Where(a => a.Actor.Owner == owner && a.Actor.Info.Name == unit).Count(); } int? CountBuildingByCommonName(string commonName, Player owner) @@ -1145,7 +1145,7 @@ namespace OpenRA.Mods.RA.AI void FindNewUnits(Actor self) { - var newUnits = self.World.ActorsWithTrait() + var newUnits = self.World.ActorsWithTrait() .Where(a => a.Actor.Owner == p && !a.Actor.HasTrait() && !activeUnits.Contains(a.Actor)) .Select(a => a.Actor).ToArray(); diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index 7c8f0f8feb..f105538e3c 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Air public int GetInitialFacing() { return InitialFacing; } } - public class Aircraft : IMove, IFacing, IOccupySpace, ISync, INotifyKilled, IIssueOrder, IOrderVoice + public class Aircraft : IFacing, ITeleportable, ISync, INotifyKilled, IIssueOrder, IOrderVoice { public IDisposable reservation; @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA.Air public Actor GetActorBelow() { - if (self.Trait().Altitude != 0) + if (self.Trait().Altitude != 0) return null; // not on the ground. return self.World.FindActorsInBox(self.CenterPosition, self.CenterPosition) diff --git a/OpenRA.Mods.RA/Air/EjectOnDeath.cs b/OpenRA.Mods.RA/Air/EjectOnDeath.cs index 74cf19de12..879aebc631 100644 --- a/OpenRA.Mods.RA/Air/EjectOnDeath.cs +++ b/OpenRA.Mods.RA/Air/EjectOnDeath.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) }); var r = self.World.SharedRandom.Next(1, 100); - var aircraft = self.Trait(); + var aircraft = self.Trait(); if (IsSuitableCell(pilot, self.Location) && r > 100 - info.SuccessRate && aircraft.Altitude > 10 && self.Owner.WinState != WinState.Lost) diff --git a/OpenRA.Mods.RA/Armament.cs b/OpenRA.Mods.RA/Armament.cs index e1b09e3e79..5bee9aaa0a 100755 --- a/OpenRA.Mods.RA/Armament.cs +++ b/OpenRA.Mods.RA/Armament.cs @@ -99,7 +99,7 @@ namespace OpenRA.Mods.RA // Note: facing is only used by the legacy positioning code // The world coordinate model uses Actor.Orientation - public void CheckFire(Actor self, AttackBase attack, IMove move, IFacing facing, Target target) + public void CheckFire(Actor self, AttackBase attack, IFacing facing, Target target) { if (FireDelay > 0) return; @@ -120,7 +120,7 @@ namespace OpenRA.Mods.RA return; var barrel = Barrels[Burst % Barrels.Length]; - var destMove = target.IsActor ? target.Actor.TraitOrDefault() : null; + var destios = target.IsActor ? target.Actor.TraitOrDefault() : null; var muzzlePosition = self.CenterPosition + MuzzleOffset(self, barrel); var legacyMuzzlePosition = PPos.FromWPos(muzzlePosition); @@ -136,7 +136,7 @@ namespace OpenRA.Mods.RA srcAltitude = legacyMuzzleAltitude, dest = target.CenterLocation, - destAltitude = destMove != null ? destMove.Altitude : 0, + destAltitude = destios != null ? destios.Altitude : 0, facing = legacyFacing, diff --git a/OpenRA.Mods.RA/Attack/AttackBase.cs b/OpenRA.Mods.RA/Attack/AttackBase.cs index c8263c6dec..9321698c67 100644 --- a/OpenRA.Mods.RA/Attack/AttackBase.cs +++ b/OpenRA.Mods.RA/Attack/AttackBase.cs @@ -89,12 +89,12 @@ namespace OpenRA.Mods.RA public virtual void DoAttack(Actor self, Target target) { - if( !CanAttack( self, target ) ) return; + if (!CanAttack(self, target)) + return; - var move = self.TraitOrDefault(); var facing = self.TraitOrDefault(); foreach (var a in Armaments) - a.CheckFire(self, this, move, facing, target); + a.CheckFire(self, this, facing, target); } public IEnumerable Orders diff --git a/OpenRA.Mods.RA/Attack/AttackLoyalty.cs b/OpenRA.Mods.RA/Attack/AttackLoyalty.cs index ceb8caab0f..e7f7d64c83 100644 --- a/OpenRA.Mods.RA/Attack/AttackLoyalty.cs +++ b/OpenRA.Mods.RA/Attack/AttackLoyalty.cs @@ -38,10 +38,9 @@ namespace OpenRA.Mods.RA if (!target.IsInRange(self.CenterPosition, range)) return; - var move = self.TraitOrDefault(); var facing = self.TraitOrDefault(); foreach (var a in Armaments) - a.CheckFire(self, this, move, facing, target); + a.CheckFire(self, this, facing, target); if (target.Actor != null) target.Actor.ChangeOwner(self.Owner); diff --git a/OpenRA.Mods.RA/Bridge.cs b/OpenRA.Mods.RA/Bridge.cs index ea51b80d62..3eb7dc9cac 100644 --- a/OpenRA.Mods.RA/Bridge.cs +++ b/OpenRA.Mods.RA/Bridge.cs @@ -158,7 +158,7 @@ namespace OpenRA.Mods.RA { foreach (var c in TileSprites[currentTemplate].Keys) foreach (var a in self.World.ActorMap.GetUnitsAt(c)) - if (a.HasTrait() && !a.Trait().CanEnterCell(c)) + if (a.HasTrait() && !a.Trait().CanEnterCell(c)) a.Kill(self); } diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 057523555e..3beb58e7f6 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -111,6 +111,7 @@ namespace OpenRA.Mods.RA.Buildings public CPos TopLeft { get { return topLeft; } } public PPos PxPosition { get { return pxPosition; } } + public int Altitude { get { return 0; } set { } } public IEnumerable ProvidesPrerequisites { get { yield return self.Info.Name; } } diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index 4223a6c57d..3be939620f 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -92,8 +92,8 @@ namespace OpenRA.Mods.RA return false; // Cannot unload mid-air - var move = self.TraitOrDefault(); - if (move != null && move.Altitude > info.minimalUnloadAltitude) + var ios = self.TraitOrDefault(); + if (ios != null && ios.Altitude > info.minimalUnloadAltitude) return false; // TODO: Check if there is a free tile to unload to @@ -106,8 +106,8 @@ namespace OpenRA.Mods.RA return false; // Cannot load mid-air - var move = self.TraitOrDefault(); - return move == null || move.Altitude == info.minimalUnloadAltitude; + var ios = self.TraitOrDefault(); + return ios == null || ios.Altitude == info.minimalUnloadAltitude; } public string CursorForOrder(Actor self, Order order) diff --git a/OpenRA.Mods.RA/CarpetBomb.cs b/OpenRA.Mods.RA/CarpetBomb.cs index 80148646a6..cfdcb607f8 100644 --- a/OpenRA.Mods.RA/CarpetBomb.cs +++ b/OpenRA.Mods.RA/CarpetBomb.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.RA var args = new ProjectileArgs { - srcAltitude = self.Trait().Altitude, + srcAltitude = self.Trait().Altitude, destAltitude = 0, src = self.CenterLocation, dest = self.CenterLocation, diff --git a/OpenRA.Mods.RA/ChronoshiftDeploy.cs b/OpenRA.Mods.RA/ChronoshiftDeploy.cs index 36fc932535..dc96a6b006 100644 --- a/OpenRA.Mods.RA/ChronoshiftDeploy.cs +++ b/OpenRA.Mods.RA/ChronoshiftDeploy.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA public bool CanJumpTo(CPos xy, bool ignoreVis) { - var movement = self.TraitOrDefault(); + var movement = self.TraitOrDefault(); if (chargeTick <= 0 // Can jump && (self.Location - xy).Length <= Info.JumpDistance // Within jump range diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index e1a2c87041..8acafa496c 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA } // ITeleportable is required for paradrop - class Crate : ITick, IOccupySpace, ITeleportable, ICrushable, ISync, INotifyParachuteLanded + class Crate : ITick, ITeleportable, ICrushable, ISync, INotifyParachuteLanded { readonly Actor self; [Sync] int ticks; @@ -86,6 +86,7 @@ namespace OpenRA.Mods.RA public IEnumerable> OccupiedCells() { yield return Pair.New( Location, SubCell.FullCell); } public PPos PxPosition { get; private set; } + public int Altitude { get { return 0; } set { } } public void SetPxPosition(Actor self, PPos px) { diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index 6b3aea3198..1c8297e1ed 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -98,8 +98,8 @@ namespace OpenRA.Mods.RA.Effects var dist = Args.target.CenterLocation + offset - PxPosition; var targetAltitude = 0; - if (Args.target.IsValid && Args.target.IsActor && Args.target.Actor.HasTrait()) - targetAltitude = Args.target.Actor.Trait().Altitude; + if (Args.target.IsValid && Args.target.IsActor && Args.target.Actor.HasTrait()) + targetAltitude = Args.target.Actor.Trait().Altitude; var jammed = Info.Jammable && world.ActorsWithTrait().Any(tp => (tp.Actor.CenterLocation - PxPosition).ToCVec().Length <= tp.Trait.Range diff --git a/OpenRA.Mods.RA/Husk.cs b/OpenRA.Mods.RA/Husk.cs index 7c8a03c701..9da6ce0153 100644 --- a/OpenRA.Mods.RA/Husk.cs +++ b/OpenRA.Mods.RA/Husk.cs @@ -27,6 +27,7 @@ namespace OpenRA.Mods.RA [Sync] CPos location; [Sync] public PPos PxPosition { get; set; } + public int Altitude { get { return 0; } set { } } [Sync] public int Facing { get; set; } public int ROT { get { return 0; } } diff --git a/OpenRA.Mods.RA/Mine.cs b/OpenRA.Mods.RA/Mine.cs index 8d57909240..c2589b877e 100644 --- a/OpenRA.Mods.RA/Mine.cs +++ b/OpenRA.Mods.RA/Mine.cs @@ -62,6 +62,7 @@ namespace OpenRA.Mods.RA public IEnumerable> OccupiedCells() { yield return Pair.New(TopLeft, SubCell.FullCell); } public PPos PxPosition { get { return Util.CenterOfCell( location ); } } + public int Altitude { get { return 0; } set { } } } /* tag trait for stuff that shouldnt trigger mines */ diff --git a/OpenRA.Mods.RA/Minelayer.cs b/OpenRA.Mods.RA/Minelayer.cs index 6d638a0e0e..ddd6de89f2 100644 --- a/OpenRA.Mods.RA/Minelayer.cs +++ b/OpenRA.Mods.RA/Minelayer.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA if (order.OrderString == "PlaceMinefield") { - var movement = self.Trait(); + var movement = self.Trait(); minefield = GetMinefieldCells(minefieldStart, order.TargetLocation, self.Info.Traits.Get().MinefieldDepth) @@ -130,7 +130,7 @@ namespace OpenRA.Mods.RA if (!minelayer.IsInWorld) return; - var movement = minelayer.Trait(); + var movement = minelayer.Trait(); var minefield = GetMinefieldCells(minefieldStart, lastMousePos, minelayer.Info.Traits.Get().MinefieldDepth) .Where(p => movement.CanEnterCell(p)).ToArray(); diff --git a/OpenRA.Mods.RA/Missions/Allies02Script.cs b/OpenRA.Mods.RA/Missions/Allies02Script.cs index 9703e9a999..89bebdd3b1 100644 --- a/OpenRA.Mods.RA/Missions/Allies02Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies02Script.cs @@ -170,7 +170,7 @@ namespace OpenRA.Mods.RA.Missions if (yak == null || (yak != null && !yak.IsDead() && (yak.GetCurrentActivity() is FlyCircle || yak.IsIdle))) { var alliedUnitsNearYakPoint = world.FindAliveCombatantActorsInCircle(yakAttackPoint.CenterPosition, WRange.FromCells(10)) - .Where(a => a.Owner != soviets && a.HasTrait() && a != tanya && a != einstein && a != engineer); + .Where(a => a.Owner != soviets && a.HasTrait() && a != tanya && a != einstein && a != engineer); if (alliedUnitsNearYakPoint.Any()) YakStrafe(alliedUnitsNearYakPoint); } @@ -384,7 +384,7 @@ namespace OpenRA.Mods.RA.Missions bool AlliesNearTown() { return world.FindAliveCombatantActorsInCircle(townPoint.CenterPosition, WRange.FromCells(AlliedTownTransferRange)) - .Any(a => a.Owner == allies1 && a.HasTrait()); + .Any(a => a.Owner == allies1 && a.HasTrait()); } void TransferTownUnitsToAllies() @@ -399,7 +399,7 @@ namespace OpenRA.Mods.RA.Missions var sovietAttackUnits = world.FindAliveCombatantActorsInCircle(sovietTownAttackPoint1.CenterPosition, WRange.FromCells(SovietTownAttackGroupRange)) .Union(world.FindAliveCombatantActorsInCircle(sovietTownAttackPoint2.CenterPosition, WRange.FromCells(SovietTownAttackGroupRange))) .Union(world.FindAliveCombatantActorsInCircle(townPoint.CenterPosition, WRange.FromCells(AlliedTownTransferRange))) - .Where(a => a.HasTrait() && a.Owner == soviets); + .Where(a => a.HasTrait() && a.Owner == soviets); foreach (var unit in sovietAttackUnits) unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(townPoint.Location, SovietTownMoveNearEnough))); diff --git a/OpenRA.Mods.RA/Missions/MissionUtils.cs b/OpenRA.Mods.RA/Missions/MissionUtils.cs index cdb15634c3..8e1fff1360 100644 --- a/OpenRA.Mods.RA/Missions/MissionUtils.cs +++ b/OpenRA.Mods.RA/Missions/MissionUtils.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.RA.Missions public static bool AreaSecuredWithUnits(World world, Player player, WPos location, WRange range) { - var units = world.FindAliveCombatantActorsInCircle(location, range).Where(a => a.HasTrait()); + var units = world.FindAliveCombatantActorsInCircle(location, range).Where(a => a.HasTrait()); return units.Any() && units.All(a => a.Owner == player); } diff --git a/OpenRA.Mods.RA/Missions/Survival01Script.cs b/OpenRA.Mods.RA/Missions/Survival01Script.cs index 9ca1de8e66..4f93229a60 100644 --- a/OpenRA.Mods.RA/Missions/Survival01Script.cs +++ b/OpenRA.Mods.RA/Missions/Survival01Script.cs @@ -185,7 +185,7 @@ namespace OpenRA.Mods.RA.Missions var units = world.CreateActor((sovietInfantry).Random(world.SharedRandom), new TypeDictionary { new LocationInit(sovietinfantryentry1.Location), new OwnerInit(soviets) }); units.QueueActivity(new Move.Move(sovietinfantryrally1.Location, 3)); var unitsincircle = world.FindAliveCombatantActorsInCircle(sovietinfantryrally1.CenterPosition, WRange.FromCells(10)) - .Where(a => a.Owner == soviets && a.IsIdle && a.HasTrait()); + .Where(a => a.Owner == soviets && a.IsIdle && a.HasTrait()); if (unitsincircle.Count() >= sovietInfantryGroupSize) { foreach (var scatteredunits in unitsincircle) diff --git a/OpenRA.Mods.RA/Missions/Survival02Script.cs b/OpenRA.Mods.RA/Missions/Survival02Script.cs index 7d2b69828d..9e4da5604e 100644 --- a/OpenRA.Mods.RA/Missions/Survival02Script.cs +++ b/OpenRA.Mods.RA/Missions/Survival02Script.cs @@ -299,7 +299,7 @@ namespace OpenRA.Mods.RA.Missions void ManageSovietUnits() { var units = world.FindAliveCombatantActorsInCircle(sovietrally.CenterPosition, WRange.FromCells(3)) - .Where(u => u.IsIdle && u.HasTrait() && u.HasTrait() && u.Owner == soviets); + .Where(u => u.IsIdle && u.HasTrait() && u.HasTrait() && u.Owner == soviets); if (units.Count() >= sovietAttackGroupSize) { foreach (var unit in units) diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index f7679b096c..22f285c9cf 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -145,7 +145,7 @@ namespace OpenRA.Mods.RA.Move public int GetInitialFacing() { return InitialFacing; } } - public class Mobile : IIssueOrder, IResolveOrder, IOrderVoice, IOccupySpace, IMove, IFacing, ISync + public class Mobile : IIssueOrder, IResolveOrder, IOrderVoice, ITeleportable, IFacing, ISync { public readonly Actor self; public readonly MobileInfo Info; diff --git a/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs b/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs index 20c8ee01cf..5b31bc408b 100644 --- a/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs +++ b/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Orders if (!world.LocalPlayer.Shroud.IsExplored(xy)) return "move-blocked"; - var movement = self.TraitOrDefault(); + var movement = self.TraitOrDefault(); return (movement.CanEnterCell(xy)) ? "chrono-target" : "move-blocked"; } } diff --git a/OpenRA.Mods.RA/Player/PlayerStatistics.cs b/OpenRA.Mods.RA/Player/PlayerStatistics.cs index 5091501494..c6fdaaef0f 100644 --- a/OpenRA.Mods.RA/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.RA/Player/PlayerStatistics.cs @@ -112,7 +112,7 @@ namespace OpenRA.Mods.RA attackerStats.BuildingsKilled++; defenderStats.BuildingsDead++; } - else if (self.HasTrait()) + else if (self.HasTrait()) { attackerStats.UnitsKilled++; defenderStats.UnitsDead++; diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index 2da92ea359..5135be0fd4 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Render public void Tick(Actor self) { - var isFlying = self.Trait().Altitude > 0 && !self.IsDead(); + var isFlying = self.Trait().Altitude > 0 && !self.IsDead(); if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor")) return; diff --git a/OpenRA.Mods.RA/Render/WithShadow.cs b/OpenRA.Mods.RA/Render/WithShadow.cs index a6e265921f..685f8fad8a 100644 --- a/OpenRA.Mods.RA/Render/WithShadow.cs +++ b/OpenRA.Mods.RA/Render/WithShadow.cs @@ -24,16 +24,16 @@ namespace OpenRA.Mods.RA.Render { public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) { - var move = self.Trait(); + var ios = self.Trait(); /* rude hack */ - var visualOffset = ((move is Helicopter || move is Mobile) && move.Altitude > 0) + var visualOffset = ((ios is Helicopter || ios is Mobile) && ios.Altitude > 0) ? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0; var shadowSprites = r.Select(a => a.WithPalette(wr.Palette("shadow")) .WithPos(a.Pos - new WVec(0, 0, a.Pos.Z)).WithZOffset(a.ZOffset + a.Pos.Z)); - var flyingSprites = (move.Altitude <= 0) ? r : + var flyingSprites = (ios.Altitude <= 0) ? r : r.Select(a => a.WithPos(a.Pos - new WVec(0,0,43*visualOffset))); return shadowSprites.Concat(flyingSprites);