harvesters show colors for each resource type
This commit is contained in:
@@ -24,6 +24,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public Sprite[][] Sprites;
|
public Sprite[][] Sprites;
|
||||||
public int PaletteIndex;
|
public int PaletteIndex;
|
||||||
|
|
||||||
|
public PipType PipColor = PipType.Yellow;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ResourceType(this); }
|
public object Create(ActorInitializer init) { return new ResourceType(this); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Mods.RA.Move;
|
using OpenRA.Mods.RA.Move;
|
||||||
using OpenRA.Mods.RA.Orders;
|
using OpenRA.Mods.RA.Orders;
|
||||||
@@ -23,7 +22,6 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly int Capacity = 28;
|
public readonly int Capacity = 28;
|
||||||
public readonly int PipCount = 7;
|
public readonly int PipCount = 7;
|
||||||
public readonly PipType PipColor = PipType.Yellow;
|
|
||||||
public readonly string[] Resources = { };
|
public readonly string[] Resources = { };
|
||||||
public readonly decimal FullyLoadedSpeed = .85m;
|
public readonly decimal FullyLoadedSpeed = .85m;
|
||||||
|
|
||||||
@@ -168,20 +166,27 @@ namespace OpenRA.Mods.RA
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ChooseNewProc(self, proc);
|
ChooseNewProc(self, proc);
|
||||||
|
}
|
||||||
|
|
||||||
|
PipType GetPipAt(int i)
|
||||||
|
{
|
||||||
|
var n = i * Info.Capacity / Info.PipCount;
|
||||||
|
|
||||||
|
foreach (var rt in contents)
|
||||||
|
if (n < rt.Value)
|
||||||
|
return rt.Key.PipColor;
|
||||||
|
else
|
||||||
|
n -= rt.Value;
|
||||||
|
|
||||||
|
return PipType.Transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<PipType> GetPips(Actor self)
|
public IEnumerable<PipType> GetPips(Actor self)
|
||||||
{
|
{
|
||||||
int numPips = Info.PipCount;
|
int numPips = Info.PipCount;
|
||||||
int n = contents.Values.Sum();
|
|
||||||
|
for (int i = 0; i < numPips; i++)
|
||||||
for (int i = 0; i < numPips; i++)
|
yield return GetPipAt(i);
|
||||||
{
|
|
||||||
if (n * 1.0f / Info.Capacity > i * 1.0f / numPips)
|
|
||||||
yield return Info.PipColor;
|
|
||||||
else
|
|
||||||
yield return PipType.Transparent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ World:
|
|||||||
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
||||||
ValuePerUnit: 30
|
ValuePerUnit: 30
|
||||||
Name: Tiberium
|
Name: Tiberium
|
||||||
|
PipColor: Green
|
||||||
ResourceType@blue-tib:
|
ResourceType@blue-tib:
|
||||||
ResourceType: 2
|
ResourceType: 2
|
||||||
Palette: terrain
|
Palette: terrain
|
||||||
@@ -144,6 +145,7 @@ World:
|
|||||||
SpriteNames: bti1,bti2,bti3,bti4,bti5,bti6,bti7,bti8,bti9,bti10,bti11,bti12
|
SpriteNames: bti1,bti2,bti3,bti4,bti5,bti6,bti7,bti8,bti9,bti10,bti11,bti12
|
||||||
ValuePerUnit: 60
|
ValuePerUnit: 60
|
||||||
Name: Blue Tiberium
|
Name: Blue Tiberium
|
||||||
|
PipColor: Red # todo: add a blue pip.
|
||||||
SmudgeLayer@SCORCH:
|
SmudgeLayer@SCORCH:
|
||||||
Type:Scorch
|
Type:Scorch
|
||||||
Types:sc1,sc2,sc3,sc4,sc5,sc6
|
Types:sc1,sc2,sc3,sc4,sc5,sc6
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ HARV:
|
|||||||
Harvester:
|
Harvester:
|
||||||
Resources: Tiberium, Blue Tiberium
|
Resources: Tiberium, Blue Tiberium
|
||||||
PipCount: 5
|
PipCount: 5
|
||||||
PipColor: Green
|
|
||||||
Capacity: 28
|
Capacity: 28
|
||||||
Mobile:
|
Mobile:
|
||||||
Speed: 6
|
Speed: 6
|
||||||
|
|||||||
@@ -201,12 +201,14 @@ World:
|
|||||||
SpriteNames: gold01,gold02,gold03,gold04
|
SpriteNames: gold01,gold02,gold03,gold04
|
||||||
ValuePerUnit: 25
|
ValuePerUnit: 25
|
||||||
Name: Ore
|
Name: Ore
|
||||||
|
PipColor: Yellow
|
||||||
ResourceType@gem:
|
ResourceType@gem:
|
||||||
ResourceType: 2
|
ResourceType: 2
|
||||||
Palette: terrain
|
Palette: terrain
|
||||||
SpriteNames: gem01,gem02,gem03,gem04
|
SpriteNames: gem01,gem02,gem03,gem04
|
||||||
ValuePerUnit: 50
|
ValuePerUnit: 50
|
||||||
Name: Gems
|
Name: Gems
|
||||||
|
PipColor: Red
|
||||||
SmudgeLayer@SCORCH:
|
SmudgeLayer@SCORCH:
|
||||||
Type:Scorch
|
Type:Scorch
|
||||||
Types:sc1,sc2,sc3,sc4,sc5,sc6
|
Types:sc1,sc2,sc3,sc4,sc5,sc6
|
||||||
|
|||||||
Reference in New Issue
Block a user