inventory bug fixes, multiplayer pickup sync

This commit is contained in:
N0ble 2025-07-22 00:50:08 -06:00
parent 04a9a299d7
commit 000269875a
14 changed files with 88 additions and 43 deletions

View file

@ -24,10 +24,11 @@ func toggle_inventory() -> bool:
func update_inventory():
for i in inventory.items:
var match_found : bool = false
var new_item = item_scene.instantiate()
# new_item.set_values(i.item.name, i.item.value, i.item.weight)
item_list.add_child(new_item)
new_item.set_values(i.item.name, 10, 10)
print(i.item.name)
print(i)
pass
for j in item_list.get_children():
if j.id.text != str(i.item.id):
match_found = true
if !match_found || item_list.get_children().size() == 1:
item_list.add_child(new_item)
new_item.set_values(i.item.id, i.item.name, 10, 10)

View file

@ -1,11 +1,12 @@
extends Node
@onready var id : Label = $Id
@onready var title : Label = $Name
@onready var value : Label = $Value
@onready var weight : Label = $Weight
func set_values(new_title : String, new_value : int, new_weight : int) -> void:
func set_values(new_id : int, new_title : String, new_value : int, new_weight : int) -> void:
id.text = str(new_id)
title.text = new_title
value.text = str(new_value)
weight.text = str(new_weight)