From d613aea88605a680073da51c2fe293dd6c21621c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Tue, 19 Mar 2024 10:43:27 +0300 Subject: [PATCH] fix vector subtract --- classes/deck/nodes/math/vector_subtract.gd | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/classes/deck/nodes/math/vector_subtract.gd b/classes/deck/nodes/math/vector_subtract.gd index 347a137..700a231 100644 --- a/classes/deck/nodes/math/vector_subtract.gd +++ b/classes/deck/nodes/math/vector_subtract.gd @@ -25,21 +25,24 @@ func _init() -> void: func _receive(port : int, data : Variant) -> void: - var va = data - if !DeckType.is_valid_vector(data): - - DeckHolder.logger.log_node("Vector Sub: Port %d: Supplied data was not a valid Vector. Please ensure it is a Dictionary with keys 'x' and 'y'" % port) - return - + var va var vb + if port == 0: + va = data vb = await request_value_async(1) else: - vb = await request_value_async(0) + va = await request_value_async(0) + vb = data + + if (not DeckType.is_valid_vector(va)) or (not DeckType.is_valid_vector(vb)): + DeckHolder.logger.log_node("Vector Sub: Port %d: one of the inputs is not a valid Vector. Please ensure it is a Dictionary with keys 'x' and 'y'." % port) + return + var calc = subtract_vectors(va, vb)