make cash ticks consistent with per-player shroud and observers
This commit is contained in:
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
||||||
ns.Sold(self);
|
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.World.AddFrameEndTask(w => w.Add(new CashTick(refund, 30, 2, self.CenterLocation, self.Owner.Color.RGB)));
|
||||||
|
|
||||||
self.Destroy();
|
self.Destroy();
|
||||||
@@ -39,6 +39,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cannot be cancelled
|
// Cannot be cancelled
|
||||||
public override void Cancel( Actor self ) { }
|
public override void Cancel(Actor self) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
static string FormatCashAmount(int x) { return "{0}${1}".F(x < 0 ? "-" : "+", x); }
|
static string FormatCashAmount(int x) { return "{0}${1}".F(x < 0 ? "-" : "+", x); }
|
||||||
|
|
||||||
public CashTick(int value, int lifetime, int velocity, PPos pos, Color color)
|
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)
|
public CashTick(string value, int lifetime, int velocity, PPos pos, Color color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA
|
|||||||
// 2 hundreds because of GetMultiplier and info.Percentage.
|
// 2 hundreds because of GetMultiplier and info.Percentage.
|
||||||
var bounty = cost * GetMultiplier(self) * info.Percentage / 10000;
|
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.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);
|
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(bounty);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (Info.ShowTicks && currentDisplayValue > 0 && --currentDisplayTick <= 0)
|
if (Info.ShowTicks && currentDisplayValue > 0 && --currentDisplayTick <= 0)
|
||||||
{
|
{
|
||||||
var temp = currentDisplayValue;
|
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)));
|
self.World.AddFrameEndTask(w => w.Add(new CashTick(temp, Info.TickLifetime, Info.TickVelocity, self.CenterLocation, self.Owner.Color.RGB)));
|
||||||
currentDisplayTick = Info.TickRate;
|
currentDisplayTick = Info.TickRate;
|
||||||
currentDisplayValue = 0;
|
currentDisplayValue = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user