Restore ra proc behavior

This commit is contained in:
Paul Chote
2010-06-16 20:00:38 +12:00
parent 5ed8113d8e
commit 01e95b67d6
3 changed files with 20 additions and 10 deletions

View File

@@ -29,6 +29,7 @@ namespace OpenRA.Mods.RA
{ {
class OreRefineryInfo : ITraitInfo class OreRefineryInfo : ITraitInfo
{ {
public readonly bool LocalStorage = false;
public readonly int PipCount = 0; public readonly int PipCount = 0;
public readonly PipType PipColor = PipType.Red; public readonly PipType PipColor = PipType.Red;
public readonly int2 DockOffset = new int2 (1, 2); public readonly int2 DockOffset = new int2 (1, 2);
@@ -74,20 +75,29 @@ namespace OpenRA.Mods.RA
} }
public void GiveOre (int amount) public void GiveOre (int amount)
{
if (!Info.LocalStorage)
Player.GiveOre(amount);
else
{ {
Ore += amount; Ore += amount;
if (Ore > Info.Capacity) if (Ore > Info.Capacity)
Ore = Info.Capacity; Ore = Info.Capacity;
} }
}
public void Tick (Actor self) public void Tick (Actor self)
{ {
if (!Info.LocalStorage)
return;
if (--nextProcessTime <= 0) { if (--nextProcessTime <= 0) {
// Convert resources to cash // Convert resources to cash
int amount = Math.Min (Ore, Info.ProcessAmount); int amount = Math.Min (Ore, Info.ProcessAmount);
amount = Math.Min (amount, Player.OreCapacity - Player.Ore); amount = Math.Min (amount, Player.OreCapacity - Player.Ore);
if (amount > 0) { if (amount > 0)
{
Ore -= amount; Ore -= amount;
Player.GiveOre (amount); Player.GiveOre (amount);
} }
@@ -132,6 +142,9 @@ namespace OpenRA.Mods.RA
public IEnumerable<PipType> GetPips (Actor self) public IEnumerable<PipType> GetPips (Actor self)
{ {
if (!Info.LocalStorage)
return new PipType[] { };
return Graphics.Util.MakeArray (Info.PipCount, i => (Ore * 1f / Info.Capacity > i * 1f / Info.PipCount) ? Info.PipColor : PipType.Transparent); return Graphics.Util.MakeArray (Info.PipCount, i => (Ore * 1f / Info.Capacity > i * 1f / Info.PipCount) ? Info.PipColor : PipType.Transparent);
} }
} }

View File

@@ -46,7 +46,7 @@ PROC.proxy:
Owner: gdi,nod Owner: gdi,nod
Cost: 2300 Cost: 2300
Description: Tiberium Refinery Description: Tiberium Refinery
LongDesc: Processes Tiberium into useable resources LongDesc: Processes raw Tiberium into useable resources
Building: Building:
Power: -50 Power: -50
Footprint: ___xx xxxxx xxx__ xxx__ Footprint: ___xx xxxxx xxx__ xxx__
@@ -64,7 +64,7 @@ PROC:
Valued: Valued:
Cost: 2000 Cost: 2000
Description: Tiberium Refinery Description: Tiberium Refinery
LongDesc: Processes Tiberium into useable resources LongDesc: Processes raw Tiberium into useable resources
Building: Building:
Power: -30 Power: -30
Footprint: ___ xxx === Footprint: ___ xxx ===
@@ -76,6 +76,7 @@ PROC:
Sight: 6 Sight: 6
Bib: Bib:
OreRefinery: OreRefinery:
LocalStorage: yes
PipCount: 15 PipCount: 15
PipColor: Red PipColor: Red
DockOffset: 0,2 DockOffset: 0,2

View File

@@ -468,10 +468,6 @@ PROC:
Sight: 6 Sight: 6
Bib: Bib:
OreRefinery: OreRefinery:
PipCount: 17
Capacity: 1000
ProcessTick: 25
ProcessAmount: 50
OreRefineryDockAction: OreRefineryDockAction:
StoresOre: StoresOre:
PipCount: 17 PipCount: 17