Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Each time this script is run, it will rotate the assembler production queue to the next item. Simply add "RotateQueue" to the name of any assembler you want to use this on.
- string assemblerTag = "RotateQueue"; //This is the tag that is applied to the Assembler Custom Name to have it use the queue rotation.
- void Main(){
- List<IMyProductionBlock> assemblers = new List<IMyProductionBlock>(); //Create Empty List For Assemblers
- GridTerminalSystem.GetBlocksOfType<IMyProductionBlock>(assemblers); //Populate List With Assemblers
- //Loop through list of assemblers
- foreach(var assembler in assemblers){
- //Check if each assembler contains the Assembler Tag
- if(assembler.CustomName.Contains(assemblerTag)){
- //Get the production queue of each assembler.
- List<MyProductionItem> assemblerQueue = new List<MyProductionItem>();
- assembler.GetQueue(assemblerQueue);
- //Ensure the prodcution queue is not empty.
- if(assemblerQueue.Count == 0){
- //Queue is empty, move to next assembler.
- continue;
- }
- var firstItem = assemblerQueue[0]; //Get the first item in the assembler production queue.
- assembler.MoveQueueItemRequest(firstItem.ItemId, assemblerQueue.Count - 1); //Move the first item in queue to the back of the queue.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement