diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 2b208dd522..4015836f49 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -23,20 +23,33 @@ namespace OpenRA { public class Actor : IScriptBindable, IScriptNotifyBind, ILuaTableBinding, ILuaEqualityBinding, ILuaToStringBinding, IEquatable { - public readonly ActorInfo Info; + [Sync] public Player Owner; + public readonly ActorInfo Info; public readonly World World; public readonly uint ActorID; - public Lazy Bounds; - Lazy occupySpace; + public bool IsInWorld { get; internal set; } + public bool Destroyed { get; private set; } + + Activity currentActivity; + + public Group Group; + public int Generation; + + Lazy bounds; Lazy facing; Lazy health; + Lazy occupySpace; Lazy effectiveOwner; + public Rectangle Bounds { get { return bounds.Value; } } public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } } public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } } + public bool IsIdle { get { return currentActivity == null; } } + public bool IsDead { get { return Destroyed || (health.Value == null ? false : health.Value.IsDead); } } + public CPos Location { get { return occupySpace.Value.TopLeft; } } public WPos CenterPosition { get { return occupySpace.Value.CenterPosition; } } @@ -50,12 +63,6 @@ namespace OpenRA } } - [Sync] public Player Owner; - - Activity currentActivity; - public Group Group; - public int Generation; - internal Actor(World world, string name, TypeDictionary initDict) { var init = new ActorInitializer(this, initDict); @@ -69,10 +76,12 @@ namespace OpenRA if (name != null) { - if (!world.Map.Rules.Actors.ContainsKey(name.ToLowerInvariant())) - throw new NotImplementedException("No rules definition for unit {0}".F(name.ToLowerInvariant())); + name = name.ToLowerInvariant(); - Info = world.Map.Rules.Actors[name.ToLowerInvariant()]; + if (!world.Map.Rules.Actors.ContainsKey(name)) + throw new NotImplementedException("No rules definition for unit " + name); + + Info = world.Map.Rules.Actors[name]; foreach (var trait in Info.TraitsInConstructOrder()) AddTrait(trait.Create(init)); } @@ -81,7 +90,7 @@ namespace OpenRA health = Exts.Lazy(() => TraitOrDefault()); effectiveOwner = Exts.Lazy(() => TraitOrDefault()); - Bounds = Exts.Lazy(() => + bounds = Exts.Lazy(() => { var si = Info.Traits.GetOrDefault(); var size = (si != null && si.Bounds != null) ? new int2(si.Bounds[0], si.Bounds[1]) : @@ -99,16 +108,12 @@ namespace OpenRA { var wasIdle = IsIdle; currentActivity = Traits.Util.RunActivity(this, currentActivity); + if (!wasIdle && IsIdle) foreach (var n in TraitsImplementing()) n.OnBecomingIdle(this); } - public bool IsIdle - { - get { return currentActivity == null; } - } - public IEnumerable Render(WorldRenderer wr) { var renderables = Renderables(wr); @@ -124,8 +129,6 @@ namespace OpenRA yield return renderable; } - public bool IsInWorld { get; internal set; } - public void QueueActivity(bool queued, Activity nextActivity) { if (!queued) @@ -198,8 +201,6 @@ namespace OpenRA World.traitDict.AddTrait(this, trait); } - public bool Destroyed { get; private set; } - public void Destroy() { World.AddFrameEndTask(w => @@ -239,19 +240,6 @@ namespace OpenRA }); } - public bool IsDead() - { - if (Destroyed) - return true; - - return (health.Value == null) ? false : health.Value.IsDead; - } - - public bool IsDisguised() - { - return effectiveOwner.Value != null && effectiveOwner.Value.Disguised; - } - public void Kill(Actor attacker) { if (health.Value == null) diff --git a/OpenRA.Game/Graphics/SelectionBarsRenderable.cs b/OpenRA.Game/Graphics/SelectionBarsRenderable.cs index 5fc4bbc32a..647a9815ca 100644 --- a/OpenRA.Game/Graphics/SelectionBarsRenderable.cs +++ b/OpenRA.Game/Graphics/SelectionBarsRenderable.cs @@ -81,7 +81,8 @@ namespace OpenRA.Graphics if (Game.Settings.Game.TeamHealthColors) { var isAlly = actor.Owner.IsAlliedWith(actor.World.LocalPlayer) - || (actor.IsDisguised() && actor.World.LocalPlayer.IsAlliedWith(actor.EffectiveOwner.Owner)); + || (actor.EffectiveOwner != null && actor.EffectiveOwner.Disguised + && actor.World.LocalPlayer.IsAlliedWith(actor.EffectiveOwner.Owner)); return isAlly ? Color.LimeGreen : actor.Owner.NonCombatant ? Color.Tan : Color.Red; } else @@ -137,13 +138,13 @@ namespace OpenRA.Graphics public void BeforeRender(WorldRenderer wr) {} public void Render(WorldRenderer wr) { - if (!actor.IsInWorld || actor.IsDead()) + if (!actor.IsInWorld || actor.IsDead) return; var health = actor.TraitOrDefault(); var screenPos = wr.ScreenPxPosition(pos); - var bounds = actor.Bounds.Value; + var bounds = actor.Bounds; bounds.Offset(screenPos.X, screenPos.Y); var xy = new float2(bounds.Left, bounds.Top); diff --git a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs b/OpenRA.Game/Graphics/SelectionBoxRenderable.cs index 55fc28ee63..9cf4f63cf1 100644 --- a/OpenRA.Game/Graphics/SelectionBoxRenderable.cs +++ b/OpenRA.Game/Graphics/SelectionBoxRenderable.cs @@ -22,7 +22,7 @@ namespace OpenRA.Graphics readonly Color color; public SelectionBoxRenderable(Actor actor, Color color) - : this(actor.CenterPosition, actor.Bounds.Value, 1f, color) { } + : this(actor.CenterPosition, actor.Bounds, 1f, color) { } public SelectionBoxRenderable(WPos pos, Rectangle bounds, float scale, Color color) { diff --git a/OpenRA.Game/Scripting/ScriptActorInterface.cs b/OpenRA.Game/Scripting/ScriptActorInterface.cs index 9d13f36168..a269c0094f 100644 --- a/OpenRA.Game/Scripting/ScriptActorInterface.cs +++ b/OpenRA.Game/Scripting/ScriptActorInterface.cs @@ -22,7 +22,7 @@ namespace OpenRA.Scripting protected override string MemberNotFoundError(string memberName) { var actorName = actor.Info.Name; - if (actor.IsDead()) + if (actor.IsDead) actorName += " (dead)"; return "Actor '{0}' does not define a property '{1}'".F(actorName, memberName); diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index 40330b57bc..135b04b4c3 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -88,7 +88,7 @@ namespace OpenRA return; } - var groupActors = controlGroups[group].Where(a => !a.IsDead()); + var groupActors = controlGroups[group].Where(a => !a.IsDead); if (mods.HasModifier(Modifiers.Alt) || MultiTapCount >= 2) { diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs index 2d18176c1f..613544d431 100755 --- a/OpenRA.Game/Traits/Health.cs +++ b/OpenRA.Game/Traits/Health.cs @@ -98,7 +98,7 @@ namespace OpenRA.Traits foreach (var nd in self.TraitsImplementing()) nd.DamageStateChanged(self, ai); - if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead()) + if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead) foreach (var nd in repairer.TraitsImplementing() .Concat(repairer.Owner.PlayerActor.TraitsImplementing())) nd.AppliedDamage(repairer, self, ai); @@ -141,7 +141,7 @@ namespace OpenRA.Traits foreach (var nd in self.TraitsImplementing()) nd.DamageStateChanged(self, ai); - if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead()) + if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead) foreach (var nd in attacker.TraitsImplementing() .Concat(attacker.Owner.PlayerActor.TraitsImplementing())) nd.AppliedDamage(attacker, self, ai); diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index de43f88321..bc8bb48193 100755 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -47,13 +47,13 @@ namespace OpenRA.Traits FootprintRegion = footprintRegion; CenterPosition = self.CenterPosition; - Bounds = self.Bounds.Value; + Bounds = self.Bounds; } public uint ID { get { return actor.ActorID; } } public bool IsValid { get { return Owner != null && HasRenderables; } } public ActorInfo Info { get { return actor.Info; } } - public Actor Actor { get { return !actor.IsDead() ? actor : null; } } + public Actor Actor { get { return !actor.IsDead ? actor : null; } } int flashTicks; public void Tick(World world, Shroud shroud) diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 69433f3353..72d2526b4f 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -38,7 +38,7 @@ namespace OpenRA.Traits IEnumerable ActivityTargetPath() { - if (!self.IsInWorld || self.IsDead()) + if (!self.IsInWorld || self.IsDead) yield break; var activity = self.GetCurrentActivity(); diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index 1c886071dc..3f29190ddf 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -41,7 +41,7 @@ namespace OpenRA.Traits if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) && self.World.FogObscures(self)) yield break; - var b = self.Bounds.Value; + var b = self.Bounds; var pos = wr.ScreenPxPosition(self.CenterPosition); var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top)); var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom)); @@ -85,7 +85,7 @@ namespace OpenRA.Traits var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, - (3 + pipSize.Y / 2)); var pipxyOffset = new int2(0, 0); var pal = wr.Palette(Info.Palette); - var width = self.Bounds.Value.Width; + var width = self.Bounds.Width; foreach (var pips in pipSources) { diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs index 4c14a1e095..39b9fe0a34 100644 --- a/OpenRA.Game/Traits/Target.cs +++ b/OpenRA.Game/Traits/Target.cs @@ -66,7 +66,7 @@ namespace OpenRA.Traits if (type == TargetType.Actor) { // Actor is no longer in the world - if (!actor.IsInWorld || actor.IsDead()) + if (!actor.IsInWorld || actor.IsDead) return TargetType.Invalid; // Actor generation has changed (teleported or captured) diff --git a/OpenRA.Game/Traits/World/ScreenMap.cs b/OpenRA.Game/Traits/World/ScreenMap.cs index 2f88b7847f..c656e098b7 100755 --- a/OpenRA.Game/Traits/World/ScreenMap.cs +++ b/OpenRA.Game/Traits/World/ScreenMap.cs @@ -84,7 +84,7 @@ namespace OpenRA.Traits public void Add(Actor a) { var pos = worldRenderer.ScreenPxPosition(a.CenterPosition); - var bounds = a.Bounds.Value; + var bounds = a.Bounds; bounds.Offset(pos.X, pos.Y); var top = Math.Max(0, bounds.Top / info.BinSize); diff --git a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs index 75f70e4bcd..4870124f24 100644 --- a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs +++ b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Cnc case State.Dock: ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Docked(proc, self); state = State.Loop; @@ -63,12 +63,12 @@ namespace OpenRA.Mods.Cnc state = State.Wait; return this; case State.Loop: - if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc)) + if (!proc.IsInWorld || proc.IsDead || harv.TickUnload(self, proc)) state = State.Undock; return this; case State.Undock: ru.PlayCustomAnimBackwards(self, "dock", () => state = State.DragOut); - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Undocked(proc, self); state = State.Wait; diff --git a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs index e356840124..30d1f4fd2e 100644 --- a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Cnc.Traits a.QueueActivity(new Land(Target.FromActor(self))); a.QueueActivity(new CallFunc(() => { - if (!self.IsInWorld || self.IsDead()) + if (!self.IsInWorld || self.IsDead) return; foreach (var cargo in self.TraitsImplementing()) diff --git a/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs b/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs index ddd7780e48..fa7e3ed86b 100644 --- a/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs +++ b/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Effects public void Tick(World world) { - if (!a.IsInWorld || a.IsDead() || !a.Trait().Disabled) + if (!a.IsInWorld || a.IsDead || !a.Trait().Disabled) world.AddFrameEndTask(w => w.Remove(this)); anim.Tick(); diff --git a/OpenRA.Mods.Common/Effects/RallyPoint.cs b/OpenRA.Mods.Common/Effects/RallyPoint.cs index 7ef001a1e8..6bbc0f8629 100644 --- a/OpenRA.Mods.Common/Effects/RallyPoint.cs +++ b/OpenRA.Mods.Common/Effects/RallyPoint.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Effects circles.Play("circles"); } - if (!building.IsInWorld || building.IsDead()) + if (!building.IsInWorld || building.IsDead) world.AddFrameEndTask(w => w.Remove(this)); } diff --git a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs index 781f03dbff..f5a8783f8e 100644 --- a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs +++ b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs @@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Power { var actors = self.World.ActorsWithTrait() .Select(tp => tp.Actor) - .Where(a => !a.IsDead() && a.IsInWorld && a.Owner == self.Owner); + .Where(a => !a.IsDead && a.IsInWorld && a.Owner == self.Owner); UpdateActors(actors); } diff --git a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs index 4ab3b3aa47..1bbec5b0d4 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common { if (claim.Claimer.Destroyed) return; if (!claim.Claimer.IsInWorld) return; - if (claim.Claimer.IsDead()) return; + if (claim.Claimer.IsDead) return; claim.Claimer.Trait().OnNotifyResourceClaimLost(claim.Claimer, claim, claimer); } diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 577d65afd8..99c996b802 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -475,7 +475,7 @@ namespace OpenRA.Mods.RA.AI List FindEnemyConstructionYards() { - return world.Actors.Where(a => p.Stances[a.Owner] == Stance.Enemy && !a.IsDead() + return world.Actors.Where(a => p.Stances[a.Owner] == Stance.Enemy && !a.IsDead && a.HasTrait() && !a.HasTrait()).ToList(); } @@ -483,7 +483,7 @@ namespace OpenRA.Mods.RA.AI { squads.RemoveAll(s => !s.IsValid); foreach (var s in squads) - s.units.RemoveAll(a => a.IsDead() || a.Owner != p); + s.units.RemoveAll(a => a.IsDead || a.Owner != p); } // Use of this function requires that one squad of this type. Hence it is a piece of shit @@ -506,8 +506,8 @@ namespace OpenRA.Mods.RA.AI void AssignRolesToIdleUnits(Actor self) { CleanSquads(); - activeUnits.RemoveAll(a => a.IsDead() || a.Owner != p); - unitsHangingAroundTheBase.RemoveAll(a => a.IsDead() || a.Owner != p); + activeUnits.RemoveAll(a => a.IsDead || a.Owner != p); + unitsHangingAroundTheBase.RemoveAll(a => a.IsDead || a.Owner != p); if (--rushTicks <= 0) { diff --git a/OpenRA.Mods.RA/AI/States/GroundStates.cs b/OpenRA.Mods.RA/AI/States/GroundStates.cs index 675c4412d8..3137f71272 100644 --- a/OpenRA.Mods.RA/AI/States/GroundStates.cs +++ b/OpenRA.Mods.RA/AI/States/GroundStates.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.AI else { var enemies = owner.world.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(12)) - .Where(a1 => !a1.Destroyed && !a1.IsDead()).ToList(); + .Where(a1 => !a1.Destroyed && !a1.IsDead).ToList(); var enemynearby = enemies.Where(a1 => a1.HasTrait() && leader.Owner.Stances[a1.Owner] == Stance.Enemy).ToList(); if (enemynearby.Any()) { diff --git a/OpenRA.Mods.RA/Activities/Air/ReturnToBase.cs b/OpenRA.Mods.RA/Activities/Air/ReturnToBase.cs index a876978857..0df3d490e2 100644 --- a/OpenRA.Mods.RA/Activities/Air/ReturnToBase.cs +++ b/OpenRA.Mods.RA/Activities/Air/ReturnToBase.cs @@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA.Activities public override Activity Tick(Actor self) { - if (IsCanceled || self.IsDead()) + if (IsCanceled || self.IsDead) return NextActivity; if (!isCalculated) diff --git a/OpenRA.Mods.RA/Activities/CaptureActor.cs b/OpenRA.Mods.RA/Activities/CaptureActor.cs index 11992fe133..e9b0413025 100644 --- a/OpenRA.Mods.RA/Activities/CaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/CaptureActor.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Activities protected override void OnInside(Actor self) { - if (actor.IsDead() || capturable.BeingCaptured) + if (actor.IsDead || capturable.BeingCaptured) return; var b = actor.TraitOrDefault(); @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities if (b != null && b.Locked) b.Unlock(); - if (actor.IsDead() || capturable.BeingCaptured) + if (actor.IsDead || capturable.BeingCaptured) return; var health = actor.Trait(); diff --git a/OpenRA.Mods.RA/Activities/Demolish.cs b/OpenRA.Mods.RA/Activities/Demolish.cs index a2d4189a0d..cdd1a544b9 100644 --- a/OpenRA.Mods.RA/Activities/Demolish.cs +++ b/OpenRA.Mods.RA/Activities/Demolish.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities { self.World.AddFrameEndTask(w => { - if (target.IsDead()) + if (target.IsDead) return; for (var f = 0; f < flashes; f++) @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Activities w.Add(new DelayedAction(delay, () => { - if (target.IsDead()) + if (target.IsDead) return; var modifiers = target.TraitsImplementing() diff --git a/OpenRA.Mods.RA/Activities/DonateSupplies.cs b/OpenRA.Mods.RA/Activities/DonateSupplies.cs index 2bd123ba3c..64243be5ab 100644 --- a/OpenRA.Mods.RA/Activities/DonateSupplies.cs +++ b/OpenRA.Mods.RA/Activities/DonateSupplies.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Activities protected override void OnInside(Actor self) { - if (target.IsDead()) + if (target.IsDead) return; target.Owner.PlayerActor.Trait().GiveCash(payload); diff --git a/OpenRA.Mods.RA/Activities/EnterTransport.cs b/OpenRA.Mods.RA/Activities/EnterTransport.cs index 932ba3ee6e..8a99bfab5c 100644 --- a/OpenRA.Mods.RA/Activities/EnterTransport.cs +++ b/OpenRA.Mods.RA/Activities/EnterTransport.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities { self.World.AddFrameEndTask(w => { - if (self.IsDead() || transport.IsDead() || !cargo.CanLoad(transport, self)) + if (self.IsDead || transport.IsDead || !cargo.CanLoad(transport, self)) return; cargo.Load(transport, self); diff --git a/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs b/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs index 30e5abe06a..df55a6c80d 100644 --- a/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/ExternalCaptureActor.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Activities var capturable = target.Actor.Trait(); - if (IsCanceled || !self.IsInWorld || self.IsDead() || !target.IsValidFor(self)) + if (IsCanceled || !self.IsInWorld || self.IsDead || !target.IsValidFor(self)) { if (capturable.CaptureInProgress) capturable.EndCapture(); @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA.Activities self.World.AddFrameEndTask(w => { - if (target.Actor.IsDead()) + if (target.Actor.IsDead) return; var oldOwner = target.Actor.Owner; diff --git a/OpenRA.Mods.RA/Activities/Hunt.cs b/OpenRA.Mods.RA/Activities/Hunt.cs index 55b8d22ff4..dc42038c9e 100644 --- a/OpenRA.Mods.RA/Activities/Hunt.cs +++ b/OpenRA.Mods.RA/Activities/Hunt.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Activities public Hunt(Actor self) { var attack = self.Trait(); - targets = self.World.Actors.Where(a => self != a && !a.IsDead() && a.IsInWorld && a.AppearsHostileTo(self) + targets = self.World.Actors.Where(a => self != a && !a.IsDead && a.IsInWorld && a.AppearsHostileTo(self) && a.HasTrait() && attack.HasAnyValidWeapons(Target.FromActor(a))); } diff --git a/OpenRA.Mods.RA/Activities/Infiltrate.cs b/OpenRA.Mods.RA/Activities/Infiltrate.cs index f2636f67d4..6c12797fab 100644 --- a/OpenRA.Mods.RA/Activities/Infiltrate.cs +++ b/OpenRA.Mods.RA/Activities/Infiltrate.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Activities protected override void OnInside(Actor self) { - if (target.IsDead() || target.Owner == self.Owner) + if (target.IsDead || target.Owner == self.Owner) return; foreach (var t in target.TraitsImplementing()) diff --git a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs index 9655735332..3543f2f3f8 100644 --- a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs +++ b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA case State.Dock: ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Docked(proc, self); state = State.Loop; @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA state = State.Wait; return this; case State.Loop: - if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc)) + if (!proc.IsInWorld || proc.IsDead || harv.TickUnload(self, proc)) state = State.Undock; return this; case State.Undock: @@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA case State.Complete: harv.LastLinkedProc = harv.LinkedProc; harv.LinkProc(self, null); - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Undocked(proc, self); return NextActivity; diff --git a/OpenRA.Mods.RA/Activities/Transform.cs b/OpenRA.Mods.RA/Activities/Transform.cs index 89e6dd826c..df57a059a9 100644 --- a/OpenRA.Mods.RA/Activities/Transform.cs +++ b/OpenRA.Mods.RA/Activities/Transform.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities self.World.AddFrameEndTask(w => { - if (self.IsDead()) + if (self.IsDead) return; foreach (var nt in self.TraitsImplementing()) diff --git a/OpenRA.Mods.RA/ActorExts.cs b/OpenRA.Mods.RA/ActorExts.cs index 5a25c408e4..b15ea0854a 100644 --- a/OpenRA.Mods.RA/ActorExts.cs +++ b/OpenRA.Mods.RA/ActorExts.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return true; - if (self.IsDisguised() && !toActor.HasTrait()) + if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Ally; return stance == Stance.Ally; @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return false; /* otherwise, we'll hate friendly disguised spies */ - if (self.IsDisguised() && !toActor.HasTrait()) + if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy; return stance == Stance.Enemy; diff --git a/OpenRA.Mods.RA/AutoHeal.cs b/OpenRA.Mods.RA/AutoHeal.cs index ace015522f..1af562c599 100644 --- a/OpenRA.Mods.RA/AutoHeal.cs +++ b/OpenRA.Mods.RA/AutoHeal.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA var target = inRange .Where(a => a != self && a.AppearsFriendlyTo(self)) - .Where(a => a.IsInWorld && !a.IsDead()) + .Where(a => a.IsInWorld && !a.IsDead) .Where(a => a.GetDamageState() > DamageState.Undamaged) .Where(a => attack.HasAnyValidWeapons(Target.FromActor(a))) .ClosestTo(self); diff --git a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs index 9ab249ab92..9fe6c505b3 100755 --- a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA.Buildings self.World.AddFrameEndTask(w => { - if (!self.IsDead()) + if (!self.IsDead) w.Add(new RepairIndicator(self, Info.IndicatorPalettePrefix)); }); } diff --git a/OpenRA.Mods.RA/Crates/GrantUpgradeCrateAction.cs b/OpenRA.Mods.RA/Crates/GrantUpgradeCrateAction.cs index 6a9e7be7dc..6bb2ebfef4 100644 --- a/OpenRA.Mods.RA/Crates/GrantUpgradeCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GrantUpgradeCrateAction.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Crates { foreach (var a in actorsInRange.Append(collector)) { - if (!a.IsInWorld || a.IsDead()) + if (!a.IsInWorld || a.IsDead) continue; var um = a.TraitOrDefault(); diff --git a/OpenRA.Mods.RA/Effects/GpsDot.cs b/OpenRA.Mods.RA/Effects/GpsDot.cs index 6c598fc777..f6321740c3 100644 --- a/OpenRA.Mods.RA/Effects/GpsDot.cs +++ b/OpenRA.Mods.RA/Effects/GpsDot.cs @@ -89,7 +89,7 @@ namespace OpenRA.Mods.RA.Effects world.AddFrameEndTask(w => w.Remove(this)); show = false; - if (!self.IsInWorld || self.IsDead() || self.World.RenderPlayer == null) + if (!self.IsInWorld || self.IsDead || self.World.RenderPlayer == null) return; var gps = watcher[self.World.RenderPlayer]; diff --git a/OpenRA.Mods.RA/Effects/Rank.cs b/OpenRA.Mods.RA/Effects/Rank.cs index 93e43a3645..eb4d52cd17 100644 --- a/OpenRA.Mods.RA/Effects/Rank.cs +++ b/OpenRA.Mods.RA/Effects/Rank.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Effects public void Tick(World world) { - if (self.IsDead()) + if (self.IsDead) world.AddFrameEndTask(w => w.Remove(this)); else anim.Tick(); @@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Effects if (!self.IsInWorld) yield break; - if (self.IsDead()) + if (self.IsDead) yield break; if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) @@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Effects yield break; var pos = wr.ScreenPxPosition(self.CenterPosition); - var bounds = self.Bounds.Value; + var bounds = self.Bounds; bounds.Offset(pos.X, pos.Y); var palette = wr.Palette(paletteName); diff --git a/OpenRA.Mods.RA/Effects/RepairIndicator.cs b/OpenRA.Mods.RA/Effects/RepairIndicator.cs index 9132eb5c8c..a8e6282468 100755 --- a/OpenRA.Mods.RA/Effects/RepairIndicator.cs +++ b/OpenRA.Mods.RA/Effects/RepairIndicator.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Effects public void Tick(World world) { - if (!building.IsInWorld || building.IsDead() || + if (!building.IsInWorld || building.IsDead || rb == null || !rb.Repairers.Any()) world.AddFrameEndTask(w => w.Remove(this)); diff --git a/OpenRA.Mods.RA/ExternalCapturable.cs b/OpenRA.Mods.RA/ExternalCapturable.cs index 09fb9a31c4..c48a671046 100644 --- a/OpenRA.Mods.RA/ExternalCapturable.cs +++ b/OpenRA.Mods.RA/ExternalCapturable.cs @@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { - if (Captor != null && (!Captor.IsInWorld || Captor.IsDead())) + if (Captor != null && (!Captor.IsInWorld || Captor.IsDead)) EndCapture(); if (!CaptureInProgress) diff --git a/OpenRA.Mods.RA/GainsExperience.cs b/OpenRA.Mods.RA/GainsExperience.cs index 3244ed52af..dc524dc614 100644 --- a/OpenRA.Mods.RA/GainsExperience.cs +++ b/OpenRA.Mods.RA/GainsExperience.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.RA { self.World.AddFrameEndTask(w => { - if (!self.IsDead()) + if (!self.IsDead) w.Add(new Rank(self, info.ChevronPalette)); }); } diff --git a/OpenRA.Mods.RA/Guard.cs b/OpenRA.Mods.RA/Guard.cs index 7e749895d2..c5efd43180 100644 --- a/OpenRA.Mods.RA/Guard.cs +++ b/OpenRA.Mods.RA/Guard.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA var target = FriendlyGuardableUnits(world, mi).FirstOrDefault(); - if (target == null || subjects.All(s => s.IsDead())) + if (target == null || subjects.All(s => s.IsDead)) yield break; foreach (var subject in subjects) @@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA public void Tick(World world) { - if (subjects.All(s => s.IsDead() || !s.HasTrait())) + if (subjects.All(s => s.IsDead || !s.HasTrait())) world.CancelInputMode(); } @@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA static IEnumerable FriendlyGuardableUnits(World world, MouseInput mi) { return world.ScreenMap.ActorsAt(mi) - .Where(a => !world.FogObscures(a) && !a.IsDead() && + .Where(a => !world.FogObscures(a) && !a.IsDead && a.AppearsFriendlyTo(world.LocalPlayer.PlayerActor) && a.HasTrait()); } diff --git a/OpenRA.Mods.RA/KillsSelf.cs b/OpenRA.Mods.RA/KillsSelf.cs index 4c5916dae1..29167f67de 100644 --- a/OpenRA.Mods.RA/KillsSelf.cs +++ b/OpenRA.Mods.RA/KillsSelf.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA void Kill() { - if (self.IsDead()) + if (self.IsDead) return; if (info.RemoveInstead || !self.HasTrait()) diff --git a/OpenRA.Mods.RA/Minelayer.cs b/OpenRA.Mods.RA/Minelayer.cs index f7254e3b9a..3bec38b2c7 100644 --- a/OpenRA.Mods.RA/Minelayer.cs +++ b/OpenRA.Mods.RA/Minelayer.cs @@ -166,7 +166,7 @@ namespace OpenRA.Mods.RA public void Tick(World world) { - if (!minelayer.IsInWorld || minelayer.IsDead()) + if (!minelayer.IsInWorld || minelayer.IsDead) world.CancelInputMode(); } diff --git a/OpenRA.Mods.RA/OreRefinery.cs b/OpenRA.Mods.RA/OreRefinery.cs index 89c5ab0688..4c74090fbe 100644 --- a/OpenRA.Mods.RA/OreRefinery.cs +++ b/OpenRA.Mods.RA/OreRefinery.cs @@ -76,14 +76,14 @@ namespace OpenRA.Mods.RA preventDock = true; // Cancel the dock sequence - if (dockedHarv != null && !dockedHarv.IsDead()) + if (dockedHarv != null && !dockedHarv.IsDead) dockedHarv.CancelActivity(); } public void Tick(Actor self) { // Harvester was killed while unloading - if (dockedHarv != null && dockedHarv.IsDead()) + if (dockedHarv != null && dockedHarv.IsDead) { self.Trait().CancelCustomAnim(self); dockedHarv = null; diff --git a/OpenRA.Mods.RA/Player/PlaceBuilding.cs b/OpenRA.Mods.RA/Player/PlaceBuilding.cs index 6bf346ab01..8f68878db2 100644 --- a/OpenRA.Mods.RA/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.RA/Player/PlaceBuilding.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA { var prevItems = GetNumBuildables(self.Owner); - if (order.TargetActor.IsDead()) + if (order.TargetActor.IsDead) return; var unit = self.World.Map.Rules.Actors[order.TargetString]; diff --git a/OpenRA.Mods.RA/Player/PlayerStatistics.cs b/OpenRA.Mods.RA/Player/PlayerStatistics.cs index 9348b17461..6c2b8ac65b 100644 --- a/OpenRA.Mods.RA/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.RA/Player/PlayerStatistics.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA { var total = (double)world.Map.Bounds.Width * world.Map.Bounds.Height; MapControl = world.Actors - .Where(a => !a.IsDead() && a.IsInWorld && a.Owner == player && a.HasTrait()) + .Where(a => !a.IsDead && a.IsInWorld && a.Owner == player && a.HasTrait()) .SelectMany(a => world.Map.FindTilesInCircle( a.Location, a.Trait().Range.Clamp(WRange.Zero, WRange.FromCells(Map.MaxTilesInCircleRange)).Range / 1024)) diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index 80cb25744d..71a2377fe5 100644 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -372,7 +372,7 @@ namespace OpenRA.Mods.RA protected virtual bool BuildUnit(string name) { // Cannot produce if i'm dead - if (!self.IsInWorld || self.IsDead()) + if (!self.IsInWorld || self.IsDead) { CancelProduction(name, 1); return true; diff --git a/OpenRA.Mods.RA/Player/TechTree.cs b/OpenRA.Mods.RA/Player/TechTree.cs index 728c8693b4..2b48cf6692 100755 --- a/OpenRA.Mods.RA/Player/TechTree.cs +++ b/OpenRA.Mods.RA/Player/TechTree.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA // Add all actors that provide prerequisites var prerequisites = player.World.ActorsWithTrait() - .Where(a => a.Actor.Owner == player && a.Actor.IsInWorld && !a.Actor.IsDead()); + .Where(a => a.Actor.Owner == player && a.Actor.IsInWorld && !a.Actor.IsDead); foreach (var b in prerequisites) { @@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA .Where(a => a.Actor.Owner == player && a.Actor.IsInWorld && - !a.Actor.IsDead() && + !a.Actor.IsDead && !ret.ContainsKey(a.Actor.Info.Name) && a.Actor.Info.Traits.Get().BuildLimit > 0) .Do(b => ret[b.Actor.Info.Name].Add(b.Actor)); diff --git a/OpenRA.Mods.RA/PortableChrono.cs b/OpenRA.Mods.RA/PortableChrono.cs index f40a5a55cd..8c55eef747 100644 --- a/OpenRA.Mods.RA/PortableChrono.cs +++ b/OpenRA.Mods.RA/PortableChrono.cs @@ -164,7 +164,7 @@ namespace OpenRA.Mods.RA public void Tick(World world) { - if (!self.IsInWorld || self.IsDead()) + if (!self.IsInWorld || self.IsDead) world.CancelInputMode(); } diff --git a/OpenRA.Mods.RA/Production.cs b/OpenRA.Mods.RA/Production.cs index b334c2ca3b..c1295937c7 100755 --- a/OpenRA.Mods.RA/Production.cs +++ b/OpenRA.Mods.RA/Production.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA public Production(ProductionInfo info, Actor self) { Info = info; - rp = Exts.Lazy(() => self.IsDead() ? null : self.TraitOrDefault()); + rp = Exts.Lazy(() => self.IsDead ? null : self.TraitOrDefault()); } public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string raceVariant) @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA newUnit.SetTargetLine(target, rp.Value != null ? Color.Red : Color.Green, false); - if (!self.IsDead()) + if (!self.IsDead) foreach (var t in self.TraitsImplementing()) t.UnitProduced(self, newUnit, exit); diff --git a/OpenRA.Mods.RA/Render/RenderNameTag.cs b/OpenRA.Mods.RA/Render/RenderNameTag.cs index f91cb27029..5fbb6883e0 100644 --- a/OpenRA.Mods.RA/Render/RenderNameTag.cs +++ b/OpenRA.Mods.RA/Render/RenderNameTag.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Render public IEnumerable Render(Actor self, WorldRenderer wr) { var pos = wr.ScreenPxPosition(self.CenterPosition); - var bounds = self.Bounds.Value; + var bounds = self.Bounds; bounds.Offset(pos.X, pos.Y); var spaceBuffer = (int)(10 / wr.Viewport.Zoom); var effectPos = wr.Position(new int2(pos.X, bounds.Y - spaceBuffer)); diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index 53d5068148..6e70f2ef49 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA.Render public void Tick(Actor self) { - var isFlying = movement.IsMoving && !self.IsDead(); + var isFlying = movement.IsMoving && !self.IsDead; if (isFlying ^ (rotorAnim.CurrentSequence.Name != info.Sequence)) return; diff --git a/OpenRA.Mods.RA/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/GeneralProperties.cs index 54b2d6739e..6b25b45e23 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/GeneralProperties.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Scripting } [Desc("Specifies whether the actor is alive or dead.")] - public bool IsDead { get { return self.IsDead(); } } + public bool IsDead { get { return self.IsDead; } } [Desc("Specifies whether the actor is idle (not performing any activities).")] public bool IsIdle { get { return self.IsIdle; } } diff --git a/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs index b43ab9b491..a123c81999 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/PlayerProperties.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Scripting public Actor[] GetGroundAttackers() { return player.World.ActorsWithTrait().Select(a => a.Actor) - .Where(a => a.Owner == player && !a.IsDead() && a.IsInWorld && a.HasTrait()) + .Where(a => a.Owner == player && !a.IsDead && a.IsInWorld && a.HasTrait()) .ToArray(); } } diff --git a/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs index 8e13f83772..8133ae0f94 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/ProductionProperties.cs @@ -129,7 +129,7 @@ namespace OpenRA.Mods.RA.Scripting if (squad.Count >= squadSize) { using (func) - using (var luaSquad = squad.Where(u => !u.IsDead()).ToArray().ToLuaValue(context)) + using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(context)) func.Call(luaSquad).Dispose(); triggers.OnProducedInternal -= productionHandler; @@ -230,7 +230,7 @@ namespace OpenRA.Mods.RA.Scripting if (squad.Count >= squadSize) { using (func) - using (var luaSquad = squad.Where(u => !u.IsDead()).ToArray().ToLuaValue(context)) + using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(context)) func.Call(luaSquad).Dispose(); foreach (var q in queueTypes) diff --git a/OpenRA.Mods.RA/SelfHealing.cs b/OpenRA.Mods.RA/SelfHealing.cs index 88b5c7da33..4791ac82d6 100644 --- a/OpenRA.Mods.RA/SelfHealing.cs +++ b/OpenRA.Mods.RA/SelfHealing.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { - if (self.IsDead() || disabled) + if (self.IsDead || disabled) return; if (health.HP >= info.HealIfBelow * health.MaxHP) diff --git a/OpenRA.Mods.RA/Traits/Air/Aircraft.cs b/OpenRA.Mods.RA/Traits/Air/Aircraft.cs index b4fac4825d..e5ea53f0c4 100644 --- a/OpenRA.Mods.RA/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Traits/Air/Aircraft.cs @@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Traits return WVec.Zero; return self.World.FindActorsInCircle(self.CenterPosition, info.IdealSeparation) - .Where(a => !a.IsDead() && a.HasTrait()) + .Where(a => !a.IsDead && a.HasTrait()) .Select(GetRepulsionForce) .Aggregate(WVec.Zero, (a, b) => a + b); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs index 67eef99fe5..82f6c74e3f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ObserverStatsLogic.cs @@ -244,11 +244,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic var assets = template.Get("ASSETS"); assets.GetText = () => "$" + world.Actors - .Where(a => a.Owner == player && !a.IsDead() && a.Info.Traits.WithInterface().Any()) + .Where(a => a.Owner == player && !a.IsDead && a.Info.Traits.WithInterface().Any()) .Sum(a => a.Info.Traits.WithInterface().First().Cost); var harvesters = template.Get("HARVESTERS"); - harvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead() && a.HasTrait()).ToString(); + harvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead && a.HasTrait()).ToString(); return template; } @@ -282,7 +282,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { return ScrollItemWidget.Setup(template, () => false, () => { - var playerBase = world.Actors.FirstOrDefault(a => !a.IsDead() && a.HasTrait() && a.Owner == player); + var playerBase = world.Actors.FirstOrDefault(a => !a.IsDead && a.HasTrait() && a.Owner == player); if (playerBase != null) worldRenderer.Viewport.Center(playerBase.CenterPosition); }); diff --git a/OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs b/OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs index d56a9c1a22..5ff7f3f744 100644 --- a/OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Widgets public SupportPowerTimerWidget(World world) { powers = world.ActorsWithTrait() - .Where(p => !p.Actor.IsDead() && !p.Actor.Owner.NonCombatant) + .Where(p => !p.Actor.IsDead && !p.Actor.Owner.NonCombatant) .SelectMany(s => s.Trait.Powers.Values) .Where(p => p.Instances.Any() && p.Info.DisplayTimer && !p.Disabled); } diff --git a/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs b/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs index 4c3a6a24d6..7dc111b76f 100644 --- a/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs +++ b/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs @@ -43,18 +43,18 @@ namespace OpenRA.Mods.TS state = State.Dock; return Util.SequenceActivities(new Turn(self, 160), this); case State.Dock: - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Docked(proc, self); state = State.Loop; body.Docked = true; return this; case State.Loop: - if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc)) + if (!proc.IsInWorld || proc.IsDead || harv.TickUnload(self, proc)) state = State.Undock; return this; case State.Undock: - if (proc.IsInWorld && !proc.IsDead()) + if (proc.IsInWorld && !proc.IsDead) foreach (var nd in proc.TraitsImplementing()) nd.Undocked(proc, self); body.Docked = false;