mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
43 lines
809 B
GDScript
43 lines
809 B
GDScript
extends DeckNode
|
|
|
|
|
|
func _init() -> void:
|
|
name = "Print"
|
|
node_type = name.to_snake_case()
|
|
description = "print a value"
|
|
|
|
add_input_port(
|
|
Deck.Types.STRING,
|
|
"Text to print",
|
|
"field"
|
|
)
|
|
|
|
add_input_port(
|
|
Deck.Types.BOOL,
|
|
"Trigger",
|
|
"button"
|
|
)
|
|
|
|
add_output_port(
|
|
Deck.Types.BOOL,
|
|
"On Trigger",
|
|
"label"
|
|
)
|
|
|
|
|
|
func _receive(to_port: int, data: DeckType, extra_data: Array = []) -> void:
|
|
if to_port != 1:
|
|
return
|
|
|
|
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()
|
|
|
|
# var data_to_print = input_ports[0].value_callback.call()
|
|
print(data_to_print)
|
|
print("extra data: ", extra_data)
|
|
send(2, DeckType.DeckTypeBool.new(true))
|