Jump to content

Recommended Posts

I am a new modder and only know a few APIs. In DST mods, I found most resovled atlases can be tested by TheSim:AtlasContains but some images from other mods (not all mods, just some) cannot pass.  I appreciate if anyone can explain the difference.

I checked code of 'GetInventoryItemAtlas' but TheSim:AtlasContains seems in the engine code

function FoodItem:DefineAssetData()
  self.item_tex = self.prefab..'.tex'
  self.atlas = GetInventoryItemAtlas(self.item_tex)
  self.localized_name = STRINGS.NAMES[string.upper(self.prefab)] or self.prefab
  if not self.atlas or not TheSim:AtlasContains(self.atlas, self.item_tex) then
    print("Craft pot ~ AssetData: failed to resolve[" .. self.prefab .. "]" .. self.localized_name .. " tex:" .. (self.item_tex or "nil") .. " atlas:" .. (self.atlas or "nil"))
  end
end

The followings are logs of above code.

[00:39:10]: WARNING! Invalid resource handle for atlas 'FROMNUM', did you remember to load the asset?
[00:39:10]: Craft pot ~ AssetData: failed to resolve[myth_food_nx]XXXXX tex:myth_food_nx.tex atlas:images/inventoryimages/myth_food_nx.xml    
[00:39:10]: WARNING! Invalid resource handle for atlas 'FROMNUM', did you remember to load the asset?
[00:39:10]: Craft pot ~ AssetData: failed to resolve[myth_food_hlbz]XXXX tex:myth_food_hlbz.tex atlas:images/inventoryimages/myth_food_hlbz.xml    

@Rickzzs How can I load them since they are in other mods not mine? BTW, besides the warnings, images still show in my mod correctly. Do I have to Asset(...) the images in other mods though they must have been loaded by the owner mod?

@Rickzzs Besides the warnings above, the image of the atlas displayed correctly. I guess it could be a timing issue, since GetInventoryItemAtlas and TheSim:AtlasContains are called in modmain. However, my focus is GetInventoryItemAtlas can give me correct results but the results are failed to be tested by TheSim:AtlasContains. 

4 hours ago, xlsean said:

Besides the warnings above, the image of the atlas displayed correctly

No, I meant the image resolved by GetInventoryItemAtlas can be displayed correctly in my widgets ;)

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...