moved Game.players, LocalPlayer, localPlayerIndex to World. Setting LocalPlayer via settings is broken.
This commit is contained in:
@@ -12,7 +12,7 @@ namespace OpenRa.Traits.Activities
|
||||
{
|
||||
self.Health = 0;
|
||||
Game.world.Remove( self );
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
if (self.Owner == Game.world.LocalPlayer)
|
||||
{
|
||||
Sound.Play("placbldg.aud");
|
||||
Sound.Play("build5.aud");
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace OpenRa.Traits
|
||||
self.CancelActivity();
|
||||
QueueAttack(self, order);
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
if (self.Owner == Game.world.LocalPlayer)
|
||||
Game.world.AddFrameEndTask(w => w.Add(new FlashTarget(order.TargetActor)));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRa.Traits
|
||||
if (remainingUncloakTime > 0)
|
||||
return rs;
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
if (self.Owner == Game.world.LocalPlayer)
|
||||
return rs.Select(a => a.WithPalette(PaletteType.Shadow));
|
||||
else
|
||||
return new Renderable[] { };
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace OpenRa.Traits
|
||||
{
|
||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||
{
|
||||
return Game.LocalPlayer == self.Owner
|
||||
return Game.world.LocalPlayer == self.Owner
|
||||
? r : new Renderable[] { };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRa.Traits
|
||||
return;
|
||||
|
||||
Game.world.CreateActor( order.TargetString, order.TargetLocation, order.Player );
|
||||
if (order.Player == Game.LocalPlayer)
|
||||
if (order.Player == Game.world.LocalPlayer)
|
||||
{
|
||||
Sound.Play("placbldg.aud");
|
||||
Sound.Play("build5.aud");
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRa.Traits
|
||||
_ =>
|
||||
{
|
||||
var isBuilding = unit.Traits.Contains<BuildingInfo>();
|
||||
if( !hasPlayedSound && order.Player == Game.LocalPlayer )
|
||||
if( !hasPlayedSound && order.Player == Game.world.LocalPlayer )
|
||||
{
|
||||
Sound.Play( isBuilding ? "conscmp1.aud" : "unitrdy1.aud" );
|
||||
hasPlayedSound = true;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRa.Traits
|
||||
public IEnumerable<Renderable> Render(Actor self)
|
||||
{
|
||||
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
|
||||
if (uog != null && self.Owner == Game.LocalPlayer && uog.selection.Contains(self))
|
||||
if (uog != null && self.Owner == Game.world.LocalPlayer && uog.selection.Contains(self))
|
||||
yield return Util.Centered(self,
|
||||
anim.Image, Util.CenterOfCell(rallyPoint));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRa.Traits
|
||||
|
||||
public bool IsCrushableBy(UnitMovementType umt, Player player)
|
||||
{
|
||||
if (player == Game.LocalPlayer) return false;
|
||||
if (player == Game.world.LocalPlayer) return false;
|
||||
switch (umt)
|
||||
{
|
||||
case UnitMovementType.Track: return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRa.Traits
|
||||
self.Owner.TakeCash(toSteal);
|
||||
thief.Owner.GiveCash(toSteal);
|
||||
|
||||
if (Game.LocalPlayer == thief.Owner)
|
||||
if (Game.world.LocalPlayer == thief.Owner)
|
||||
Sound.Play("credit1.aud");
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRa.Traits
|
||||
var numPips = self.Info.Traits.Get<StoresOreInfo>().Pips;
|
||||
|
||||
return Graphics.Util.MakeArray( numPips,
|
||||
i => (Game.LocalPlayer.GetSiloFullness() > i * 1.0f / numPips)
|
||||
i => (Game.world.LocalPlayer.GetSiloFullness() > i * 1.0f / numPips)
|
||||
? PipType.Yellow : PipType.Transparent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRa.Traits
|
||||
if (remainingSurfaceTime > 0)
|
||||
return rs;
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
if (self.Owner == Game.world.LocalPlayer)
|
||||
return rs.Select(a => a.WithPalette(PaletteType.Shadow));
|
||||
else
|
||||
return new Renderable[] { };
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRa.Traits
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (e.DamageState == DamageState.Dead)
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
if (self.Owner == Game.world.LocalPlayer)
|
||||
Sound.Play(self.Info.Traits.Get<OwnedActorInfo>().WaterBound
|
||||
? "navylst1.aud" : "unitlst1.aud");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user