AndRay Posted August 16, 2021 Share Posted August 16, 2021 I was taking a look at all related files and saw how the game generates farm plants in batch. The final table creation includes a curious comment about how mods can bypass the custom constructor. Spoiler local plant_prefabs = {} for k, v in pairs(PLANT_DEFS) do if not v.data_only then --allow mods to skip our prefab constructor. table.insert(plant_prefabs, MakePlant(v)) end end This made me confused: aren't I supposed to just create new prefab files inside [mod name]/prefabs/farm_plant_[thing]? Or is there a way to add entries to the relevant tables (PLANT_DEFS, for example) and let the game create the prefabs? I don't think the game runs the mod files before unpacking this table, but I might be wrong. A really similar thing happens to spiced foods. Spoiler function GenerateSpicedFoods(foods) for foodname, fooddata in pairs(foods) do for spicenameupper, spicedata in pairs(SPICES) do ... GenerateSpicedFoods(require("preparedfoods")) GenerateSpicedFoods(require("preparedfoods_warly")) Is there any way to automate the generation of spiced foods by modifying the "foods" table? Or am I forced to manually add spiced foods one by one? Link to comment https://forums.kleientertainment.com/forums/topic/132744-how-to-add-farm-plants-and-spiced-modded-foods/ Share on other sites More sharing options...
Monti18 Posted August 20, 2021 Share Posted August 20, 2021 Did you have a look at this tutorial? It explains a way to add farm plants to the game without creating a new prefab. No idea why this is apparently working, perhaps somebody else knows something. 1 Link to comment https://forums.kleientertainment.com/forums/topic/132744-how-to-add-farm-plants-and-spiced-modded-foods/#findComment-1487197 Share on other sites More sharing options...
AndRay Posted August 22, 2021 Author Share Posted August 22, 2021 Thanks a lot! That is indeed much simpler! Link to comment https://forums.kleientertainment.com/forums/topic/132744-how-to-add-farm-plants-and-spiced-modded-foods/#findComment-1487641 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