Hey! To keep it short and simple, im working on a "shopkeeping" game, i have display furniture nodes in the game, and these nodes have "slots" where you can display sellable items.
You can click on an area on this slots to interact with them, this brings up an interface where you can select an item to display and sell there.
Problem is...
The selection interface is a "sibling" separate from the display (Not a child, not a parent) it's easy to "call" from the display cases to the selection interface, but then Im having trouble with the interface knowing from which node and slot the interaction came from.
In the display case code, the lines related to the interaction are these:
func _on_Item0Area_input_event(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed == true:
get_parent().get_node("HUD/Displayinteract").show()
get_parent().get_node("HUD/Displayinteract").call("interactingwith", "0", $item0.global_transform)
"Interactingwith" is a func in the selection interface
"0" is the slot in the display case
and
"$item0.global_transform" is a Position3D where the chosen item will be displayed
But what happens when i have more than 1 display case around the shop? How can the interface know which display case "slot 0" is the one "interacting" with it.
Thanks in advance!