Exemple #1
0
 public Order(AssemblyLine line, OrderConfig config)
 {
     this.shoppingList = new ShoppingList(this);
     this.line = line;
     this.SetConfigDirect(config);
     this.TicksToFinish = Config.WorkAmount;
 }
Exemple #2
0
        private void FinishCycle(bool forceComplete = false)
        {
            if (forceComplete)
            {
                DropAcquiredMats();
                if (completedCycles > 0)
                {
                    DropProducts();
                    return;
                }
                return;
            }
            switch (config.RepeatMode)
            {
            case BillRepeatMode.Forever:
            {
                if (config.CompleteAll)
                {
                    completedCycles++;
                    if (completedCycles >= OrderConfig.repeatCountMaxCycles)
                    {
                        DropProducts();
                    }
                }
                else
                {
                    completedCycles++;
                    DropProducts();
                }
                break;
            }

            case BillRepeatMode.RepeatCount:
            {
                if (config.CompleteAll)
                {
                    Cycles--;
                    completedCycles++;
                    if (Cycles == 0 || completedCycles > OrderConfig.repeatCountMaxCycles)
                    {
                        DropProducts();
                    }
                }
                else
                {
                    Cycles--;
                    completedCycles++;
                    DropProducts();
                }
                if (Cycles == 0)
                {
                    Messages.Message(string.Concat(new Object[] {
                            line.label,
                            " has completed its order ",
                            "\"",
                            Config.Recipe.LabelCap,
                            "\""
                        }),
                                     MessageSound.Benefit);
                }
                break;
            }

            case BillRepeatMode.TargetCount:
            {
                if (config.CompleteAll)
                {
                    completedCycles++;
                    if (completedCycles > OrderConfig.targetCountMaxCycles)
                    {
                        DropProducts();
                    }
                }
                else
                {
                    completedCycles++;
                    DropProducts();
                }
                break;
            }

            default:
                throw new InvalidOperationException();
            }
            TicksToFinish = Config.WorkAmount;
            ShoppingList.Reset();
        }