From 0cfdf81b48c1b1fb91e6403f97b68a2c10ca0675 Mon Sep 17 00:00:00 2001 From: blujai831 Date: Sat, 6 Jan 2024 18:47:57 -0800 Subject: [PATCH] Immediately changed my mind about previous commit and changed default tween channel arbitration mode back to YIELD. Instead implemented a constructor which takes arbitration mode as an optional parameter. This way I can initialize arbitration mode to REPLACE as needed in variable declarations of type TweenChannel, rather than having to do it in _ready, and still have the default be YIELD. --- util/TweenChannel.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/TweenChannel.gd b/util/TweenChannel.gd index f676c96..da1471c 100644 --- a/util/TweenChannel.gd +++ b/util/TweenChannel.gd @@ -19,10 +19,16 @@ enum ArbitrationMode { ## and it changes while the call is yielding, then the in-progress call ## still will not return until its turn, as though arbitration_mode ## were still YIELD. -var arbitration_mode := ArbitrationMode.REPLACE +var arbitration_mode: ArbitrationMode ## Tween currently running if any, else null. var current_tween: Tween = null +## Initializer. Sets arbitration mode. +func _init( + p_arbitration_mode: ArbitrationMode = ArbitrationMode.YIELD +) -> void: + arbitration_mode = p_arbitration_mode + ## Returns target.create_tween() if and when arbitration_mode allows. ## ## "If:" if arbitration_mode is IGNORE and there is a current tween,