make cash ticks consistent with per-player shroud and observers

This commit is contained in:
Matthias Mailänder
2013-05-11 13:01:33 +02:00
parent 05d187d327
commit f4a4afbb69
4 changed files with 5 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Activities
foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Sold(self);
if (refund > 0 && self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
if (refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new CashTick(refund, 30, 2, self.CenterLocation, self.Owner.Color.RGB)));
self.Destroy();
@@ -39,6 +39,6 @@ namespace OpenRA.Mods.RA.Activities
}
// Cannot be cancelled
public override void Cancel( Actor self ) { }
public override void Cancel(Actor self) { }
}
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Effects
static string FormatCashAmount(int x) { return "{0}${1}".F(x < 0 ? "-" : "+", x); }
public CashTick(int value, int lifetime, int velocity, PPos pos, Color color)
: this( FormatCashAmount(value), lifetime, velocity, pos, color ) { }
: this(FormatCashAmount(value), lifetime, velocity, pos, color) { }
public CashTick(string value, int lifetime, int velocity, PPos pos, Color color)
{

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA
// 2 hundreds because of GetMultiplier and info.Percentage.
var bounty = cost * GetMultiplier(self) * info.Percentage / 10000;
if (bounty > 0 && e.Attacker.World.LocalPlayer != null && e.Attacker.Owner.Stances[e.Attacker.World.LocalPlayer] == Stance.Ally)
if (bounty > 0 && e.Attacker.Owner.IsAlliedWith(self.World.RenderPlayer))
e.Attacker.World.AddFrameEndTask(w => w.Add(new CashTick(bounty, 20, 1, self.CenterLocation, e.Attacker.Owner.Color.RGB)));
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(bounty);

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA
if (Info.ShowTicks && currentDisplayValue > 0 && --currentDisplayTick <= 0)
{
var temp = currentDisplayValue;
if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new CashTick(temp, Info.TickLifetime, Info.TickVelocity, self.CenterLocation, self.Owner.Color.RGB)));
currentDisplayTick = Info.TickRate;
currentDisplayValue = 0;