Jump to content

Recommended Posts

You mean the image does not show up for the recipe icon or as ingredient?

 

Did you load the asset?

Did you set the atlas (and image if necessary)?

Did you make sure to say the path?

Did you make sure to say the extension?

Did you check your spelling?

Did you read the log?

The log says nothing relevant.

function AddRecipeTab(str, sort, atlas, icon)	RECIPETABS[str] =	{		["str"] = str,		["sort"] = sort,		["icon_atlas"] = atlas,		["icon"] = icon	}	return RECIPETABS[str]end
local Assets ={    Asset("ATLAS", "images/tab_tabname.xml"),    Asset("IMAGE", "images/tab_tabname.tex"),    Asset("ATLAS", "images/product.xml"),    Asset("IMAGE", "images/product.tex")}
AddRecipeTab("TABNAME", 8, "images/tab_tabname.xml", "tab_tabname.tex")local recipe_product = Recipe("product", {Ingredient("ingredientA", 2, "images/ingredientA.xml"), Ingredient("ingredientB", 4, "images/ingredientB.xml"), Ingredient("ingredientC", 3, "images/ingedientC.xml")}, RECIPETABS.TABNAME, TECH.MAGIC_TWO)recipe_product.atlas = resolvefilepath("images/product.xml")recipe_product.image = "product.tex"

I have not encountered any issues with the ingredient textures, but product and tab icon textures randomly refuse to register. For tabs, this causes there to be no icon, and for products, this causes the icon to be a random icon, presumably the last used by the engine.

 

However, using other files can work fine, including (if I remember right) renamed versions of the same images!

 

EDIT: The forum seems to have trouble displaying the code.

 

EDIT AGAIN: It seems that either the log did actually contain the errors, and I somehow missed them, or it did not, due to some weird glitchery. Regardless, they were simply the obvious "Asset not loaded" error.

Edited by Arkathorn

I have finally resolved the issue.

 

 

When I was first learning how to mod Don't Starve, I mistakenly assumed that 'Asset' was a function that loaded assets. I more recently realized it was simply a data class storing the type and file of an asset.

 

My issue was that I register my recipes in a seperate file to 'modmain.lua', and require it. (For neatness's sake)

This meant that my list of assets ('local Assets = { Asset(...), ... }') served no actual function. Relocating the table to 'modmain.lua', and thus the special environment that recognizes the list, has resolved my issue.

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...