2023-06-24 05:39:50 +02:00
|
|
|
###type=print
|
2023-06-10 19:13:16 +02:00
|
|
|
extends DeckNode
|
|
|
|
|
|
|
|
|
|
|
|
func _init() -> void:
|
|
|
|
add_input_port(
|
|
|
|
Deck.Types.STRING,
|
2023-06-10 20:23:57 +02:00
|
|
|
"Text to print",
|
2023-06-10 19:13:16 +02:00
|
|
|
"field"
|
|
|
|
)
|
|
|
|
|
2023-06-10 20:23:57 +02:00
|
|
|
add_input_port(
|
|
|
|
Deck.Types.BOOL,
|
|
|
|
"Trigger",
|
|
|
|
"button"
|
|
|
|
)
|
|
|
|
|
2023-06-12 17:32:16 +02:00
|
|
|
add_output_port(
|
|
|
|
Deck.Types.BOOL,
|
|
|
|
"On Trigger",
|
|
|
|
"label"
|
|
|
|
)
|
|
|
|
|
2023-06-10 19:13:16 +02:00
|
|
|
name = "Print"
|
2023-06-24 05:39:50 +02:00
|
|
|
node_type = name.to_snake_case()
|
2023-06-10 19:13:16 +02:00
|
|
|
|
|
|
|
|
2023-06-10 20:23:57 +02:00
|
|
|
func _receive(to_port: int, data: DeckType, extra_data: Array = []) -> void:
|
|
|
|
if to_port != 1:
|
|
|
|
return
|
|
|
|
|
2023-06-13 17:23:10 +02:00
|
|
|
var data_to_print
|
|
|
|
if request_value(0) != null:
|
|
|
|
data_to_print = request_value(0)
|
|
|
|
elif ports[0].value_callback.call() != "":
|
|
|
|
data_to_print = ports[0].value_callback.call()
|
|
|
|
else:
|
|
|
|
data_to_print = data.get_value()
|
|
|
|
|
2023-06-11 17:39:26 +02:00
|
|
|
# var data_to_print = input_ports[0].value_callback.call()
|
2023-06-10 19:13:16 +02:00
|
|
|
print(data_to_print)
|
|
|
|
print("extra data: ", extra_data)
|
2023-06-12 17:59:30 +02:00
|
|
|
send(2, DeckType.DeckTypeBool.new(true))
|