@tool extends Node # probably move this to some sort of settings at some point var animation_speed = 0.8 func find(type: Script): var root = null if Engine.is_editor_hint(): root = get_tree().edited_scene_root else: root = get_tree().root return find_child_type(root, type) func find_parent_type(node: Node, type: Script): var current_node = node if node == null: return null var i = 0 while current_node != null and i < 10: i += 1 if is_instance_of(current_node, type): return current_node current_node = current_node.get_parent() return null; func find_child_type(base: Node, type: Script): if is_instance_of(base, type): return base for child in base.get_children(): var found_node = find_child_type(child, type) if found_node != null: return found_node return null func center_rect(rect: Rect2) -> Rect2: return Rect2(rect.size / -2, rect.size) func is_debug(): return true