Ore pips on refinery and silo

This commit is contained in:
Paul Chote
2009-12-21 19:13:54 -08:00
parent f20ecc8a5d
commit 0c79363dcc
5 changed files with 37 additions and 3 deletions

View File

@@ -50,6 +50,7 @@ namespace OpenRa.Game.GameRules
public readonly bool Selectable = true; public readonly bool Selectable = true;
public readonly int FireDelay = 0; public readonly int FireDelay = 0;
public readonly string LongDesc = null; public readonly string LongDesc = null;
public readonly int OrePips = 0;
public UnitInfo(string name) { Name = name; } public UnitInfo(string name) { Name = name; }
} }

View File

@@ -191,6 +191,7 @@
<Compile Include="Traits\RenderUnitSpinner.cs" /> <Compile Include="Traits\RenderUnitSpinner.cs" />
<Compile Include="Traits\RenderUnitTurreted.cs" /> <Compile Include="Traits\RenderUnitTurreted.cs" />
<Compile Include="Traits\SeedsOre.cs" /> <Compile Include="Traits\SeedsOre.cs" />
<Compile Include="Traits\StoresOre.cs" />
<Compile Include="Traits\Submarine.cs" /> <Compile Include="Traits\Submarine.cs" />
<Compile Include="Traits\TakeCover.cs" /> <Compile Include="Traits\TakeCover.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" /> <Compile Include="Traits\TraitsInterfaces.cs" />

View File

@@ -76,7 +76,7 @@ namespace OpenRa.Game
public int GetOreCapacity() public int GetOreCapacity()
{ {
return Game.world.Actors return Game.world.Actors
.Where(a => a.Owner == this) .Where(a => a.Owner == this && a.traits.Contains<StoresOre>())
.Select(a => a.Info as BuildingInfo) .Select(a => a.Info as BuildingInfo)
.Where(b => b != null) .Where(b => b != null)
.Sum(b => b.Storage); .Sum(b => b.Storage);

View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace OpenRa.Game.Traits
{
class StoresOre : IPips
{
readonly Actor self;
public StoresOre(Actor self)
{
this.self = self;
}
public IEnumerable<PipType> GetPips()
{
if (self.Info.OrePips == 0) yield break;
for (int i = 0; i < self.Info.OrePips; i++)
{
if (Game.LocalPlayer.GetSiloFullness() > i * 1.0f / self.Info.OrePips)
{
yield return PipType.Yellow;
continue;
}
yield return PipType.Transparent;
}
}
}
}

View File

@@ -364,18 +364,21 @@ SelectionPriority=3
LongDesc=Produces other structures LongDesc=Produces other structures
[PROC] [PROC]
Description=Ore Refinery Description=Ore Refinery
Traits=Building, RenderBuilding, AcceptsOre Traits=Building, RenderBuilding, AcceptsOre, StoresOre
Dimensions=3,3 Dimensions=3,3
Footprint=_x_ xxx x== Footprint=_x_ xxx x==
SelectionPriority=3 SelectionPriority=3
OrePips=18
LongDesc=Converts Ore and Gems into money LongDesc=Converts Ore and Gems into money
[SILO] [SILO]
Description=Silo Description=Silo
Traits=Building, RenderBuildingOre Traits=Building, RenderBuildingOre, StoresOre
Dimensions=1,1 Dimensions=1,1
Footprint=x Footprint=x
SelectionPriority=3 SelectionPriority=3
OrePips=5
LongDesc=Stores excess harvested Ore LongDesc=Stores excess harvested Ore
[HPAD] [HPAD]
Description=Helipad Description=Helipad
Traits=Building, RenderBuilding, Production Traits=Building, RenderBuilding, Production