CashTrickler can be cloaked
This commit is contained in:
@@ -49,6 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
readonly CashTricklerInfo info;
|
||||
PlayerResources resources;
|
||||
Cloak[] cloaks;
|
||||
|
||||
[Sync]
|
||||
public int Ticks { get; private set; }
|
||||
|
||||
@@ -62,6 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected override void Created(Actor self)
|
||||
{
|
||||
resources = self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||
cloaks = self.TraitsImplementing<Cloak>().ToArray();
|
||||
|
||||
base.Created(self);
|
||||
}
|
||||
@@ -105,6 +108,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
else
|
||||
amount = resources.ChangeCash(amount);
|
||||
|
||||
if (cloaks.Length != 0 && !cloaks.Any(c => c.IsVisible(self, self.World.RenderPlayer)))
|
||||
return;
|
||||
|
||||
if (info.ShowTicks && amount != 0)
|
||||
AddCashTick(self, amount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user