diff --git a/OpenRa.Game/GameRules/UnitInfo.cs b/OpenRa.Game/GameRules/UnitInfo.cs index a13e9c46d7..ca761b22cf 100755 --- a/OpenRa.Game/GameRules/UnitInfo.cs +++ b/OpenRa.Game/GameRules/UnitInfo.cs @@ -50,6 +50,7 @@ namespace OpenRa.Game.GameRules public readonly bool Selectable = true; public readonly int FireDelay = 0; public readonly string LongDesc = null; + public readonly int OrePips = 0; public UnitInfo(string name) { Name = name; } } diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 859e7a8d31..7443d3d350 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -191,6 +191,7 @@ + diff --git a/OpenRa.Game/Player.cs b/OpenRa.Game/Player.cs index abd3e1400e..e29dd217d9 100644 --- a/OpenRa.Game/Player.cs +++ b/OpenRa.Game/Player.cs @@ -76,7 +76,7 @@ namespace OpenRa.Game public int GetOreCapacity() { return Game.world.Actors - .Where(a => a.Owner == this) + .Where(a => a.Owner == this && a.traits.Contains()) .Select(a => a.Info as BuildingInfo) .Where(b => b != null) .Sum(b => b.Storage); diff --git a/OpenRa.Game/Traits/StoresOre.cs b/OpenRa.Game/Traits/StoresOre.cs new file mode 100644 index 0000000000..322355e76c --- /dev/null +++ b/OpenRa.Game/Traits/StoresOre.cs @@ -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 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; + } + } + } +} diff --git a/units.ini b/units.ini index ea2daf0ee1..be36601dbc 100755 --- a/units.ini +++ b/units.ini @@ -364,18 +364,21 @@ SelectionPriority=3 LongDesc=Produces other structures [PROC] Description=Ore Refinery -Traits=Building, RenderBuilding, AcceptsOre +Traits=Building, RenderBuilding, AcceptsOre, StoresOre Dimensions=3,3 Footprint=_x_ xxx x== SelectionPriority=3 +OrePips=18 LongDesc=Converts Ore and Gems into money [SILO] Description=Silo -Traits=Building, RenderBuildingOre +Traits=Building, RenderBuildingOre, StoresOre Dimensions=1,1 Footprint=x SelectionPriority=3 +OrePips=5 LongDesc=Stores excess harvested Ore + [HPAD] Description=Helipad Traits=Building, RenderBuilding, Production