Jump to content

Being able to draw custom inventory images on minisigns

Recommended Posts

	if inst.qyt_customimagefix~=true and inst.components.drawable~=nil then
		local _OnDrawn_Old = inst.components.drawable.OnDrawn or (function() return end) 
		inst.components.drawable.OnDrawn = function(self,imagename,imagesource, ...)
			_OnDrawn_Old(self,imagename,imagesource, ...)
			if imagesource~=nil and imagesource.components.inventoryitem~=nil and imagesource.components.inventoryitem.atlasname~=nil then
				inst.AnimState:OverrideSymbol("SWAP_SIGN",GLOBAL.resolvefilepath(imagesource.components.inventoryitem.atlasname),(imagesource.components.inventoryitem.imagename or imagesource.prefab)..".tex")

place in modmain.lua

The script above lets you draw custom inventory images on minisigns. By default, the minisigns will just appear empty because the drawable component doesn't check if the item has a custom atlas.

Link to comment
Share on other sites

On 3/16/2018 at 3:54 AM, JohnWatson said:

make sure that the 'inventoryitem' component of your item has an 'atlasname' variable whose value is the path of an xml file

If you're referring to "inst.components.inventoryitem.atlasname", my items have that in their scripts.

Link to comment
Share on other sites

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