Special Container Slot

For complicated devices and alike, you may wish to have two different types of item slots. To many, this may sound very easy at first, since you only need to make a difference in the item test function, like so:

But there is a crucial flaw with the new slot: it’s hard to tell which one is which. There are two ways to go about that: Make a widget background that shows the difference (e.g. one side blue, one side red), or make the slot itself different.

Change the slot image

To do the latter, you need to know the following problems: You need to access the widget, you need to do so every time the container opens (as the widget gets deleten upon closing), you need to find/make and set a texture.

First, you can access the container widget by going to the player instance and following this path:

To change the image, use the following function:

To do that every time the container opens, there is an event:

When looking for slot images, go to the “widgets” folder in “scripts”, the atlas and image paths are found in the respective files and ready to use. For making an image, you probably need the default tile, found in “images/hud.tex”.

Remaining issues

As it turns out, you can no longer put something into the container by shift-clicking the item or hovering it over the container (if no slot takes any item), but only by moving it to the slot.