22 lines
422 B
GDScript
22 lines
422 B
GDScript
@icon("res://components/Triggerer/antenna.svg")
|
|
class_name TriggerReceiver
|
|
extends Node
|
|
|
|
signal received(data: Dictionary)
|
|
|
|
@export var keys: Array[String]
|
|
|
|
var _triggerer
|
|
|
|
|
|
func _ready():
|
|
if get_tree().root.has_node("Triggerer"):
|
|
_triggerer = get_tree().root.get_node("Triggerer")
|
|
|
|
if _triggerer:
|
|
for key in keys:
|
|
_triggerer.listen(key, _on_received)
|
|
|
|
|
|
func _on_received(data: Dictionary):
|
|
received.emit(data)
|