예제 #1
0
        // Add custom item conversions
        private void AddCustomConversions()
        {
            // Create a conversion for the smelter with vanilla items
            var smeltConversion = new CustomItemConversion(new SmelterConversionConfig
            {
                //Station = "smelter",  // That is the default station from the SmelterConversionConfig
                FromItem = "Stone",
                ToItem   = "CookedMeat"
            });

            ItemManager.Instance.AddItemConversion(smeltConversion);

            // Load and create a custom item to use in another conversion
            var steel_prefab = steelIngotBundle.LoadAsset <GameObject>("Steel");
            var ingot        = new CustomItem(steel_prefab, fixReference: false);

            ItemManager.Instance.AddItem(ingot);

            // Create a conversion for the blastfurnace, the custom item is the new outcome
            var blastConversion = new CustomItemConversion(new SmelterConversionConfig
            {
                Station  = "blastfurnace", // Override the default "smelter" station of the SmelterConversionConfig
                FromItem = "Iron",
                ToItem   = "Steel"         // This is our custom prefabs name we have loaded just above
            });

            ItemManager.Instance.AddItemConversion(blastConversion);
        }
예제 #2
0
        private void Conversionscript3()
        {
            var FermenterTweak4 = new CustomItemConversion(new FermenterConversionConfig
            {
                Station  = "fermenter",
                FromItem = "SecondWind_PotionBase",
                ToItem   = "Flask_of_Second_Wind"
            });

            ItemManager.Instance.AddItemConversion(FermenterTweak4);
        }
예제 #3
0
        private void Conversionscript2()
        {
            var FermenterTweak3 = new CustomItemConversion(new FermenterConversionConfig
            {
                Station  = "fermenter",
                FromItem = "Magelight_PotionBase",
                ToItem   = "Flask_of_Magelight"
            });

            ItemManager.Instance.AddItemConversion(FermenterTweak3);
        }
예제 #4
0
        private void Conversionscript1()
        {
            var FermenterTweak2 = new CustomItemConversion(new FermenterConversionConfig
            {
                Station  = "fermenter",
                FromItem = "Gods_PotionBase",
                ToItem   = "Flask_of_the_Gods"
            });

            ItemManager.Instance.AddItemConversion(FermenterTweak2);
        }
예제 #5
0
        private void Conversionscript0()
        {
            var FermenterTweak1 = new CustomItemConversion(new FermenterConversionConfig
            {
                Station  = "fermenter",
                FromItem = "Fortification_PotionBase",
                ToItem   = "Flask_of_Fortification"
            });

            ItemManager.Instance.AddItemConversion(FermenterTweak1);
        }
예제 #6
0
        // Add custom item conversion (gives a steel ingot to smelter)
        private void AddCustomItemAndConversion()
        {
            var steel_prefab    = steelingot.LoadAsset <GameObject>("Steel");
            var ingot           = new CustomItem(steel_prefab, fixReference: false);
            var blastConversion = new CustomItemConversion(new SmelterConversionConfig
            {
                Station  = "blastfurnace", // Let's specify something other than default here
                FromItem = "Iron",
                ToItem   = "Steel"         // This is our custom prefabs name we have loaded just above
            });

            ItemManager.Instance.AddItem(ingot);
            ItemManager.Instance.AddItemConversion(blastConversion);
        }
예제 #7
0
        /// <summary>
        ///     Adds a new item conversion for any prefab that has a CookingStation component (such as a "piece_cookingstation").
        /// </summary>
        /// <param name="itemConversion">Item conversion details</param>
        /// <returns>Whether the addition was successful or not</returns>
        public bool AddItemConversion(CustomItemConversion itemConversion)
        {
            if (!itemConversion.IsValid())
            {
                Logger.LogWarning($"Custom item conversion {itemConversion} is not valid");
                return(false);
            }
            if (ItemConversions.Contains(itemConversion))
            {
                Logger.LogWarning($"Custom item conversion {itemConversion} already added");
                return(false);
            }

            ItemConversions.Add(itemConversion);
            return(true);
        }
예제 #8
0
        // Add item conversions (cooking or smelter recipes)
        private void AddItemConversions()
        {
            // Add an item conversion for the CookingStation. The items must have an "attach" child GameObject to display it on the station.
            var cookConversion = new CustomItemConversion(new CookingConversionConfig
            {
                FromItem = "CookedMeat",
                ToItem   = "CookedLoxMeat",
                CookTime = 2f
            });

            ItemManager.Instance.AddItemConversion(cookConversion);

            // Add an item conversion for the Fermenter. You can specify how much new items the conversion yields.
            var fermentConversion = new CustomItemConversion(new FermenterConversionConfig
            {
                FromItem      = "Coal",
                ToItem        = "CookedLoxMeat",
                ProducedItems = 10
            });

            ItemManager.Instance.AddItemConversion(fermentConversion);

            // Add an item conversion for the smelter
            var smeltConversion = new CustomItemConversion(new SmelterConversionConfig
            {
                //Station = "smelter",  // Use the default from the config
                FromItem = "Stone",
                ToItem   = "CookedLoxMeat"
            });

            ItemManager.Instance.AddItemConversion(smeltConversion);

            // Add an item conversion which does not resolve the mock
            var faultConversion = new CustomItemConversion(new SmelterConversionConfig
            {
                //Station = "smelter",  // Use the default from the config
                FromItem = "StonerDude",
                ToItem   = "CookedLoxMeat"
            });

            ItemManager.Instance.AddItemConversion(faultConversion);
        }