From 81d0b90bfac7900a7434cdb866a22161759b8ad6 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 3 Jul 2022 18:51:23 +0200 Subject: [PATCH] Add Autoloads reference to Condition execution This allows the use of autloads, their properties and functions in Conditions. Super usefull imo. Might clash with emilios variable implementation, not sure. --- addons/dialogic/Other/DialogicGameHandler.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/dialogic/Other/DialogicGameHandler.gd b/addons/dialogic/Other/DialogicGameHandler.gd index 1d6592b72..6a7bc9e31 100644 --- a/addons/dialogic/Other/DialogicGameHandler.gd +++ b/addons/dialogic/Other/DialogicGameHandler.gd @@ -383,8 +383,13 @@ func interpolate_volume_linearly(value, node): func execute_condition(condition:String) -> bool: var expr = Expression.new() - expr.parse(condition) - return true if expr.execute() else false + var autoload_names = [] + var autoloads = [] + for c in get_tree().root.get_children(): + autoloads.append(c) + autoload_names.append(c.name) + expr.parse(condition, autoload_names) + return true if expr.execute(autoloads) else false func get_autoloads() -> Array: var autoloads = []