Esempio n. 1
0
        void OnMarketResupplied(object sender, InventoryComponent.AddedEventArgs e)
        {
            if (State != CartState.WaitingForResupply)
            {
                return;
            }
            if (PurchaseOrders.All(o => o.Item != e.Item))
            {
                return;
            }

            FulfillPurchaseOrders();

            var wasSuccessful = !Exchange.Inventory.IsEmpty || !HasPurchaseOrders;

            if (wasSuccessful)
            {
                foreach (var exchange in Locator.Market.Location.Exchanges)
                {
                    exchange.Inventory.Added -= OnMarketResupplied;
                }

                ChangeState(CartState.Company);
            }
        }
Esempio n. 2
0
        public void OnItemAdded(object sender, InventoryComponent.AddedEventArgs e)
        {
            foreach (var recipe in Registry.HaltedRecipes)
            {
                if (!recipe.Resources.ContainsKey(e.Item))
                {
                    continue;
                }

                this.Log($"Production restarting halted production of {recipe}");

                StartProduction(recipe);
            }
        }
 void OnRemoved(object sender, InventoryComponent.AddedEventArgs e)
 {
     RemovedFlag    = true;
     AddedEventArgs = e;
 }