Ore pips on refinery and silo
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -191,6 +191,7 @@
|
||||
<Compile Include="Traits\RenderUnitSpinner.cs" />
|
||||
<Compile Include="Traits\RenderUnitTurreted.cs" />
|
||||
<Compile Include="Traits\SeedsOre.cs" />
|
||||
<Compile Include="Traits\StoresOre.cs" />
|
||||
<Compile Include="Traits\Submarine.cs" />
|
||||
<Compile Include="Traits\TakeCover.cs" />
|
||||
<Compile Include="Traits\TraitsInterfaces.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<StoresOre>())
|
||||
.Select(a => a.Info as BuildingInfo)
|
||||
.Where(b => b != null)
|
||||
.Sum(b => b.Storage);
|
||||
|
||||
29
OpenRa.Game/Traits/StoresOre.cs
Normal file
29
OpenRa.Game/Traits/StoresOre.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user