extends Resource class_name Interface export(Array, String) var method_names func assert_implemented_by(script): if !(script is Script): script = script.get_script() var methods = {} for method in script.get_script_method_list(): methods[method.name] = method for method_name in method_names: assert(methods.has(method_name), "`%s` does not implement `%s` from interface `%s`" % [script.resource_path, method_name, resource_path]) static func check_script(path: String): var script: Script = load(path) var interfaces = script.get("INTERFACES") if interfaces == null: return for interface in interfaces: interface.assert_implemented_by(script) static func check_all_scripts(path: String): if not OS.is_debug_build(): return var dir = Directory.new() if dir.open(path) == OK: dir.list_dir_begin() var file_name = dir.get_next() while file_name != "": if dir.current_is_dir(): if not file_name.begins_with("."): check_all_scripts(path + "/" + file_name) else: if file_name.ends_with(".gd"): check_script(path + "/" + file_name) file_name = dir.get_next() else: print("An error occurred when trying to access the path.")