Esempio n. 1
0
        public override bool NewRightClick(int i, int j)
        {
            int x = i - Main.tile[i, j].frameX / 16 % 3;
            int y = j - Main.tile[i, j].frameY / 16 % 2;

            if (DummyExists(x, y, DummyType))
            {
                CauldronDummyAbstract cauldronDummy = (CauldronDummyAbstract)Dummy(x, y).modProjectile;
                if (Main.LocalPlayer.HeldItem.type == ModContent.ItemType <MixingStick>())
                {
                    cauldronDummy.AttemptStartCraft();
                }
                else
                {
                    cauldronDummy.dumpIngredients();
                }
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Runs when player has initiated crafting this recipe with all ingredients added. return true to skip individual ingredient code from running.
        /// responsible for spawning in items and visuals.
        /// executes on client and server. return true to stop individual ingredient code from running.
        /// by default consumes ingredients and spawns output instantly
        /// </summary>
        /// <returns></returns>
        public virtual bool UpdateCrafting(AlchemyWrapper wrapper, List <AlchemyIngredient> currentingredients, CauldronDummyAbstract cauldronDummy)
        {
            foreach (Item eachOutputItem in outputItemList)
            {
                Item.NewItem(wrapper.cauldronRect, eachOutputItem.type, eachOutputItem.stack * wrapper.currentBatchSize);
            }
            foreach (AlchemyIngredient eachIngredient in currentingredients)
            {
                Item requiredItem;
                requiredIngredientsMap.TryGetValue(eachIngredient.storedItem.type, out requiredItem);

                eachIngredient.storedItem.stack -= requiredItem.stack * wrapper.currentBatchSize;
            }
            cauldronDummy.dumpIngredients();

            return(false);
        }