Make CashTrickler PausableConditional
This commit is contained in:
committed by
reaperrr
parent
049096efd7
commit
a4b0bf5c52
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Lets the actor generate cash in a set periodic time.")]
|
[Desc("Lets the actor generate cash in a set periodic time.")]
|
||||||
public class CashTricklerInfo : ConditionalTraitInfo
|
public class CashTricklerInfo : PausableConditionalTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Number of ticks to wait between giving money.")]
|
[Desc("Number of ticks to wait between giving money.")]
|
||||||
public readonly int Interval = 50;
|
public readonly int Interval = 50;
|
||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public override object Create(ActorInitializer init) { return new CashTrickler(this); }
|
public override object Create(ActorInitializer init) { return new CashTrickler(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CashTrickler : ConditionalTrait<CashTricklerInfo>, ITick, ISync, INotifyCreated, INotifyOwnerChanged
|
public class CashTrickler : PausableConditionalTrait<CashTricklerInfo>, ITick, ISync, INotifyCreated, INotifyOwnerChanged
|
||||||
{
|
{
|
||||||
readonly CashTricklerInfo info;
|
readonly CashTricklerInfo info;
|
||||||
PlayerResources resources;
|
PlayerResources resources;
|
||||||
@@ -64,6 +64,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
|
ticks = info.Interval;
|
||||||
|
|
||||||
|
if (IsTraitPaused || IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (--ticks < 0)
|
if (--ticks < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user