CashTrickler can be cloaked

This commit is contained in:
Gustas
2025-01-03 14:44:18 +02:00
committed by Paul Chote
parent fe2c227270
commit 0da4766300

View File

@@ -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);
}