52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
public Program()
|
|
{
|
|
Runtime.UpdateFrequency = UpdateFrequency.Update10;
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
}
|
|
|
|
public void Main(string argument, UpdateType updateSource)
|
|
{
|
|
IMyTextPanel LCD = GridTerminalSystem.GetBlockWithName("Display_1") as IMyTextPanel;
|
|
|
|
List<IMyTerminalBlock> containers = new List<IMyTerminalBlock>();
|
|
GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(containers, block => block.HasInventory);
|
|
|
|
// Calculate Count
|
|
|
|
Dictionary<String,float> ingots = new Dictionary<String,float>() {
|
|
{ "Nickel", 6 },
|
|
{ "Cobalt", 5 },
|
|
{ "Stone", 5 },
|
|
{ "Magnesium", 10 },
|
|
{ "Silver", 5 },
|
|
{ "Gold", 4 },
|
|
{ "Silicon", 6 },
|
|
{ "Uranium", 7},
|
|
{ "Platinum", 7 },
|
|
{ "Iron", 3 }
|
|
};
|
|
|
|
foreach (var container in containers)
|
|
{
|
|
foreach (var ingot in ingots.Keys.ToList())
|
|
{
|
|
ingots[ingot] += (float)container.GetInventory(0).GetItemAmount(new MyItemType("MyObjectBuilder_Ingot", ingot));
|
|
}
|
|
}
|
|
|
|
// Dispaly
|
|
string output = "";
|
|
|
|
foreach (var ingot in ingots)
|
|
{
|
|
output += ingot.Key + " " + ingot.Value.ToString("n2") + "\n";
|
|
}
|
|
|
|
LCD.ContentType = ContentType.TEXT_AND_IMAGE;
|
|
LCD.WriteText(output);
|
|
|
|
}
|