Actor properties consistency improved
This commit is contained in:
@@ -475,7 +475,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
|
||||
List<Actor> 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<BaseBuilding>() && !a.HasTrait<Mobile>()).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)
|
||||
{
|
||||
|
||||
@@ -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<ITargetable>() && leader.Owner.Stances[a1.Owner] == Stance.Enemy).ToList();
|
||||
if (enemynearby.Any())
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Building>();
|
||||
@@ -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<Health>();
|
||||
|
||||
@@ -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<IDamageModifier>()
|
||||
|
||||
@@ -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<PlayerResources>().GiveCash(payload);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var capturable = target.Actor.Trait<ExternalCapturable>();
|
||||
|
||||
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;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
public Hunt(Actor self)
|
||||
{
|
||||
var attack = self.Trait<AttackBase>();
|
||||
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<Huntable>() && attack.HasAnyValidWeapons(Target.FromActor(a)));
|
||||
}
|
||||
|
||||
|
||||
@@ -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<INotifyInfiltrated>())
|
||||
|
||||
@@ -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<INotifyDocking>())
|
||||
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<INotifyDocking>())
|
||||
nd.Undocked(proc, self);
|
||||
return NextActivity;
|
||||
|
||||
@@ -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<INotifyTransform>())
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
|
||||
if (stance == Stance.Ally)
|
||||
return true;
|
||||
|
||||
if (self.IsDisguised() && !toActor.HasTrait<IgnoresDisguise>())
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait<IgnoresDisguise>())
|
||||
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<IgnoresDisguise>())
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait<IgnoresDisguise>())
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy;
|
||||
|
||||
return stance == Stance.Enemy;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<UpgradeManager>();
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<Guard>()))
|
||||
if (subjects.All(s => s.IsDead || !s.HasTrait<Guard>()))
|
||||
world.CancelInputMode();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
|
||||
static IEnumerable<Actor> 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<Guardable>());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
void Kill()
|
||||
{
|
||||
if (self.IsDead())
|
||||
if (self.IsDead)
|
||||
return;
|
||||
|
||||
if (info.RemoveInstead || !self.HasTrait<Health>())
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<RenderBuilding>().CancelCustomAnim(self);
|
||||
dockedHarv = null;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<RevealsShroud>())
|
||||
.Where(a => !a.IsDead && a.IsInWorld && a.Owner == player && a.HasTrait<RevealsShroud>())
|
||||
.SelectMany(a => world.Map.FindTilesInCircle(
|
||||
a.Location,
|
||||
a.Trait<RevealsShroud>().Range.Clamp(WRange.Zero, WRange.FromCells(Map.MaxTilesInCircleRange)).Range / 1024))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
// Add all actors that provide prerequisites
|
||||
var prerequisites = player.World.ActorsWithTrait<ITechTreePrerequisite>()
|
||||
.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<BuildableInfo>().BuildLimit > 0)
|
||||
.Do(b => ret[b.Actor.Info.Name].Add(b.Actor));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA
|
||||
public Production(ProductionInfo info, Actor self)
|
||||
{
|
||||
Info = info;
|
||||
rp = Exts.Lazy(() => self.IsDead() ? null : self.TraitOrDefault<RallyPoint>());
|
||||
rp = Exts.Lazy(() => self.IsDead ? null : self.TraitOrDefault<RallyPoint>());
|
||||
}
|
||||
|
||||
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<INotifyProduction>())
|
||||
t.UnitProduced(self, newUnit, exit);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public IEnumerable<IRenderable> 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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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; } }
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
public Actor[] GetGroundAttackers()
|
||||
{
|
||||
return player.World.ActorsWithTrait<AttackBase>().Select(a => a.Actor)
|
||||
.Where(a => a.Owner == player && !a.IsDead() && a.IsInWorld && a.HasTrait<Mobile>())
|
||||
.Where(a => a.Owner == player && !a.IsDead && a.IsInWorld && a.HasTrait<Mobile>())
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Aircraft>())
|
||||
.Where(a => !a.IsDead && a.HasTrait<Aircraft>())
|
||||
.Select(GetRepulsionForce)
|
||||
.Aggregate(WVec.Zero, (a, b) => a + b);
|
||||
}
|
||||
|
||||
@@ -244,11 +244,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
var assets = template.Get<LabelWidget>("ASSETS");
|
||||
assets.GetText = () => "$" + world.Actors
|
||||
.Where(a => a.Owner == player && !a.IsDead() && a.Info.Traits.WithInterface<ValuedInfo>().Any())
|
||||
.Where(a => a.Owner == player && !a.IsDead && a.Info.Traits.WithInterface<ValuedInfo>().Any())
|
||||
.Sum(a => a.Info.Traits.WithInterface<ValuedInfo>().First().Cost);
|
||||
|
||||
var harvesters = template.Get<LabelWidget>("HARVESTERS");
|
||||
harvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead() && a.HasTrait<Harvester>()).ToString();
|
||||
harvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead && a.HasTrait<Harvester>()).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<BaseBuilding>() && a.Owner == player);
|
||||
var playerBase = world.Actors.FirstOrDefault(a => !a.IsDead && a.HasTrait<BaseBuilding>() && a.Owner == player);
|
||||
if (playerBase != null)
|
||||
worldRenderer.Viewport.Center(playerBase.CenterPosition);
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
public SupportPowerTimerWidget(World world)
|
||||
{
|
||||
powers = world.ActorsWithTrait<SupportPowerManager>()
|
||||
.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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user