@@ -14,7 +14,7 @@ using OpenRA.FileFormats;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
[Desc("Let's the object generate cash in a set periodic time.")]
|
[Desc("Lets the actor generate cash in a set periodic time.")]
|
||||||
class CashTricklerInfo : ITraitInfo
|
class CashTricklerInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Amount of money to give each time.")]
|
[Desc("Amount of money to give each time.")]
|
||||||
@@ -27,11 +27,13 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int TickLifetime = 30;
|
public readonly int TickLifetime = 30;
|
||||||
[Desc("Pixels/tick upward movement of the cash tick indicator.")]
|
[Desc("Pixels/tick upward movement of the cash tick indicator.")]
|
||||||
public readonly int TickVelocity = 1;
|
public readonly int TickVelocity = 1;
|
||||||
|
[Desc("Amount of money awarded for capturing the actor.")]
|
||||||
|
public readonly int CaptureAmount = 0;
|
||||||
|
|
||||||
public object Create (ActorInitializer init) { return new CashTrickler(this); }
|
public object Create (ActorInitializer init) { return new CashTrickler(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class CashTrickler : ITick, ISync
|
class CashTrickler : ITick, ISync, INotifyCapture
|
||||||
{
|
{
|
||||||
[Sync] int ticks;
|
[Sync] int ticks;
|
||||||
CashTricklerInfo Info;
|
CashTricklerInfo Info;
|
||||||
@@ -44,11 +46,25 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
if (--ticks < 0)
|
if (--ticks < 0)
|
||||||
{
|
{
|
||||||
self.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(Info.Amount);
|
|
||||||
ticks = Info.Period;
|
ticks = Info.Period;
|
||||||
if (Info.ShowTicks)
|
self.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(Info.Amount);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new CashTick(Info.Amount, Info.TickLifetime, Info.TickVelocity, self.CenterLocation, self.Owner.Color.RGB)));
|
MaybeAddCashTick(self, Info.Amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||||
|
{
|
||||||
|
if (Info.CaptureAmount > 0)
|
||||||
|
{
|
||||||
|
newOwner.PlayerActor.Trait<PlayerResources>().GiveCash(Info.CaptureAmount);
|
||||||
|
MaybeAddCashTick(self, Info.CaptureAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaybeAddCashTick(Actor self, int amount)
|
||||||
|
{
|
||||||
|
if (Info.ShowTicks)
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(new CashTick(amount, Info.TickLifetime, Info.TickVelocity, self.CenterLocation, self.Owner.Color.RGB)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,6 @@ BIO:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Biological Lab
|
Name: Biological Lab
|
||||||
|
|
||||||
|
|
||||||
OILB:
|
OILB:
|
||||||
Inherits: ^TechBuilding
|
Inherits: ^TechBuilding
|
||||||
Selectable:
|
Selectable:
|
||||||
@@ -299,7 +298,7 @@ OILB:
|
|||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
Health:
|
Health:
|
||||||
HP: 400
|
HP: 1000
|
||||||
Armor:
|
Armor:
|
||||||
Type: Wood
|
Type: Wood
|
||||||
Bib:
|
Bib:
|
||||||
@@ -311,7 +310,8 @@ OILB:
|
|||||||
-MustBeDestroyed:
|
-MustBeDestroyed:
|
||||||
CashTrickler:
|
CashTrickler:
|
||||||
Period: 250
|
Period: 250
|
||||||
Amount: 50
|
Amount: 100
|
||||||
|
CaptureAmount: 500
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Oil Derrick
|
Name: Oil Derrick
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user