diff --git a/InventoryListToLcd.cs b/InventoryListToLcd.cs new file mode 100644 index 0000000..127876f --- /dev/null +++ b/InventoryListToLcd.cs @@ -0,0 +1,51 @@ +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 containers = new List(); + GridTerminalSystem.GetBlocksOfType(containers, block => block.HasInventory); + + // Calculate Count + + Dictionary ingots = new Dictionary() { + { "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); + +}