Prajdo Posted March 25, 2022 Share Posted March 25, 2022 Hello all! I have a question about new crafting system, because as much as I personally like it for now I don't know if there's any easy way to add specific filter tag to items/structures added with mods. For example if it would be possible to add "tool" tag to scythe or "structure" tag to craftable catcoon den etc. I created kinda big mod for myself where there's plenty of items/structures and I don't feel good with having all the recipes only in "all" and "modded" filers so If there's a way to easily add tags to their codes I would really like to know it. Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/ Share on other sites More sharing options...
IronHunter Posted March 26, 2022 Share Posted March 26, 2022 On 3/24/2022 at 9:34 AM, ScottHansen said: Notes for Modders: Deprecated Functions Recipe AddRecipe AddRecipeTab New Functions AddRecipe2(name, ingredients, tech, config, filters) Adds a recipe to the mods filter (or to the crafting station filter if config.nounlock is true) and any other passed in filters AddCharacterRecipe(name, ingredients, tech, config, extra_filters) Adds a recipe to the character filter and any other passed in filters config.builder_tag must be passed in AddDeconstructRecipe(name, return_ingredients) Adds a recipe that will not show up under any filters. These are to support the Deconstruction Staff or hammering of items that are not craftable. AddRecipeToFilter(recipe_name, filter_name) Adds a recipe to the end of a filter group. RemoveRecipeFromFilter(recipe_name, filter_name) Removes a recipe form a filter group AddPrototyperDef(prototyper_prefab, data) Customizes how the research or crafting station will display in the crafting menu Parameters: prototyper_prefab - prefab of the station’s object icon_atlas, icon_image - the icon to show on the open button and filter action_str - string to display for the “build” button is_crafting_station - true = you must remain at the station for each build and opens the crafting menu to the Crafting Station filter. filter_text - mouse over name on the crafting station’s filter Fixed TrueScrollList:ScrollToDataIndex to properly take the number of items wide into account. Added TrueScrollList:ScrollToScrollPos for people who need the previous functionality, where the passed in value is the row to scroll to. You want to AddRecipeToFilter for existing items or use the new AddRecipe2 which contains the filters parameter a list of filters look at the recipes_filter.lua file 2 Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1552398 Share on other sites More sharing options...
Prajdo Posted March 26, 2022 Author Share Posted March 26, 2022 (edited) I don't understand what is the difference. I just wondered if there was some kind of extension to normally used code. Example: AddRecipe("turf_lawn", {Ingredient("cutgrass", 2), Ingredient("nitre", 1)}, RECIPETABS.TURFCRAFTING, TECH.TURFCRAFTING_ONE, nil, nil, nil, 4, nil, "images/inventoryimages/turfimg.xml", "turf_lawn.tex") Expected upgraded code example: AddRecipe("turf_lawn", {Ingredient("cutgrass", 2), Ingredient("nitre", 1)}, RECIPETABS.TURFCRAFTING, RECIPEFILTER.DECOR, TECH.TURFCRAFTING_ONE, nil, nil, nil, 4, nil, "images/inventoryimages/turfimg.xml", "turf_lawn.tex") That's just my expectation, but if there's another way to add filters to recipes then I would like to know how. EDIT: Nevermind. I now understand what's the difference. I can do it by: AddRecipeToFilter("turf_lawn", DECOR) or AddRecipe2("turf_lawn", {Ingredient("cutgrass", 2), Ingredient("nitre", 1)}, RECIPETABS.TURFCRAFTING, TECH.TURFCRAFTING_ONE, nil, nil, nil, 4, nil, "images/inventoryimages/turfimg.xml", "turf_lawn.tex"), CRAFTING_FILTERS.DECOR) I'm not sure if I'm using the new code properly so first method sounds safer to use. Edited March 26, 2022 by Prajdo Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1552551 Share on other sites More sharing options...
ClumsyPenny Posted March 26, 2022 Share Posted March 26, 2022 4 minutes ago, Prajdo said: AddRecipe("turf_lawn", {Ingredient("cutgrass", 2), Ingredient("nitre", 1)}, RECIPETABS.TURFCRAFTING, RECIPEFILTER.DECOR, TECH.TURFCRAFTING_ONE, nil, nil, nil, 4, nil, "images/inventoryimages/turfimg.xml", "turf_lawn.tex") That's just my expectation, but if there's another way to add filters to recipes then I would like to know how. Tabs no longer exist and filters need to be sent in a table. Also, any extra data, like amount, atlas or image is sent differently now. Let's look at the AddRecipes2 function that IronHunter shared from a Klei post: 11 hours ago, IronHunter said: AddRecipe2(name, ingredients, tech, config, filters) First two arguments are the same as usual, name and ingredients. Next one is tech instead of tab, because tabs no longer exist. Then config is a table for any kind of data that before this update you used to send as extra arguments after everything else, like 4 for the amount or the atlas and image paths. Finally, we have filters, which need to be sent in a table too. Let me give you an example of how your recipe needs to be written: AddRecipe2("turf_lawn", {Ingredient("cutgrass",2), Ingredient("nitre", 1)}, TECH.TURFCRAFTING_ONE, {numtogive = 4, atlas = "images/inventoryimages/turfimg.xml", image = "turf_lawn.tex" }, {"DECOR"}) If you have more questions, feel free to quote me or @ me! 1 1 Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1552560 Share on other sites More sharing options...
Prajdo Posted March 26, 2022 Author Share Posted March 26, 2022 Thanks! I think I finally understand how it now works but I still have one question. Is it possible to add more then one filter to AddRecipe2 code or for adding another one it is necessary to use AddRecipeToFilter additionally? Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1552568 Share on other sites More sharing options...
ClumsyPenny Posted March 26, 2022 Share Posted March 26, 2022 56 minutes ago, Prajdo said: Thanks! I think I finally understand how it now works but I still have one question. Is it possible to add more then one filter to AddRecipe2 code or for adding another one it is necessary to use AddRecipeToFilter additionally? It's totally possible, just add to the filter table. Right now it's just {"DECOR"}, but you can do {"DECOR", "TOOLS", "LIGHT", "WINTER"} etc. Just make sure to space them with a comma inbetween like I did in the example. 1 Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1552587 Share on other sites More sharing options...
Nehuen721 Posted October 15, 2024 Share Posted October 15, 2024 (edited) On 3/26/2022 at 10:01 AM, ClumsyPenny said: AddRecipe2("turf_lawn", {Ingredient("cutgrass",2), Ingredient("nitre", 1)}, TECH.TURFCRAFTING_ONE, {numtogive = 4, atlas = "images/inventoryimages/turfimg.xml", image = "turf_lawn.tex" }, {"DECOR"}) Wait, sorry if it's a dumb question, but, how do you make recipes like this a character only recipe? Do I just change "AddRecipe2" with AddCharacterRecipe? Edited October 15, 2024 by Nehuen721 Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1753134 Share on other sites More sharing options...
ClumsyPenny Posted October 15, 2024 Share Posted October 15, 2024 11 hours ago, Nehuen721 said: Wait, sorry if it's a dumb question, but, how do you make recipes like this a character only recipe? Do I just change "AddRecipe2" with AddCharacterRecipe? Not a dumb question at all! And yes, you have it right. Two things to note though: Using AddCharacterRecipe will put the recipe in the CHARACTER filter automatically, which is good, it's generally what you'd want. For the recipe to work properly as a character recipe, make sure the config table in the recipe includes builder_tag = "yourbuildertag", otherwise any character will be able to craft it and it will show up in everyone's CHARACTER filter. Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1753187 Share on other sites More sharing options...
Nehuen721 Posted October 16, 2024 Share Posted October 16, 2024 Just now, ClumsyPenny said: Using AddCharacterRecipe will put the recipe in the CHARACTER filter automatically, which is good, it's generally what you'd want. For the recipe to work properly as a character recipe, make sure the config table in the recipe includes builder_tag = "yourbuildertag", otherwise any character will be able to craft it and it will show up in everyone's CHARACTER filter. Thanks! This worked perfectly, although I did have to erase the "image = "example.tex" part for the inventory images to show up, ironically. I wonder why's that. Link to comment https://forums.kleientertainment.com/forums/topic/138611-crafting-recipes-filter/#findComment-1753248 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