Nycidian Posted October 9, 2013 Share Posted October 9, 2013 Because in my mod I have added new ingredients I had to rewrite what each normal recipe takes so that they mostly would not use the new ingredients. The only way I new how to do that was by redeclaring them whole in the modmain.lua file like the following. meatballs ={name = "meatballs",test = function(cooker, names, tags) return tags.meat and not tags.rock and not tags.inedible and not tags.rock and not tags.collagen and not tags.horrible end,priority = -1,weight = 1,foodtype = "MEAT",health = TUNING.HEALING_SMALL,hunger = TUNING.CALORIES_SMALL*5,perishtime = TUNING.PERISH_MED,sanity = TUNING.SANITY_TINY,cooktime = .75,}AddCookerRecipe("cookpot", meatballs) Is there a way to only rewrite the "test" part of the above? Using the above method works but I have a feeling it will interfere with other mods that mess with food, not to mention it is tedious and clunky. Link to comment Share on other sites More sharing options...
squeek Posted October 9, 2013 Share Posted October 9, 2013 In cooking.lua, you can find the AddCookerRecipe function. It adds the recipe to a local table that gets returned by the file. Therefore, you should be able to do something like this:-- if in modmain, you'll need this linelocal require = GLOBAL.requirelocal cooking = require "cooking"-- require "cooking" will return a table; the recipes key is what we're afterlocal recipes = cooking.recipes-- recipes are stored by cooker name and then recipe namerecipes.cookpot.meatballs.test = function(cooker, names, tags) return tags.meat and not tags.rock and not tags.inedible and not tags.rock and not tags.collagen and not tags.horrible end Link to comment Share on other sites More sharing options...
Nycidian Posted October 10, 2013 Author Share Posted October 10, 2013 Thanks that's what I needed Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.