Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<IMyConveyorSorter> sorterList = new List<IMyConveyorSorter>(),
- groupedList = new List<IMyConveyorSorter>();
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update10;
- }
- public void Main(string argument, UpdateType updateSource)
- {
- try
- {
- if (sorterList.Count == 0)
- {
- GridTerminalSystem.GetBlocksOfType<IMyConveyorSorter>(sorterList);
- }
- else if (groupedList.Count == 0)
- {
- try
- {
- IMyConveyorSorter currentSorter = sorterList[0];
- string name = currentSorter.CustomName;
- GridTerminalSystem.GetBlockGroupWithName(name).GetBlocksOfType<IMyConveyorSorter>(groupedList);
- }
- catch { sorterList.RemoveAt(0); }
- }
- else
- {
- IMyConveyorSorter currentSorter = sorterList[0];
- MyConveyorSorterMode mode = currentSorter.Mode;
- List<MyInventoryItemFilter> filterList = new List<MyInventoryItemFilter>();
- currentSorter.GetFilterList(filterList);
- int groupCount = groupedList.Count;
- for (int reps = 0; reps < groupCount && reps < 10; reps++)
- {
- try
- {
- groupedList[0].SetFilter(mode, filterList);
- }
- catch { }
- groupedList.RemoveAt(0);
- }
- }
- }
- catch
- {
- sorterList.Clear();
- groupedList.Clear();
- }
- Echo("Sorter Manager");
- Echo("Any Sorter with a group named after it become a controller for that group");
- Echo("Sorters in a group named after another sorter will copy the controller");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement