blackteapie Posted March 15, 2015 Share Posted March 15, 2015 Currently, the heat source is only used for make the food changing from "uncooked" to "cooked" (or "burned") .But the heat source can do better in real life. It supposed to have the ability to change item A to item B. For example, you put bread dough into fire, it should come out with bread (if it wasn't over cooked), not cooked bread dough.So, is it possible, right now, to make a mod to allow the heat source to change a item to a completely new item? Link to comment Share on other sites More sharing options...
Dudeman325 Posted March 15, 2015 Share Posted March 15, 2015 I'm pretty sure this can be done already. You need to add an OnCooked line to the food item's stats that references a new lua function that removes the old item and adds a new one.Pretty sure this was added when canning became a Base feature, so take a look at those items for a better idea of how it's done. Link to comment Share on other sites More sharing options...
blackteapie Posted March 15, 2015 Author Share Posted March 15, 2015 I'm pretty sure this can be done already. You need to add an OnCooked line to the food item's stats that references a new lua function that removes the old item and adds a new one.Pretty sure this was added when canning became a Base feature, so take a look at those items for a better idea of how it's done.the lua files about the canned food? Link to comment Share on other sites More sharing options...
Dudeman325 Posted March 15, 2015 Share Posted March 15, 2015 The lua for canning looks something like thisfunction CannedFood_OnCooked(cannedFood) local aged = cannedFood:getAge() / cannedFood:getOffAgeMax(); cannedFood:setOffAgeMax(90); cannedFood:setOffAge(60); cannedFood:setAge(cannedFood:getOffAgeMax() * aged);-- print("new jared food age " .. cannedFood:getAge() .. " and max age " .. cannedFood:getOffAgeMax());endWhat you are trying to do would be something more like this: For the item you want to change into something else in the media\scripts folderitem FoodItem { HungerChange = -40, Weight = 0.3, Type = Food, IsCookable = TRUE, DangerousUncooked = TRUE, DaysTotallyRotten = 4, MinutesToBurn = 70, DisplayName = Steak, Icon = Steak, DaysFresh = 2, MinutesToCook = 50, EvolvedRecipe = Stew:15;Stir fry:15;Burger:15;Roasted Vegetables:15, FoodType = Meat, OnCooked = FoodItem_OnCooked, /Add this line/ }and in the media\lua\server folder make a new .lua file with code like thisfunction FoodItem_OnCooked(items, player) player:getInventory():AddItem("Module.NewFoodItem");endI'm not the best with lua, but you'd also need to add something in there that removes the item being cooked from the container that it's in. Hope that helps! WolfeClaw 1 Link to comment Share on other sites More sharing options...
blackteapie Posted March 15, 2015 Author Share Posted March 15, 2015 The lua for canning looks something like thisfunction CannedFood_OnCooked(cannedFood) local aged = cannedFood:getAge() / cannedFood:getOffAgeMax(); cannedFood:setOffAgeMax(90); cannedFood:setOffAge(60); cannedFood:setAge(cannedFood:getOffAgeMax() * aged);-- print("new jared food age " .. cannedFood:getAge() .. " and max age " .. cannedFood:getOffAgeMax());endWhat you are trying to do would be something more like this:For the item you want to change into something else in the media\scripts folderitem FoodItem { HungerChange = -40, Weight = 0.3, Type = Food, IsCookable = TRUE, DangerousUncooked = TRUE, DaysTotallyRotten = 4, MinutesToBurn = 70, DisplayName = Steak, Icon = Steak, DaysFresh = 2, MinutesToCook = 50, EvolvedRecipe = Stew:15;Stir fry:15;Burger:15;Roasted Vegetables:15, FoodType = Meat, OnCooked = FoodItem_OnCooked, /Add this line/ }and in the media\lua\server folder make a new .lua file with code like thisfunction FoodItem_OnCooked(items, player) player:getInventory():AddItem("Module.NewFoodItem");endI'm not the best with lua, but you'd also need to add something in there that removes the item being cooked from the container that it's in.Hope that helps!Thank you.I'll give it a try. Link to comment Share on other sites More sharing options...
blackteapie Posted May 10, 2015 Author Share Posted May 10, 2015 Still not figure it out Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now