Itemslots can be used to create inventories displays. Think about a character inventory, a bag, a chest or a cabinet. Although ItemSlots can be used as is, they can be used in combination with an Inventory Manager. Itemslots can contain an item which can be dragged over to other item slots.
- FG_Itemslot:Create() --Creates a new itemslot
- SetItem(ImagePath, item) --Sets a new item to the ItemSlot. The first argument is the path to a texture that is needed for displaying the item in the ItemSlot. The second argument is the item itself. The item you store in here can have any kind of information you want. From variables like Hunger, Thirst, Damage etc. Look at the example scenes to see what kind of things you can store in an item.
- GetItem() --Returns the item that is stored in the ItemSlot. Returns nil if the item is empty.
- HasItem() --Returns true or false depending on whether the ItemSlot has an item.
- SetMouseHoverEvent(event) --Stores the function that needs to be executed when the itemslot is hovered.
- SetItemUseEvent(event) --Stores the function that needs to be executed when the itemslot has an item and when the itemslot is clicked on with the left mouse button.
- SetItemRemovedEvent(event) ----Stores the function that needs to be executed when the itemslot has its item removed.
- SetItemDraggedEvent(event) --Stores the function that needs to be executed when an itemslots receives a new item by dragging an item on it from another itemslot.
- SetOnEnterEvent()—Stores a function that needs to be executed when the mouse enters the itemslot.