Jump to content

[fixed]Atlas icon for recipe & ingredient strange issue


whismerhill

Recommended Posts

Hi,

so I found a strange issue. While making compatible two mods together. I'm adding recipe from one into the other. it works fine so far, except for one

there's an icon for dug_reeds that is used for inventory, I do like for all 8 other instances of similar objects and have code that looks like this :

Spoiler

-- name = "dug_reeds"

	local tempingredient = Ingredient(name, 1)
	local temprecipe = Recipe(name, { tempingredient }, RECIPETABS.SURVIVAL, TECH.NONE)
			temprecipe.atlas = "images/inventoryimages/dug_reed.xml"
			tempingredient.atlas = "images/inventoryimages/dug_reed.xml"

 

This code works fine for 8 different but similar objects (dug_mushrooms ....). I verified with "prints" that the code is executed properly. Also of note is that before I had "images/inventoryimages/dug_reeds.xml" instead, and the game was throwing an error complaining about unable to find assets.

so for me, it seems the code is fine, but unlike the others the image is not displayed as a recipe nor as an ingredient. However I verified that the icon shows up in inventory just fine. Not sure what's happening ??? is there specific restrictions for recipe & ingredient icons different from inventory icons ???

 

Thanks.

Link to comment
Share on other sites

The asset is referenced by a string, but it doesn't load in the first place unless you tell it to. This is why prefabs have the 'Assets' table.

For textures used in recipes, the asset should be declared in the 'Assets' table in 'modmain.lua':

Assets = {
	Asset("ATLAS", "images/inventoryimages/dug_reed.xml"),
	Asset("IMAGE", "images/inventoryimages/dug_reed.tex"),
}

 

Link to comment
Share on other sites

well all the assets are declared on the other mod in the prefab files of each object, and it seems like it's all declared as "local Assets". I'll try that though, can't hurt :p

I'm still gonna wait a bit, the other mod author said he would fix a  naming discrepancy I pointed out. Not that it's hard to do myself, I just want all subscribers to get the "fix" (In detail, assets are named : "dug_reed" whereas the object prefab & name is "dug_reeds") (In even more detail, this discrepancy, makes iterating through recipes  need an exception)

Link to comment
Share on other sites

The reason that it's declared as local in prefab definitions is that it's being passed as a parameter. In 'modmain.lua', it's a global variable. The 'modmain.lua' files are run in a nonstandard environment (which is why 'GLOBAL' exists in them), and the declared table is hence equivalent to a field when considered by the mod loader.

Link to comment
Share on other sites

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.

×
  • Create New...