52 lines
1.1 KiB
GDScript3
52 lines
1.1 KiB
GDScript3
![]() |
extends Node
|
||
|
|
||
|
var charPanel
|
||
|
var invPanel
|
||
|
|
||
|
var weapons
|
||
|
var currentWeapon
|
||
|
|
||
|
func _ready():
|
||
|
charPanel = get_node("CharacterPanel")
|
||
|
invPanel = get_node("Inventory")
|
||
|
invPanel.visible = false
|
||
|
|
||
|
weapons = get_node("ViewportContainer/Viewport/Weapons")
|
||
|
|
||
|
func SelectSlot(slot):
|
||
|
## bruh moment if slot > 3 or slot < 1 :troll:
|
||
|
var item = charPanel.slots[slot].item
|
||
|
|
||
|
## All the Item vars ( idfk if we need any of them tho )
|
||
|
#var itemIcon;
|
||
|
#var itemName;
|
||
|
#var itemValue;
|
||
|
#var itemSlot;
|
||
|
#var slotType;
|
||
|
#var picked = false;
|
||
|
#var rarity = 0;
|
||
|
|
||
|
if currentWeapon != null:
|
||
|
currentWeapon.visible = false
|
||
|
|
||
|
if(item == null):
|
||
|
return
|
||
|
|
||
|
currentWeapon = weapons.get_node(item.itemName)
|
||
|
if currentWeapon != null:
|
||
|
currentWeapon.visible = true
|
||
|
|
||
|
func ShowInventory(value):
|
||
|
invPanel.visible = value
|
||
|
|
||
|
func AddToInventory(itemName, itemIcon):
|
||
|
return invPanel.AddToInventory(itemName, itemIcon)
|
||
|
|
||
|
func AddToHotbar(itemName, itemIcon):
|
||
|
return charPanel.AddToHotbar(itemName, itemIcon)
|
||
|
|
||
|
func has(itemName):
|
||
|
if currentWeapon == null:
|
||
|
return false
|
||
|
return currentWeapon.name == itemName
|