added machine item slots so ican start building gameplay
This commit is contained in:
@@ -20,7 +20,7 @@ func updateHotbar(hotbar: HotbarResource):
|
||||
MainGame.currentHeldItemID = item.ID
|
||||
slotInstance.setItem(item, is_selected)
|
||||
|
||||
func givePlayerItem(ID:String, ):
|
||||
func givePlayerItem(ID:String):
|
||||
var segments = ID.split(":")
|
||||
|
||||
for index in hotbar.slots.size():
|
||||
@@ -29,15 +29,17 @@ func givePlayerItem(ID:String, ):
|
||||
hotbar.slots[index] = load("res://GameShit/ItemHandlers/{namespace}/{id}.tres".format({"namespace": segments[0], "id": segments[1]}))
|
||||
updateHotbar(hotbar)
|
||||
return
|
||||
else:
|
||||
print("there will be a UIThrowException call eventually but im too lazy to implement it rn")
|
||||
print("UI.Command.give.InventoryFullException")
|
||||
|
||||
func removePlayerHeldItem():
|
||||
hotbar.slots[MainGame.selectedSlot] = load("res://GameShit/ItemHandlers/base/air.tres")
|
||||
updateHotbar(hotbar)
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
## connect the InventoryBus signal for the shit
|
||||
InventoryBus.givePlayerItem.connect(givePlayerItem)
|
||||
InventoryBus.removeHeldItem.connect(removePlayerHeldItem)
|
||||
|
||||
## throw in some default slots
|
||||
if hotbar.slots.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user