FurryEskimo Posted October 30, 2021 Share Posted October 30, 2021 (edited) So I made a custom item and it has a file to represent when it's dropped on the ground, another for when it's held in your inventory, but I made a crafting recipe include this item and the image to represent it appears to be missing.. Does anyone know what this image is called/how to set it, or is this an indication that something has gone wrong? Edited October 30, 2021 by FurryEskimo Link to comment https://forums.kleientertainment.com/forums/topic/134949-crafting-image-missing-in-recipe/ Share on other sites More sharing options...
CarlZalph Posted October 30, 2021 Share Posted October 30, 2021 17 minutes ago, FurryEskimo said: So I made a custom item and it has a file to represent when it's dropped on the ground, another for when it's held in your inventory, but I made a crafting recipe include this item and the image to represent it appears to be missing.. Does anyone know what this image is called/how to set it, or is this an indication that something has gone wrong? From recipe.lua: Ingredients: function Ingredient:GetAtlas() if self.atlas == nil then self.atlas = resolvefilepath(GetInventoryItemAtlas(self:GetImage())) end return self.atlas end function Ingredient:GetImage() if self.image == nil then self.image = self.type..".tex" end return self.image end Recipes: Recipe = Class(function(self, name, ingredients, tab, level, placer_or_more_data, min_spacing, nounlock, numtogive, builder_tag, atlas, image, testfn, product, build_mode, build_distance) ... self.image = self.imagefn == nil and image or (self.product .. ".tex") self.atlas = (atlas and resolvefilepath(atlas)) ... function Recipe:GetAtlas() self.atlas = self.atlas or resolvefilepath(GetInventoryItemAtlas(self.image)) return self.atlas end ^ Lots of parameters, but the atlas + image are the core ones if you have custom names. GetInventoryItemAtlas: Spoiler function GetInventoryItemAtlas(imagename, no_fallback) local atlas = inventoryItemAtlasLookup[imagename] if atlas then return atlas end local base_atlas = "images/inventoryimages1.xml" local alt_atlas = "images/inventoryimages2.xml" atlas = TheSim:AtlasContains(base_atlas, imagename) and base_atlas or (not no_fallback or TheSim:AtlasContains(alt_atlas, imagename)) and alt_atlas or nil if atlas ~= nil then inventoryItemAtlasLookup[imagename] = atlas end return atlas end I suspect whatever you have in your mod is either neglecting to specify something, or is specifying something and the core game code is appending things onto it. My suggestion is to see where it's all having the images at and see if you can't get some log info as to what the atlas and texture are pointing to. Assuming your images compiled properly, of course. 1 Link to comment https://forums.kleientertainment.com/forums/topic/134949-crafting-image-missing-in-recipe/#findComment-1509312 Share on other sites More sharing options...
FurryEskimo Posted October 30, 2021 Author Share Posted October 30, 2021 (edited) @CarlZalph Hmm, ok.. Well the information I have on recipes is as such: AddRecipe(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive, builder_tag, atlas, image) Mine look something like this: AddRecipe("houndcollar", { Ingredient("N/A", #), Ingredient("N/A", #), Ingredient("N/A", #) }, GLOBAL.RECIPETABS.MAGIC, TECH.MAGIC_TWO, nil, nil, nil, 1, "N/A", "images/inventoryimages/kokocollar.xml", "kokocollar.tex") From what I can tell, the images have been working in-game. Admittedly though, I also included this, since the image wasn't appearing correctly on the character select screen.: TUNING.STARTING_ITEM_IMAGE_OVERRIDE["houndcollar"] = {atlas = "images/inventoryimages/kokocollar.xml", image = "kokocollar.tex"} Thoughts? Edited October 31, 2021 by FurryEskimo Link to comment https://forums.kleientertainment.com/forums/topic/134949-crafting-image-missing-in-recipe/#findComment-1509316 Share on other sites More sharing options...
IronHunter Posted October 31, 2021 Share Posted October 31, 2021 (edited) I strongly suggest you register your inventoryimageicons so it is compatible with klei's image look up system. On 2/16/2021 at 7:03 PM, Hornete said: RegisterInventoryItemAtlas Hide contents RegisterInventoryItemAtlas(atlas, name) The RegisterInventoryItemAtlas function can be used to add an item's inventory icon and atlas to a global lookup table. Anywhere that calls GetInventoryItemAtlas will use this table for the item you added the inventory icon for. The first parameter is the atlas you are adding, and the 2nd parameter is the image/prefab name of your item. This is to make sure your items icon will appear in the inventory, or in the crafting recipes, cookbook or anywhere else. Examples: Hide contents RegisterInventoryItemAtlas(“images/inventoryimages.xml”, “acorn.tex”) Edit: You can run this in your Prefab File or modmain Excerpt from Edited October 31, 2021 by IronHunter 1 1 Link to comment https://forums.kleientertainment.com/forums/topic/134949-crafting-image-missing-in-recipe/#findComment-1509530 Share on other sites More sharing options...
FurryEskimo Posted November 1, 2021 Author Share Posted November 1, 2021 @IronHunter Thanks! I'll check into that! I did something different, but it seemed to work: AddRecipe("N'A", { Ingredient("N'A", #), Ingredient("N'A", #,"images/inventoryimages/N'A.xml",nil,"N'A.tex"), Ingredient("N'A", #) }, RECIPETABS.SURVIVAL, TECH.SCIENCE_TWO, "N'A_placer", nil, nil, nil, "N'A", "images/inventoryimages/N'A.xml", "N'A.tex") Link to comment https://forums.kleientertainment.com/forums/topic/134949-crafting-image-missing-in-recipe/#findComment-1509884 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