Fireandthethud Posted May 21, 2015 Share Posted May 21, 2015 So my prefab is perfect in the inventory, and on the ground, but otherwise when its in a crafting tab it seems to break. Quick notes: 'SCIENCE = 3' is a part of the mod I'm working on, its not the issue, I don't think. I have other custom prefabs that work perfectly fine in the tab, so I'm not sure what it is, besides maybe the fact that the affected item shares a lua file with another prefab, they both however work and show themselves perfectly in the inventory, and on the ground. Lines relevant to prefab in Modmain:local wironrecipe = Recipe( "iron", { Ingredient("ore", 3) }, RECIPETABS.REFINE, {SCIENCE = 3, MAGIC = 0, ANCIENT = 0})wironrecipe.atlas = "images/inventoryimages/iron.xml"Lines relevant to the image in its file: inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "iron" inst.components.inventoryitem.atlasname = "images/inventoryimages/iron.xml" inst.entity:AddMiniMapEntity() inst.MiniMapEntity:SetIcon( "iron.tex" )So what should I be looking at? The dual-prefab lua file? My assets? The way I'm calling them? Again, similar prefabs are working just fine ._. Link to comment Share on other sites More sharing options...
Fireandthethud Posted May 21, 2015 Author Share Posted May 21, 2015 I think it has to do with that second prefab "ore", how would I go about adding a line similar to:wironrecipe.atlas = "images/inventoryimages/iron.xmlwithout giving it a recipe? Link to comment Share on other sites More sharing options...
Corrosive Posted May 21, 2015 Share Posted May 21, 2015 @Fireandthethud, From recipe.lua:Ingredient = Class(function(self, type, amount, atlas) self.type = type self.amount = amount self.atlas = (atlas and resolvefilepath(atlas)) or resolvefilepath("images/inventoryimages.xml")end)Try adding the path to your ore prefab's inventory atlas as the 3rd argument to Ingredient(), eg:local wironrecipe = Recipe( "iron", { Ingredient("ore", 3, "images/inventoryimages/ore.xml") }, RECIPETABS.REFINE, {SCIENCE = 3, MAGIC = 0, ANCIENT = 0}) Link to comment Share on other sites More sharing options...
Fireandthethud Posted May 21, 2015 Author Share Posted May 21, 2015 Okay, so here is the edit I made to the code:local wironrecipe = Recipe( "iron", { Ingredient("ore", 3, "images/inventoryimages/ore.xml") }, RECIPETABS.REFINE, {SCIENCE = 3, MAGIC = 0, ANCIENT = 0})wironrecipe.atlas = "images/inventoryimages/iron.xml"Put log returns: WARNING! Could not find region 'iron.tex' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?images/inventoryimages.xml[...]...m/steamapps/common/dont_starve/data/scripts/util.lua:276: Could not find an asset matching images/inventoryimages/.xml in any of the search paths.I also tried making the 3rd argument end in .tex instead of .xml but that didn't work eitherBtw, just for my knowledge is Inventoryimages.xml where the .xml files are all group together? Because it sounds odd it was looking for iron.tex in it. How does that work? Link to comment Share on other sites More sharing options...
Fireandthethud Posted May 21, 2015 Author Share Posted May 21, 2015 Actually, the atlas is the 4th argument, so shouldn't I have a 2nd argument to fill in? Right now I think it might be reading the 3rd argument of amount as the .xml Edit: Nope not that, it searched for "3" as an asset Link to comment Share on other sites More sharing options...
Corrosive Posted May 21, 2015 Share Posted May 21, 2015 Actually, the atlas is the 4th argument The first argument is self, but that's invisible to the user. Because it sounds odd it was looking for iron.tex in it. That's because self.atlas = (atlas and resolvefilepath(atlas)) or resolvefilepath("images/inventoryimages.xml")which is a compact way to write this:if atlas ~= nil then if resolvefilepath(atlas) ~= nil then self.atlas = atlas endelse self.atlas = resolvefilepath("images/inventoryimages.xml)endIt essentially uses inventoryimages.xml as a fallback for when it can't resolve the file path provided. Are you defining this recipe from within modmain? Link to comment Share on other sites More sharing options...
Fireandthethud Posted May 21, 2015 Author Share Posted May 21, 2015 Okay, so upon further inspection... GLOBAL.STRINGS.NAMES.IRON = "Metalic Metal"GLOBAL.STRINGS.RECIPE_DESC.IRON = "Great for inventing new machines!"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.IRON = "Sturdy building materials for science."local wironrecipe = Recipe( "iron", { Ingredient("ore", 3, "images/inventoryimages/ore.xml") }, RECIPETABS.REFINE, {SCIENCE = 3, MAGIC = 0, ANCIENT = 0})wironrecipe.atlas = "images/inventoryimages/iron.xml"Allowed for the icon to be displayed properly. Thank you @Corrosive 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.