CashTrickler style fixes and Period -> Interval rename
This commit is contained in:
@@ -18,12 +18,17 @@ namespace OpenRA.Mods.Common.Traits
|
||||
class CashTricklerInfo : ConditionalTraitInfo
|
||||
{
|
||||
[Desc("Number of ticks to wait between giving money.")]
|
||||
public readonly int Period = 50;
|
||||
public readonly int Interval = 50;
|
||||
|
||||
[Desc("Amount of money to give each time.")]
|
||||
public readonly int Amount = 15;
|
||||
[Desc("Whether to show the cash tick indicators (+$15 rising from actor).")]
|
||||
|
||||
[Desc("Whether to show the cash tick indicators rising from the actor.")]
|
||||
public readonly bool ShowTicks = true;
|
||||
|
||||
[Desc("How long to show the cash tick indicator when enabled.")]
|
||||
public readonly int DisplayDuration = 30;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CashTrickler(this); }
|
||||
}
|
||||
|
||||
@@ -31,29 +36,32 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
readonly CashTricklerInfo info;
|
||||
[Sync] int ticks;
|
||||
|
||||
public CashTrickler(CashTricklerInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
if (IsTraitDisabled)
|
||||
return;
|
||||
|
||||
if (--ticks < 0)
|
||||
{
|
||||
ticks = info.Period;
|
||||
ticks = info.Interval;
|
||||
self.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(info.Amount);
|
||||
MaybeAddCashTick(self, info.Amount);
|
||||
|
||||
if (info.ShowTicks)
|
||||
AddCashTick(self, info.Amount);
|
||||
}
|
||||
}
|
||||
|
||||
void MaybeAddCashTick(Actor self, int amount)
|
||||
void AddCashTick(Actor self, int amount)
|
||||
{
|
||||
if (info.ShowTicks)
|
||||
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(amount), 30)));
|
||||
self.World.AddFrameEndTask(w => w.Add(
|
||||
new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(amount), info.DisplayDuration)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,6 +740,10 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Nodes.Add(gcoc);
|
||||
RenameNodeKey(capture, "Amount");
|
||||
}
|
||||
|
||||
var period = trickler.Value.Nodes.FirstOrDefault(n => n.Key == "Period");
|
||||
if (period != null)
|
||||
period.Key = "Interval";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ MNLYR:
|
||||
Offset: 0,0
|
||||
Facing: 96
|
||||
CashTrickler:
|
||||
Period: 150
|
||||
Interval: 150
|
||||
Amount: 20
|
||||
RenderSprites:
|
||||
Image: MNLY
|
||||
@@ -108,7 +108,7 @@ FTUR:
|
||||
MustBeDestroyed:
|
||||
RequiredForShortGame: true
|
||||
CashTrickler:
|
||||
Period: 150
|
||||
Interval: 150
|
||||
Amount: 30
|
||||
ChronoshiftPower:
|
||||
Icon: chrono
|
||||
|
||||
@@ -117,7 +117,7 @@ OILB:
|
||||
RevealsShroud:
|
||||
Range: 3c0
|
||||
CashTrickler:
|
||||
Period: 250
|
||||
Interval: 250
|
||||
Amount: 50
|
||||
|
||||
MOBILETENT:
|
||||
|
||||
@@ -364,7 +364,7 @@ OILB:
|
||||
ExternalCapturableBar:
|
||||
EngineerRepairable:
|
||||
CashTrickler:
|
||||
Period: 375
|
||||
Interval: 375
|
||||
Amount: 100
|
||||
Tooltip:
|
||||
Name: Oil Derrick
|
||||
|
||||
Reference in New Issue
Block a user