In the documentation, it says that various arguments can be passed in user-defined signals (weapon type, damage, etc.), but when I try this, I only get errors. So right now, I have this. Basically it is just emitting a signal to add an item to an ItemList node:
The "item" (an Area):
extends Area
class_name Items
export var item = "name"
signal add_item
func _on_Area_body_entered(body):
if body.name == "kiyuga":
print("AddItem")
emit_signal("add_item")
queue_free()
pass
And this is the "inventory" where the thing is going:
onready var testInventory = $PauseTabs/Equipment/GridContainer/TabContainer/ItemList
...
func _on_Area_add_item():
testInventory.add_item("Name") #understanding that it's just a placeholder name and I'm not expecting the actual name
Which is great and all, except I'd rather not have separate scripts for every single item. But when I try to do something like
emit_signal("add_item", item)
connect("add_item", self, "_on_Area_add_item", [item])
func _on_Area_add_item():
testInventory.add_item(item)
I get errors and nothing happens. I am very confused. What am I missing?