2023-12-15 22:44:25 +01:00
|
|
|
# (c) 2023-present Eroax
|
|
|
|
# (c) 2023-present Yagich
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
2023-11-27 10:28:36 +01:00
|
|
|
extends DeckNode
|
|
|
|
|
|
|
|
|
|
|
|
func _init():
|
|
|
|
name = "Delay"
|
|
|
|
node_type = name.to_snake_case()
|
2023-12-15 22:44:25 +01:00
|
|
|
description = "A node that passes through its' input after the set time."
|
|
|
|
|
2024-03-11 07:22:55 +01:00
|
|
|
add_input_port(
|
|
|
|
DeckType.Types.NUMERIC,
|
|
|
|
"Delay Time",
|
|
|
|
"spinbox:unbounded:0.01",
|
|
|
|
Port.UsageType.VALUE_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
add_input_port(
|
|
|
|
DeckType.Types.ANY,
|
|
|
|
"Value",
|
|
|
|
"",
|
|
|
|
Port.UsageType.TRIGGER,
|
|
|
|
)
|
|
|
|
|
|
|
|
add_output_port(
|
|
|
|
DeckType.Types.ANY,
|
|
|
|
"Value",
|
|
|
|
"",
|
|
|
|
Port.UsageType.TRIGGER,
|
|
|
|
)
|
2023-12-15 22:44:25 +01:00
|
|
|
|
2023-11-27 10:28:36 +01:00
|
|
|
|
2024-02-22 08:23:25 +01:00
|
|
|
func _receive(_to_input_port : int, data: Variant) -> void:
|
2024-03-11 07:22:55 +01:00
|
|
|
var time: float = await resolve_input_port_value_async(0)
|
|
|
|
await Engine.get_main_loop().create_timer(time).timeout
|
|
|
|
send(0, data)
|