コード例 #1
0
        public override void ReactionComplete()
        {
            ScienceWorkbenchUI ui = ParentState as ScienceWorkbenchUI;
            Item resultSlot       = ui.GetSlot(ui.SlotsLength - 1).StoredItem;

            resultSlot.stack += curRecipeStack;

            Recipe recipe = curRecipes[ui.CurrentRecipe];

            for (int i = 0; i < ui.SlotsLength - 1; i++)
            {
                Item slot       = ui.GetSlot(i).StoredItem;
                Item recipeItem = recipe.requiredItem[i];

                if (!recipeItem.IsAir && !slot.IsAir)
                {
                    slot.stack -= recipeItem.stack;

                    if (slot.stack <= 0)
                    {
                        slot.TurnToAir();
                    }
                }
            }

            HasRecipe = RecipeUtils.HasRecipe(ui, out curRecipeType, out curRecipeStack, curRecipes);

            Main.PlaySound(SoundID.Grab);
        }
コード例 #2
0
        internal override void UpdateEntity()
        {
            UpdateSuccess = false;
            ScienceWorkbenchEntity entity = UIEntity as ScienceWorkbenchEntity;

            Item resultSlot = GetSlot(SlotsLength - 1).StoredItem;

            //Check if any of the ingredients have been added/removed
            for (int i = 0; i < SlotsLength - 1; i++)
            {
                if (GetSlot(i).ItemChanged)
                {
                    PromptForRecipes = true;
                    break;
                }
            }

            if (PromptForRecipes)
            {
                entity.HasRecipe = RecipeUtils.HasRecipe(this, out entity.curRecipeType, out entity.curRecipeStack, entity.curRecipes);
                PromptForRecipes = false;
            }

            if (entity.HasRecipe && craft.LeftClick)
            {
                //The recipe found an item.  Copy the defaults if it's air.
                if (entity.curRecipeType > 0 && resultSlot.type <= ItemID.None)
                {
                    resultSlot.SetDefaults(entity.curRecipeType);
                    resultSlot.stack = 0;
                }

                //We have room to add another item
                if (resultSlot.stack + entity.curRecipeStack < resultSlot.maxStack)
                {
                    entity.ReactionProgress = 100;
                    UpdateSuccess           = true;
                }
                else
                {
                    UpdateSuccess = false;
                }
            }
            else
            {
                UpdateSuccess = false;
            }
        }
コード例 #3
0
        public override void AddRecipes()
        {
            //Solar panel recipes
            RecipeUtils.CreateTFRecipe <BasicSolarPanel>(ModContent.ItemType <Sun>());

            //Wind turbine recipes
            RecipeUtils.CreateTFRecipe <BasicWindTurbine>(ModContent.ItemType <Wind>());

            //Thermal Generator recipes
            RecipeUtils.CreateTFRecipeWithRecipeGroupIngredient <BasicThermoGenerator>(RecipeGroupID.Wood);

            for (int i = 0; i < ItemLoader.ItemCount; i++)
            {
                Item thing = new Item();
                thing.SetDefaults(i);

                if (thing.buffType == BuffID.WellFed || thing.buffType == BuffID.Tipsy)
                {
                    RecipeUtils.CreateTFRecipe <BasicThermoGenerator>(i);
                }
            }

            RecipeUtils.CreateTFRecipe <BasicThermoGenerator>(ModContent.ItemType <Coal>());
        }
コード例 #4
0
 public override void AddRecipes()
 {
     RecipeUtils.SimpleRecipe(ModContent.ItemType <IronPipe>(), 4, TileID.Anvils, this, 8);
 }
コード例 #5
0
 public override void AddRecipes()
 {
     RecipeUtils.SimpleRecipe("IronBar", 14, TileID.Anvils, this, 1);
 }
コード例 #6
0
 public override void AddRecipes()
 {
     RecipeUtils.SimpleRecipe(ItemID.Glass, 3, TileID.WorkBenches, this, 5);
 }
コード例 #7
0
 public SettingsPage()
 {
     this.InitializeComponent();
     n     = 0;
     units = new ObservableCollection <String>(RecipeUtils.getUnitsOfMeasure());
 }