Don't Starve Together

Don't Starve Together

Craft Pot [DS, ROG, SW, DST]
IvanX  [developer] 31 Aug, 2016 @ 12:25pm
To modders establishing compatibility
If you are a modder and want to add custom ingredients/recipes with your mod that's supposed to be compatible with Craft Pot, the rule is pretty simple:
Make sure your AddIngredientValues/AddCookingRecipe function calls are run on both server and client.

This is a client only mod. That means if you add recipes to server-only, dish will be cookable, since Crock pot cooking runs on server, but all the clients will not know of your new custom dishes/ingredients, so won't CraftPot :)

So do NOT add recipe data inside AddGamePostInit, AddSimPostInit kind of functions. Those functions only run once on the host (or on dedicated server) when world is created. Instead just put them straight into modmain.lua without any wrapper functions. If modded recipes are added under some rare conditions, you can use functions like AddPlayerPostInit, or Add...PostConstruct. Or any other piece of code that runs on both host and clients.

... Special Thanks to Serpens66 for figuring all of that out for me, you're a great guy! :)


--- edit as of Version 0.9.6;
A new PUBLIC API has been exposed allowing modders to bring in naming and assets to their tags. To use it openly, your mod must have a priority lower than 1337, otherwise you have to call it from some deferred function.
Here's a bunch of code to add food tag name and asset:
if GLOBAL.AddFoodTag then
GLOBAL.AddFoodTag('inedible', { name="MyInediblezz", atlas="images/my_atlas_file.xml" })
...
end
Last edited by IvanX; 6 Jun, 2019 @ 12:56pm