diff --git a/addons/dialogic/Core/DialogicUtil.gd b/addons/dialogic/Core/DialogicUtil.gd index 51931b62b..f103ca0c2 100644 --- a/addons/dialogic/Core/DialogicUtil.gd +++ b/addons/dialogic/Core/DialogicUtil.gd @@ -354,7 +354,7 @@ static func get_scene_export_defaults(node:Node) -> Dictionary: if !Engine.get_main_loop().has_meta('dialogic_scene_export_defaults'): Engine.get_main_loop().set_meta('dialogic_scene_export_defaults', {}) var defaults := {} - var property_info :Array[Dictionary] = node.script.get_script_property_list() + var property_info: Array[Dictionary] = node.script.get_script_property_list() for i in property_info: if i['usage'] & PROPERTY_USAGE_EDITOR: defaults[i['name']] = node.get(i['name']) diff --git a/addons/dialogic/Core/index_class.gd b/addons/dialogic/Core/index_class.gd index 8cf2d1490..e19d17181 100644 --- a/addons/dialogic/Core/index_class.gd +++ b/addons/dialogic/Core/index_class.gd @@ -118,7 +118,7 @@ func _get_layout_parts() -> Array[Dictionary]: ## Helper that allows scanning sub directories that might be layout parts or styles func scan_for_layout_parts() -> Array[Dictionary]: var dir := DirAccess.open(this_folder) - var style_list :Array[Dictionary] = [] + var style_list: Array[Dictionary] = [] if !dir: return style_list dir.list_dir_begin() diff --git a/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_exports.gd b/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_exports.gd index 5e795aa12..9ad94cbbb 100644 --- a/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_exports.gd +++ b/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_exports.gd @@ -80,7 +80,7 @@ func _recheck(data: Dictionary, force:=false): ## On any change, save the export override to the portrait items metadata. func set_export_override(property_name:String, value:String = "") -> void: - var data:Dictionary = selected_item.get_metadata(0) + var data: Dictionary = selected_item.get_metadata(0) if !data.has('export_overrides'): data['export_overrides'] = {} if !value.is_empty(): diff --git a/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd b/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd index 6dec0bf47..03f4346e9 100644 --- a/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd +++ b/addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd @@ -17,28 +17,28 @@ func _load_portrait_data(data:Dictionary) -> void: func _on_portrait_scale_value_changed(value:float) -> void: - var data:Dictionary = selected_item.get_metadata(0) + var data: Dictionary = selected_item.get_metadata(0) data['scale'] = value/100.0 update_preview.emit() changed.emit() func _on_portrait_mirror_toggled(button_pressed:bool)-> void: - var data:Dictionary = selected_item.get_metadata(0) + var data: Dictionary = selected_item.get_metadata(0) data['mirror'] = button_pressed update_preview.emit() changed.emit() func _on_ignore_scale_toggled(button_pressed:bool) -> void: - var data:Dictionary = selected_item.get_metadata(0) + var data: Dictionary = selected_item.get_metadata(0) data['ignore_char_scale'] = button_pressed update_preview.emit() changed.emit() func _on_portrait_offset_value_changed(property:String, value:Vector2) -> void: - var data:Dictionary = selected_item.get_metadata(0) + var data: Dictionary = selected_item.get_metadata(0) data['offset'] = value update_preview.emit() changed.emit() diff --git a/addons/dialogic/Editor/CharacterEditor/character_editor.gd b/addons/dialogic/Editor/CharacterEditor/character_editor.gd index 7ea0337cd..c0e606037 100644 --- a/addons/dialogic/Editor/CharacterEditor/character_editor.gd +++ b/addons/dialogic/Editor/CharacterEditor/character_editor.gd @@ -14,7 +14,7 @@ var current_scene_path: String = "" # References var selected_item: TreeItem -var def_portrait_path :String= DialogicUtil.get_module_path('Character').path_join('default_portrait.tscn') +var def_portrait_path: String = DialogicUtil.get_module_path('Character').path_join('default_portrait.tscn') ######### EDITOR STUFF and LOADING/SAVING ###################################### @@ -27,7 +27,7 @@ func _register() -> void: editors_manager.register_resource_editor("dch", self) ## Add an "add character" button - var add_character_button = editors_manager.add_icon_button( + var add_character_button: Button = editors_manager.add_icon_button( load("res://addons/dialogic/Editor/Images/Toolbar/add-character.svg"), 'Add Character', self) @@ -314,7 +314,7 @@ func import_portraits_from_folder(path:String) -> void: var dir := DirAccess.open(path) dir.list_dir_begin() - var file_name :String = dir.get_next() + var file_name: String = dir.get_next() while file_name != "": if not dir.current_is_dir(): var file_lower := file_name.to_lower() diff --git a/addons/dialogic/Editor/CharacterEditor/character_editor_main_settings_section.gd b/addons/dialogic/Editor/CharacterEditor/character_editor_main_settings_section.gd index dc787ed9f..d329d0659 100644 --- a/addons/dialogic/Editor/CharacterEditor/character_editor_main_settings_section.gd +++ b/addons/dialogic/Editor/CharacterEditor/character_editor_main_settings_section.gd @@ -8,7 +8,7 @@ extends Control signal changed ## Reference to the character editor, set when instantiated -var character_editor:Control +var character_editor: Control ## If not empty, a hint icon is added to the section title. var hint_text := "" diff --git a/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_settings_section.gd b/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_settings_section.gd index 864e3bc60..920f8a576 100644 --- a/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_settings_section.gd +++ b/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_settings_section.gd @@ -12,10 +12,10 @@ signal changed signal update_preview ## Reference to the character editor, set when instantiated -var character_editor:Control +var character_editor: Control ## Reference to the selected portrait item. ## `selected_item.get_metadata(0)` can access the portraits data -var selected_item :TreeItem = null +var selected_item: TreeItem = null ## If not empty a hint icon is added to the section title var hint_text := "" diff --git a/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd b/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd index eac719a77..c6fcf4666 100644 --- a/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd +++ b/addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd @@ -64,7 +64,7 @@ func create_necessary_group_items(path: String) -> TreeItem: if current_group_nodes.has(item_path+"/"+i): last_item = current_group_nodes[item_path+"/"+i] else: - var new_item:TreeItem = add_portrait_group(i, last_item) + var new_item: TreeItem = add_portrait_group(i, last_item) current_group_nodes[item_path+"/"+i] = new_item last_item = new_item return last_item @@ -97,7 +97,7 @@ func _can_drop_data(position: Vector2, data: Variant) -> bool: func _drop_data(position: Vector2, item: Variant) -> void: var to_item := get_item_at_position(position) if to_item: - var test_item:= to_item + var test_item := to_item while true: if test_item == item: return diff --git a/addons/dialogic/Editor/Common/BrowserItem.gd b/addons/dialogic/Editor/Common/BrowserItem.gd index 4d8498d83..7bfb3cfc4 100644 --- a/addons/dialogic/Editor/Common/BrowserItem.gd +++ b/addons/dialogic/Editor/Common/BrowserItem.gd @@ -6,7 +6,7 @@ signal middle_clicked signal double_clicked signal focused -var base_size = 1 +var base_size := 1 func _ready() -> void: @@ -14,7 +14,7 @@ func _ready() -> void: return %Name.add_theme_font_override("font", get_theme_font("bold", "EditorFonts")) - custom_minimum_size = base_size*Vector2(200, 150) * DialogicUtil.get_editor_scale() + custom_minimum_size = base_size * Vector2(200, 150) * DialogicUtil.get_editor_scale() %CurrentIcon.texture = get_theme_icon("Favorites", "EditorIcons") if %Image.texture == null: %Image.texture = get_theme_icon("ImportFail", "EditorIcons") diff --git a/addons/dialogic/Editor/Common/ReferenceManager_AddReplacementPanel.gd b/addons/dialogic/Editor/Common/ReferenceManager_AddReplacementPanel.gd index f26c95c69..22626199c 100644 --- a/addons/dialogic/Editor/Common/ReferenceManager_AddReplacementPanel.gd +++ b/addons/dialogic/Editor/Common/ReferenceManager_AddReplacementPanel.gd @@ -5,7 +5,7 @@ extends PanelContainer enum Modes {EDIT, ADD} var mode := Modes.EDIT -var item :TreeItem = null +var item: TreeItem = null func _ready() -> void: @@ -86,7 +86,7 @@ func get_character_suggestions(search_text:String) -> Dictionary: var suggestions := {} #override the previous _character_directory with the meta, specifically for searching otherwise new nodes wont work - var _character_directory = DialogicResourceUtil.get_character_directory() + var _character_directory := DialogicResourceUtil.get_character_directory() var icon := load("res://addons/dialogic/Editor/Images/Resources/character.svg") suggestions['(No one)'] = {'value':null, 'editor_icon':["GuiRadioUnchecked", "EditorIcons"]} diff --git a/addons/dialogic/Editor/Common/broken_reference_manager.gd b/addons/dialogic/Editor/Common/broken_reference_manager.gd index f7bae7c27..b0d11cc3d 100644 --- a/addons/dialogic/Editor/Common/broken_reference_manager.gd +++ b/addons/dialogic/Editor/Common/broken_reference_manager.gd @@ -3,7 +3,7 @@ extends VSplitContainer ## This manager shows a list of changed references and allows searching for them and replacing them. -var reference_changes :Array[Dictionary] = []: +var reference_changes: Array[Dictionary] = []: set(changes): reference_changes = changes update_indicator() @@ -55,7 +55,7 @@ func open() -> void: %ChangeTree.set_column_custom_minimum_width(2, 50) var categories := {null:%ChangeTree.get_root()} for i in reference_changes: - var parent : TreeItem = null + var parent: TreeItem = null if !i.get('category', null) in categories: parent = %ChangeTree.create_item() parent.set_text(1, i.category) @@ -64,7 +64,7 @@ func open() -> void: else: parent = categories[i.get('category')] - var item :TreeItem = %ChangeTree.create_item(parent) + var item: TreeItem = %ChangeTree.create_item(parent) item.set_text(1, i.what+" -> "+i.forwhat) item.add_button(1, get_theme_icon("Edit", "EditorIcons"), 1, false, 'Edit') item.add_button(1, get_theme_icon("Remove", "EditorIcons"), 0, false, 'Remove Change from List') @@ -98,8 +98,8 @@ func _on_change_tree_item_edited() -> void: func _on_check_button_pressed() -> void: - var to_be_checked :Array[Dictionary]= [] - var item :TreeItem = %ChangeTree.get_root() + var to_be_checked: Array[Dictionary]= [] + var item: TreeItem = %ChangeTree.get_root() while item.get_next_visible(): item = item.get_next_visible() @@ -245,7 +245,7 @@ func get_line(string:String, at_index:int) -> String: func update_count_coloring() -> void: - var item :TreeItem = %ChangeTree.get_root() + var item: TreeItem = %ChangeTree.get_root() while item.get_next_visible(): item = item.get_next_visible() @@ -264,9 +264,9 @@ func update_count_coloring() -> void: func _on_replace_pressed() -> void: - var to_be_replaced :Array[Dictionary]= [] - var item :TreeItem = %ReferenceTree.get_root() - var affected_timelines :Array[String]= [] + var to_be_replaced: Array[Dictionary]= [] + var item: TreeItem = %ReferenceTree.get_root() + var affected_timelines: Array[String]= [] while item.get_next_visible(): item = item.get_next_visible() @@ -284,7 +284,7 @@ func _on_replace_pressed() -> void: func replace(timelines:Array[String], replacement_info:Array[Dictionary]) -> void: var reopen_timeline := "" - var timeline_editor :DialogicEditor = find_parent('EditorView').editors_manager.editors['Timeline'].node + var timeline_editor: DialogicEditor = find_parent('EditorView').editors_manager.editors['Timeline'].node if timeline_editor.current_resource != null and timeline_editor.current_resource.resource_path in timelines: reopen_timeline = timeline_editor.current_resource.resource_path find_parent('EditorView').editors_manager.clear_editor(timeline_editor) @@ -295,7 +295,7 @@ func replace(timelines:Array[String], replacement_info:Array[Dictionary]) -> voi %State.text = "Loading '"+timeline_path+"'" var timeline_file := FileAccess.open(timeline_path, FileAccess.READ_WRITE) - var timeline_text :String = timeline_file.get_as_text() + var timeline_text: String = timeline_file.get_as_text() var timeline_events := timeline_text.split('\n') timeline_file.close() @@ -343,7 +343,7 @@ func update_indicator() -> void: func close() -> void: - var item :TreeItem = %ChangeTree.get_root() + var item: TreeItem = %ChangeTree.get_root() if item: while item.get_next_visible(): item = item.get_next_visible() diff --git a/addons/dialogic/Editor/Common/hint_tooltip_icon.gd b/addons/dialogic/Editor/Common/hint_tooltip_icon.gd index dd720e019..702fe9835 100644 --- a/addons/dialogic/Editor/Common/hint_tooltip_icon.gd +++ b/addons/dialogic/Editor/Common/hint_tooltip_icon.gd @@ -1,7 +1,7 @@ @tool extends TextureRect -@export_multiline var hint_text = "" +@export_multiline var hint_text := "" func _ready() -> void: if owner and owner.get_parent() is SubViewport: diff --git a/addons/dialogic/Editor/Common/reference_manager_window.gd b/addons/dialogic/Editor/Common/reference_manager_window.gd index 98ba42af9..7bb42ec72 100644 --- a/addons/dialogic/Editor/Common/reference_manager_window.gd +++ b/addons/dialogic/Editor/Common/reference_manager_window.gd @@ -10,7 +10,7 @@ extends Window enum Where {EVERYWHERE, BY_CHARACTER, TEXTS_ONLY} enum Types {TEXT, VARIABLE, PORTRAIT, CHARACTER_NAME, TIMELINE_NAME} -var icon_button :Button = null +var icon_button: Button = null func _ready() -> void: @@ -31,7 +31,7 @@ func _ready() -> void: icon_button.add_child(dot) - var old_changes :Array = DialogicUtil.get_editor_setting('reference_changes', []) + var old_changes: Array = DialogicUtil.get_editor_setting('reference_changes', []) if !old_changes.is_empty(): broken_manager.reference_changes = old_changes diff --git a/addons/dialogic/Editor/Common/sidebar.gd b/addons/dialogic/Editor/Common/sidebar.gd index e8bfdaafe..f1f410264 100644 --- a/addons/dialogic/Editor/Common/sidebar.gd +++ b/addons/dialogic/Editor/Common/sidebar.gd @@ -7,7 +7,7 @@ signal file_activated(file_path) signal content_item_activated(item_name) -@onready var editors_manager = get_parent().get_parent() +@onready var editors_manager: Node = get_parent().get_parent() func _ready() -> void: @@ -62,7 +62,7 @@ func clean_resource_list(resources_list:Array = []) -> PackedStringArray: func update_resource_list(resources_list:PackedStringArray = []) -> void: - var filter :String = %Search.text + var filter: String = %Search.text var current_file := "" if editors_manager.current_editor and editors_manager.current_editor.current_resource: current_file = editors_manager.current_editor.current_resource.resource_path diff --git a/addons/dialogic/Editor/Common/unique_identifiers_manager.gd b/addons/dialogic/Editor/Common/unique_identifiers_manager.gd index 28a47354e..fc7c993e0 100644 --- a/addons/dialogic/Editor/Common/unique_identifiers_manager.gd +++ b/addons/dialogic/Editor/Common/unique_identifiers_manager.gd @@ -48,7 +48,7 @@ func fill_table() -> void: func _on_identifier_table_item_edited() -> void: var item: TreeItem = %IdentifierTable.get_edited() - var new_identifier : String = item.get_text(1) + var new_identifier: String = item.get_text(1) if new_identifier == item.get_metadata(1): diff --git a/addons/dialogic/Editor/Common/update_install_window.gd b/addons/dialogic/Editor/Common/update_install_window.gd index c759b35a1..f018287e8 100644 --- a/addons/dialogic/Editor/Common/update_install_window.gd +++ b/addons/dialogic/Editor/Common/update_install_window.gd @@ -1,7 +1,7 @@ @tool extends Control -var current_info : Dictionary = {} +var current_info := {} @onready var editor_view := find_parent('EditorView') diff --git a/addons/dialogic/Editor/Common/update_manager.gd b/addons/dialogic/Editor/Common/update_manager.gd index fd49b6f42..36a116ec5 100644 --- a/addons/dialogic/Editor/Common/update_manager.gd +++ b/addons/dialogic/Editor/Common/update_manager.gd @@ -11,13 +11,13 @@ enum DownloadResult {SUCCESS, FAILURE} enum ReleaseState {ALPHA, BETA, STABLE} const REMOTE_RELEASES_URL := "https://api.github.com/repos/dialogic-godot/dialogic/releases" -const TEMP_FILE_NAME = "user://temp.zip" +const TEMP_FILE_NAME := "user://temp.zip" -var current_version : String = "" +var current_version := "" var update_info: Dictionary var current_info: Dictionary -var version_indicator :Button +var version_indicator: Button func _ready() -> void: request_update_check() @@ -43,14 +43,14 @@ func _on_UpdateCheck_request_completed(result:int, response_code:int, headers:Pa return # Work out the next version from the releases information on GitHub - var response :Variant= JSON.parse_string(body.get_string_from_utf8()) + var response: Variant = JSON.parse_string(body.get_string_from_utf8()) if typeof(response) != TYPE_ARRAY: return var current_release_info := get_release_tag_info(get_current_version()) # GitHub releases are in order of creation, not order of version - var versions :Array = (response as Array).filter(compare_versions.bind(current_release_info)) + var versions: Array = (response as Array).filter(compare_versions.bind(current_release_info)) if versions.size() > 0: update_info = versions[0] update_check_completed.emit(UpdateCheckResult.UPDATE_AVAILABLE) @@ -98,7 +98,7 @@ func get_release_tag_info(release_tag:String) -> Dictionary: if !result: return {} - var info:Dictionary = {'tag':release_tag} + var info: Dictionary = {'tag':release_tag} info['major'] = float(result.get_string('major')) info['minor'] = int(result.get_string('minor')) @@ -141,7 +141,7 @@ func _on_DownloadRequest_completed(result:int, response_code:int, headers:Packed zip_reader.open(TEMP_FILE_NAME) var files: PackedStringArray = zip_reader.get_files() - var base_path = files[0].path_join('addons/') + var base_path: String = files[0].path_join('addons/') for path in files: if not "dialogic/" in path: continue @@ -169,7 +169,7 @@ func setup_version_indicator() -> void: func _on_update_check_completed(result:int): - var result_color : Color + var result_color: Color match result: UpdateCheckResult.UPDATE_AVAILABLE: result_color = version_indicator.get_theme_color("warning_color", "Editor") diff --git a/addons/dialogic/Editor/Events/EventBlock/event_block.gd b/addons/dialogic/Editor/Events/EventBlock/event_block.gd index 554686b13..f5c39d365 100644 --- a/addons/dialogic/Editor/Events/EventBlock/event_block.gd +++ b/addons/dialogic/Editor/Events/EventBlock/event_block.gd @@ -6,7 +6,7 @@ extends MarginContainer signal content_changed() ## REFERENCES -var resource : DialogicEvent +var resource: DialogicEvent var editor_reference # for choice and condition var end_node: Node = null: @@ -194,7 +194,7 @@ func build_editor(build_header:bool = true, build_body:bool = false) -> void: ### -------------------------------------------------------------------- ### 1. CREATE A NODE OF THE CORRECT TYPE FOR THE PROPERTY - var editor_node : Control + var editor_node: Control ### LINEBREAK if p.name == "linebreak": @@ -376,7 +376,7 @@ func _on_resource_ui_update_needed() -> void: func _on_collapse_toggled(toggled:bool) -> void: collapsed = toggled - var timeline_editor = find_parent('VisualEditor') + var timeline_editor: Node = find_parent('VisualEditor') if (timeline_editor != null): # @todo select item and clear selection is marked as "private" in TimelineEditor.gd # consider to make it "public" or add a public helper function @@ -410,7 +410,7 @@ func _on_EventNode_gui_input(event:InputEvent) -> void: # For opening the context menu if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed: - var popup :PopupMenu = get_parent().get_parent().get_node('EventPopupMenu') + var popup: PopupMenu = get_parent().get_parent().get_node('EventPopupMenu') popup.current_event = self popup.popup_on_parent(Rect2(get_global_mouse_position(),Vector2())) if resource.help_page_path == "": diff --git a/addons/dialogic/Editor/Events/EventBlock/event_right_click_menu.gd b/addons/dialogic/Editor/Events/EventBlock/event_right_click_menu.gd index 16b08838b..0b765f633 100644 --- a/addons/dialogic/Editor/Events/EventBlock/event_right_click_menu.gd +++ b/addons/dialogic/Editor/Events/EventBlock/event_right_click_menu.gd @@ -1,7 +1,7 @@ @tool extends PopupMenu -var current_event : Node = null +var current_event: Node = null func _ready() -> void: clear() diff --git a/addons/dialogic/Editor/Events/Fields/field_array.gd b/addons/dialogic/Editor/Events/Fields/field_array.gd index 0f5793d8e..301ade502 100644 --- a/addons/dialogic/Editor/Events/Fields/field_array.gd +++ b/addons/dialogic/Editor/Events/Fields/field_array.gd @@ -39,7 +39,7 @@ func recalculate_values() -> void: func _on_AddButton_pressed() -> void: - var x :Control = load(ArrayValue).instantiate() + var x: Control = load(ArrayValue).instantiate() add_child(x) x.set_value("") x.value_changed.connect(recalculate_values) diff --git a/addons/dialogic/Editor/Events/Fields/field_condition.gd b/addons/dialogic/Editor/Events/Fields/field_condition.gd index 84819d709..db40270b5 100644 --- a/addons/dialogic/Editor/Events/Fields/field_condition.gd +++ b/addons/dialogic/Editor/Events/Fields/field_condition.gd @@ -3,8 +3,8 @@ extends DialogicVisualEditorField ## Event block field for displaying conditions in either a simple or complex way. -var _current_value1 :Variant = "" -var _current_value2 :Variant = "" +var _current_value1: Variant = "" +var _current_value2: Variant = "" #region MAIN METHODS ################################################################################ @@ -96,7 +96,7 @@ func value_type_changed(property:String, value_type:int, value_name:String) -> v get_node('%'+value_name+'Text').hide() get_node('%'+value_name+'Number').hide() get_node('%'+value_name+'Bool').hide() - var current_val :Variant = "" + var current_val: Variant = "" if '1' in value_name: current_val = _current_value1 else: @@ -237,7 +237,7 @@ func _on_complex_editor_text_changed(new_text:String) -> void: func get_variable_suggestions(filter:String) -> Dictionary: var suggestions := {} - var vars :Dictionary= ProjectSettings.get_setting('dialogic/variables', {}) + var vars: Dictionary = ProjectSettings.get_setting('dialogic/variables', {}) for var_path in DialogicUtil.list_variables(vars): suggestions[var_path] = {'value':var_path, 'editor_icon':["ClassList", "EditorIcons"]} return suggestions diff --git a/addons/dialogic/Editor/Events/Fields/field_dictionary.gd b/addons/dialogic/Editor/Events/Fields/field_dictionary.gd index 6b496a7ab..f915a6602 100644 --- a/addons/dialogic/Editor/Events/Fields/field_dictionary.gd +++ b/addons/dialogic/Editor/Events/Fields/field_dictionary.gd @@ -20,7 +20,7 @@ func _set_value(value:Variant) -> void: dict = value elif typeof(value) == TYPE_STRING: if value.begins_with('{'): - var result = JSON.parse_string(value) + var result: Variant = JSON.parse_string(value) if result != null: dict = result as Dictionary else: diff --git a/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd b/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd index ee7c25c4d..7ca7391f7 100644 --- a/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd +++ b/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd @@ -127,8 +127,8 @@ func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void: var suggestions: Dictionary = get_suggestions_func.call(new_text) - var line_length = 0 - var idx: int = 0 + var line_length := 0 + var idx := 0 for element in suggestions: if new_text.is_empty() or new_text.to_lower() in element.to_lower() or new_text.to_lower() in str(suggestions[element].value).to_lower() or new_text.to_lower() in suggestions[element].get('tooltip', '').to_lower(): var curr_line_length: int = 0 diff --git a/addons/dialogic/Editor/Events/Fields/field_options_fixed.gd b/addons/dialogic/Editor/Events/Fields/field_options_fixed.gd index 0b379f50e..3f7efb2e1 100644 --- a/addons/dialogic/Editor/Events/Fields/field_options_fixed.gd +++ b/addons/dialogic/Editor/Events/Fields/field_options_fixed.gd @@ -3,7 +3,7 @@ extends DialogicVisualEditorField ## Event block field for constant options. For varying options use ComplexPicker. -var options : Array = [] +var options: Array = [] ## if true, only the symbol will be displayed. In the dropdown text will be visible. ## Useful for making UI simpler diff --git a/addons/dialogic/Editor/Events/Fields/field_text_singleline.gd b/addons/dialogic/Editor/Events/Fields/field_text_singleline.gd index 6f83ae115..765f86236 100644 --- a/addons/dialogic/Editor/Events/Fields/field_text_singleline.gd +++ b/addons/dialogic/Editor/Events/Fields/field_text_singleline.gd @@ -4,7 +4,7 @@ extends DialogicVisualEditorField ## Event block field for a single line of text. -var placeholder :String= "": +var placeholder := "": set(value): placeholder = value self.placeholder_text = placeholder diff --git a/addons/dialogic/Editor/HomePage/home_page.gd b/addons/dialogic/Editor/HomePage/home_page.gd index ab2b90d8e..15aff2522 100644 --- a/addons/dialogic/Editor/HomePage/home_page.gd +++ b/addons/dialogic/Editor/HomePage/home_page.gd @@ -3,7 +3,7 @@ extends DialogicEditor ## A Main page in the dialogic editor. -var tips : Array = [] +var tips: Array = [] @@ -44,7 +44,7 @@ func _open(extra_info:Variant="") -> void: tips = tips.filter(func(item): return !item.is_empty()) randomize() - var tip :String = tips[randi()%len(tips)] + var tip: String = tips[randi()%len(tips)] var text := tip.get_slice(';',0).strip_edges() var action := tip.get_slice(';',1).strip_edges() if action == text: diff --git a/addons/dialogic/Editor/Settings/settings_editor.gd b/addons/dialogic/Editor/Settings/settings_editor.gd index ef938d338..3d87c4abc 100644 --- a/addons/dialogic/Editor/Settings/settings_editor.gd +++ b/addons/dialogic/Editor/Settings/settings_editor.gd @@ -4,7 +4,7 @@ extends DialogicEditor ## Editor that contains all settings var button_group := ButtonGroup.new() -var registered_sections :Array[DialogicSettingsPage] = [] +var registered_sections: Array[DialogicSettingsPage] = [] func _get_title() -> String: @@ -38,7 +38,7 @@ func _ready() -> void: func register_settings_section(path:String) -> void: - var section :Control = load(path).instantiate() + var section: Control = load(path).instantiate() registered_sections.append(section) @@ -71,7 +71,7 @@ func add_registered_sections() -> void: if !section.short_info.is_empty(): - var tooltip_hint :Control = load("res://addons/dialogic/Editor/Common/hint_tooltip_icon.tscn").instantiate() + var tooltip_hint: Control = load("res://addons/dialogic/Editor/Common/hint_tooltip_icon.tscn").instantiate() tooltip_hint.hint_text = section.short_info hbox.add_child(tooltip_hint) @@ -91,7 +91,7 @@ func add_registered_sections() -> void: inner_vbox.add_child(panel) - var info_section :Control = section._get_info_section() + var info_section: Control = section._get_info_section() if info_section != null: inner_vbox.add_child(Control.new()) inner_vbox.get_child(-1).custom_minimum_size.y = 50 diff --git a/addons/dialogic/Editor/Settings/settings_general.gd b/addons/dialogic/Editor/Settings/settings_general.gd index 371b521f3..07500c4e1 100644 --- a/addons/dialogic/Editor/Settings/settings_general.gd +++ b/addons/dialogic/Editor/Settings/settings_general.gd @@ -41,11 +41,11 @@ func _refresh() -> void: %SectionList.create_item() var cached_events := DialogicResourceUtil.get_event_cache() var sections := [] - var section_order :Array = DialogicUtil.get_editor_setting('event_section_order', ['Main', 'Logic', 'Flow', 'Audio', 'Visuals','Other', 'Helper']) + var section_order: Array = DialogicUtil.get_editor_setting('event_section_order', ['Main', 'Logic', 'Flow', 'Audio', 'Visuals','Other', 'Helper']) for ev in cached_events: if !ev.event_category in sections: sections.append(ev.event_category) - var item :TreeItem = %SectionList.create_item(null) + var item: TreeItem = %SectionList.create_item(null) item.set_text(0, ev.event_category) item.add_button(0, get_theme_icon("ArrowUp", "EditorIcons")) item.add_button(0, get_theme_icon("ArrowDown", "EditorIcons")) @@ -140,13 +140,13 @@ func _on_submit_extension_button_pressed() -> void: if %NameEdit.text.is_empty(): return - var extensions_folder :String = ProjectSettings.get_setting('dialogic/extensions_folder', 'res://addons/dialogic_additions') + var extensions_folder: String = ProjectSettings.get_setting('dialogic/extensions_folder', 'res://addons/dialogic_additions') extensions_folder = extensions_folder.path_join(%NameEdit.text.to_pascal_case()) DirAccess.make_dir_recursive_absolute(extensions_folder) - var mode :int= %ExtensionMode.selected + var mode: int = %ExtensionMode.selected - var file : FileAccess + var file: FileAccess var indexer_content := "@tool\nextends DialogicIndexer\n\n" if mode != 1: # don't add event in Subsystem Only mode indexer_content += """func _get_events() -> Array: diff --git a/addons/dialogic/Editor/Settings/settings_modules.gd b/addons/dialogic/Editor/Settings/settings_modules.gd index 8c9625f87..702f54f91 100644 --- a/addons/dialogic/Editor/Settings/settings_modules.gd +++ b/addons/dialogic/Editor/Settings/settings_modules.gd @@ -61,7 +61,7 @@ func _on_search_text_changed(new_text:String) -> void: filter.text = "" filter.set_meta("counter", 0) - var hidden_events :Array= DialogicUtil.get_editor_setting('hidden_event_buttons', []) + var hidden_events: Array = DialogicUtil.get_editor_setting('hidden_event_buttons', []) for child in %Tree.get_root().get_children(): if new_text.to_lower() in child.get_text(0).to_lower() or new_text.is_empty(): @@ -86,7 +86,7 @@ func _on_search_text_changed(new_text:String) -> void: if sub_child.visible: child.add_button(0, sub_child.get_icon(0), counter, false, sub_child.get_text(0)) if sub_child.get_metadata(0) and sub_child.get_metadata(0)['type'] == 'Event' and sub_child.get_metadata(0)['hidden']: - var color : Color = sub_child.get_icon_modulate(0) + var color: Color = sub_child.get_icon_modulate(0) color.a = 0.5 child.set_button_color(0, counter, color) else: @@ -99,12 +99,12 @@ func _on_search_text_changed(new_text:String) -> void: func load_modules_tree() -> void: %Tree.clear() - var root :TreeItem = %Tree.create_item() + var root: TreeItem = %Tree.create_item() var cached_events := DialogicResourceUtil.get_event_cache() var hidden_events: Array = DialogicUtil.get_editor_setting('hidden_event_buttons', []) var indexers := DialogicUtil.get_indexers() for i in indexers: - var module_item :TreeItem = %Tree.create_item(root) + var module_item: TreeItem = %Tree.create_item(root) module_item.set_text(0, i.get_script().resource_path.trim_suffix('/index.gd').get_file()) module_item.set_metadata(0, {'type':'Module'}) @@ -112,13 +112,13 @@ func load_modules_tree() -> void: for ev in i._get_events(): if not ResourceLoader.exists(ev): continue - var event_item : TreeItem = %Tree.create_item(module_item) + var event_item: TreeItem = %Tree.create_item(module_item) event_item.set_icon(0, get_theme_icon("Favorites", "EditorIcons")) for cached_event in cached_events: if cached_event.get_script().resource_path == ev: event_item.set_text(0, cached_event.event_name + " Event") event_item.set_icon_modulate(0, cached_event.event_color) - var hidden :bool = cached_event.event_name in hidden_events + var hidden: bool = cached_event.event_name in hidden_events event_item.set_metadata(0, {'type':'Event', 'event':cached_event, 'hidden':hidden}) event_item.add_button(0, get_theme_icon("GuiVisibilityVisible", "EditorIcons"), 0, false, "Toggle Event Button Visibility") if hidden: @@ -128,7 +128,7 @@ func load_modules_tree() -> void: # Subsystems for subsys in i._get_subsystems(): - var subsys_item : TreeItem = %Tree.create_item(module_item) + var subsys_item: TreeItem = %Tree.create_item(module_item) subsys_item.set_icon(0, get_theme_icon("Callable", "EditorIcons")) subsys_item.set_text(0, subsys.name + " Subsystem") subsys_item.set_icon_modulate(0, get_theme_color("readonly_color", "Editor")) @@ -138,7 +138,7 @@ func load_modules_tree() -> void: # Style scenes for style in i._get_layout_parts(): - var style_item : TreeItem = %Tree.create_item(module_item) + var style_item: TreeItem = %Tree.create_item(module_item) style_item.set_icon(0, get_theme_icon("PopupMenu", "EditorIcons")) style_item.set_text(0, style.name) style_item.set_icon_modulate(0, get_theme_color("property_color_x", "Editor")) @@ -148,7 +148,7 @@ func load_modules_tree() -> void: # Text Effects for effect in i._get_text_effects(): - var effect_item : TreeItem = %Tree.create_item(module_item) + var effect_item: TreeItem = %Tree.create_item(module_item) effect_item.set_icon(0, get_theme_icon("RichTextEffect", "EditorIcons")) effect_item.set_text(0, "Text effect ["+effect.command+"]") effect_item.set_icon_modulate(0, get_theme_color("property_color_z", "Editor")) @@ -158,7 +158,7 @@ func load_modules_tree() -> void: # Text Modifiers for mod in i._get_text_modifiers(): - var mod_item : TreeItem = %Tree.create_item(module_item) + var mod_item: TreeItem = %Tree.create_item(module_item) mod_item.set_icon(0, get_theme_icon("RichTextEffect", "EditorIcons")) mod_item.set_text(0, mod.method.capitalize()) mod_item.set_icon_modulate(0, get_theme_color("property_color_z", "Editor")) @@ -168,7 +168,7 @@ func load_modules_tree() -> void: # Settings for settings in i._get_settings_pages(): - var settings_item : TreeItem = %Tree.create_item(module_item) + var settings_item: TreeItem = %Tree.create_item(module_item) settings_item.set_icon(0, get_theme_icon("PluginScript", "EditorIcons")) settings_item.set_text(0, module_item.get_text(0) + " Settings") settings_item.set_icon_modulate(0, get_theme_color("readonly_color", "Editor")) @@ -178,7 +178,7 @@ func load_modules_tree() -> void: # Editors for editor in i._get_editors(): - var editor_item : TreeItem = %Tree.create_item(module_item) + var editor_item: TreeItem = %Tree.create_item(module_item) editor_item.set_icon(0, get_theme_icon("ConfirmationDialog", "EditorIcons")) editor_item.set_text(0, editor.get_file().trim_suffix('.tscn').capitalize()) editor_item.set_icon_modulate(0, get_theme_color("readonly_color", "Editor")) @@ -200,7 +200,7 @@ func _on_tree_button_clicked(item:TreeItem, column:int, id:int, mouse_button_ind 'Event': # Visibility item clicked if id == 0: - var meta :Dictionary= item.get_metadata(0) + var meta: Dictionary= item.get_metadata(0) if meta['hidden']: item.set_button(0, 0, get_theme_icon("GuiVisibilityVisible", "EditorIcons")) item.get_parent().set_button_color(0, item.get_index(), item.get_icon_modulate(0)) @@ -208,7 +208,7 @@ func _on_tree_button_clicked(item:TreeItem, column:int, id:int, mouse_button_ind %VisibilityToggle.button_pressed = true else: item.set_button(0, 0, get_theme_icon("GuiVisibilityHidden", "EditorIcons")) - var color : Color = item.get_icon_modulate(0) + var color: Color = item.get_icon_modulate(0) color.a = 0.5 item.get_parent().set_button_color(0, item.get_index(), color) if item == %Tree.get_selected(): @@ -219,9 +219,9 @@ func _on_tree_button_clicked(item:TreeItem, column:int, id:int, mouse_button_ind func _on_tree_item_selected() -> void: - var selected_item :TreeItem = %Tree.get_selected() + var selected_item: TreeItem = %Tree.get_selected() - var metadata :Variant = selected_item.get_metadata(0) + var metadata: Variant = selected_item.get_metadata(0) %Title.text = selected_item.get_text(0) %EventDefaultsPanel.hide() @@ -279,7 +279,7 @@ func _on_external_link_pressed() -> void: func change_event_visibility(event:DialogicEvent, visibility:bool) -> void: if event: - var list :Array= DialogicUtil.get_editor_setting('hidden_event_buttons', []) + var list: Array= DialogicUtil.get_editor_setting('hidden_event_buttons', []) if visibility: list.erase(event.event_name) else: @@ -298,7 +298,7 @@ func _on_visibility_toggle_toggled(button_pressed:bool) -> void: else: %VisibilityToggle.icon = get_theme_icon("GuiVisibilityHidden", "EditorIcons") %Tree.get_selected().set_button(0, 0, get_theme_icon("GuiVisibilityHidden", "EditorIcons")) - var color : Color = %Tree.get_selected().get_icon_modulate(0) + var color: Color = %Tree.get_selected().get_icon_modulate(0) color.a = 0.5 %Tree.get_selected().get_parent().set_button_color(0, %Tree.get_selected().get_index(), color) @@ -314,7 +314,7 @@ func load_event_settings(event:DialogicEvent) -> void: for child in %EventDefaults.get_children(): child.queue_free() - var event_default_overrides :Dictionary = ProjectSettings.get_setting('dialogic/event_default_overrides', {}) + var event_default_overrides: Dictionary = ProjectSettings.get_setting('dialogic/event_default_overrides', {}) var params := event.get_shortcode_parameters() for prop in params: @@ -324,8 +324,8 @@ func load_event_settings(event:DialogicEvent) -> void: %EventDefaults.add_child(label) # Editing field - var editor_node :Node = null - var current_value :Variant = params[prop].default + var editor_node: Node = null + var current_value: Variant = params[prop].default if event_default_overrides.get(event.event_name, {}).has(params[prop].property): current_value = event_default_overrides.get(event.event_name, {}).get(params[prop].property) @@ -376,8 +376,8 @@ func load_event_settings(event:DialogicEvent) -> void: func set_event_default_override(prop:String, value:Variant) -> void: - var event_default_overrides :Dictionary = ProjectSettings.get_setting('dialogic/event_default_overrides', {}) - var event :DialogicEvent = %Tree.get_selected().get_metadata(0).event + var event_default_overrides: Dictionary = ProjectSettings.get_setting('dialogic/event_default_overrides', {}) + var event: DialogicEvent = %Tree.get_selected().get_metadata(0).event if not event_default_overrides.has(event.event_name): event_default_overrides[event.event_name] = {} diff --git a/addons/dialogic/Editor/Settings/settings_translation.gd b/addons/dialogic/Editor/Settings/settings_translation.gd index 59419f0bc..fe0714edd 100644 --- a/addons/dialogic/Editor/Settings/settings_translation.gd +++ b/addons/dialogic/Editor/Settings/settings_translation.gd @@ -8,7 +8,7 @@ enum TranslationModes {PER_PROJECT, PER_TIMELINE, NONE} enum SaveLocationModes {INSIDE_TRANSLATION_FOLDER, NEXT_TO_TIMELINE, NONE} var loading := false -@onready var settings_editor :Control = find_parent('Settings') +@onready var settings_editor: Control = find_parent('Settings') ## The default CSV filename that contains the translations for character ## properties. diff --git a/addons/dialogic/Editor/TimelineEditor/TextEditor/CodeCompletionHelper.gd b/addons/dialogic/Editor/TimelineEditor/TextEditor/CodeCompletionHelper.gd index 697e807d5..a23382bd3 100644 --- a/addons/dialogic/Editor/TimelineEditor/TextEditor/CodeCompletionHelper.gd +++ b/addons/dialogic/Editor/TimelineEditor/TextEditor/CodeCompletionHelper.gd @@ -21,7 +21,7 @@ var completion_shortcode_value_regex := RegEx.new() # Stores references to all shortcode events for parameter and value suggestions var shortcode_events := {} var custom_syntax_events := [] -var text_event :DialogicTextEvent = null +var text_event: DialogicTextEvent = null func _ready() -> void: # Compile RegEx's @@ -187,7 +187,7 @@ func request_code_completion(force:bool, text:CodeEdit, mode:=Modes.FULL_HIGHLIG # Helper that adds all characters as options func suggest_characters(text:CodeEdit, type := CodeEdit.KIND_MEMBER, text_event_start:=false) -> void: for character in DialogicResourceUtil.get_character_directory(): - var result :String = character + var result: String = character if " " in character: result = '"'+character+'"' if text_event_start and load(DialogicResourceUtil.get_character_directory()[character]).portraits.is_empty(): diff --git a/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd b/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd index caa2fec8e..1a7d32d04 100644 --- a/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd +++ b/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd @@ -4,7 +4,7 @@ extends CodeEdit ## Sub-Editor that allows editing timelines in a text format. @onready var timeline_editor := get_parent().get_parent() -@onready var code_completion_helper :Node= find_parent('EditorsManager').get_node('CodeCompletionHelper') +@onready var code_completion_helper: Node= find_parent('EditorsManager').get_node('CodeCompletionHelper') var label_regex := RegEx.create_from_string('label +(?[^\n]+)') @@ -61,8 +61,8 @@ func text_timeline_to_array(text:String) -> Array: while idx < len(lines)-1: idx += 1 - var line :String = lines[idx] - var line_stripped :String = line.strip_edges(true, true) + var line: String = lines[idx] + var line_stripped: String = line.strip_edges(true, true) events.append(line) return events @@ -188,7 +188,7 @@ func _on_update_timer_timeout() -> void: func update_content_list() -> void: - var labels :PackedStringArray = [] + var labels: PackedStringArray = [] for i in label_regex.search_all(text): labels.append(i.get_string('name')) timeline_editor.editors_manager.sidebar.update_content_list(labels) diff --git a/addons/dialogic/Editor/TimelineEditor/VisualEditor/AddEventButton.gd b/addons/dialogic/Editor/TimelineEditor/VisualEditor/AddEventButton.gd index 02c0a5086..7318bd4e4 100644 --- a/addons/dialogic/Editor/TimelineEditor/VisualEditor/AddEventButton.gd +++ b/addons/dialogic/Editor/TimelineEditor/VisualEditor/AddEventButton.gd @@ -1,23 +1,23 @@ @tool extends Button -@export var visible_name:String = "" -@export var event_id:String = '' -@export var event_icon:Texture : +@export var visible_name := "" +@export var event_id := "" +@export var event_icon: Texture: get: return event_icon set(texture): event_icon = texture icon = event_icon -@export var event_sorting_index:int = 0 -@export var resource:DialogicEvent -@export var dialogic_color_name:String = '' +@export var event_sorting_index: int = 0 +@export var resource: DialogicEvent +@export var dialogic_color_name := "" func _ready() -> void: tooltip_text = visible_name - custom_minimum_size = Vector2(get_theme_font("font", 'Label').get_string_size(text).x+35,30) * DialogicUtil.get_editor_scale() + custom_minimum_size = Vector2(get_theme_font("font", "Label").get_string_size(text).x+35,30) * DialogicUtil.get_editor_scale() add_theme_color_override("font_color", get_theme_color("font_color", "Editor")) add_theme_color_override("font_color_hover", get_theme_color("accent_color", "Editor")) @@ -25,10 +25,10 @@ func _ready() -> void: func apply_base_button_style() -> void: - var nstyle :StyleBoxFlat= get_parent().get_theme_stylebox('normal', 'Button').duplicate() + var nstyle: StyleBoxFlat = get_parent().get_theme_stylebox('normal', 'Button').duplicate() nstyle.border_width_left = 5 * DialogicUtil.get_editor_scale() add_theme_stylebox_override('normal', nstyle) - var hstyle :StyleBoxFlat= get_parent().get_theme_stylebox('hover', 'Button').duplicate() + var hstyle: StyleBoxFlat = get_parent().get_theme_stylebox('hover', 'Button').duplicate() hstyle.border_width_left = 5 * DialogicUtil.get_editor_scale() add_theme_stylebox_override('hover', hstyle) set_color(resource.event_color) diff --git a/addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd b/addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd index c5bf7239f..0baa46b57 100644 --- a/addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd +++ b/addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd @@ -7,8 +7,8 @@ extends ScrollContainer enum DragTypes {NOTHING, NEW_EVENT, EXISTING_EVENTS} -var drag_type : DragTypes = DragTypes.NOTHING -var drag_data : Variant +var drag_type: DragTypes = DragTypes.NOTHING +var drag_data: Variant var drag_to_position := 0 var dragging := false @@ -82,7 +82,7 @@ func _draw() -> void: ## Draw Event Lines for idx in range($Timeline.get_child_count()): - var block : Control = $Timeline.get_child(idx) + var block: Control = $Timeline.get_child(idx) if not "resource" in block: continue diff --git a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd index 7f3b8e9f9..34eeeabbd 100644 --- a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd +++ b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd @@ -27,7 +27,7 @@ var _initialized := false ################## TIMELINE EVENT MANAGEMENT ################################### ################################################################################ -var selected_items : Array = [] +var selected_items: Array = [] var drag_allowed := false @@ -112,7 +112,7 @@ func batch_events(array: Array, size: int, batch_number: int) -> Array: var opener_events_stack := [] func load_batch(data:Array) -> void: - var current_batch :Array = _batches.pop_front() + var current_batch: Array = _batches.pop_front() if current_batch: for i in current_batch: if i is DialogicEndBranchEvent: @@ -247,7 +247,7 @@ func load_event_buttons() -> void: sections[event_resource.event_category].move_child(button, button.get_index()-1) # Sort event sections - var sections_order :Array= DialogicUtil.get_editor_setting('event_section_order', + var sections_order: Array = DialogicUtil.get_editor_setting('event_section_order', ['Main', 'Flow', 'Logic', 'Audio', 'Visual','Other', 'Helper']) sections_order.reverse() @@ -320,7 +320,7 @@ func _on_event_block_gui_input(event: InputEvent, item: Node) -> void: ## Activated by TimelineArea drag_completed func _on_timeline_area_drag_completed(type:int, index:int, data:Variant) -> void: if type == %TimelineArea.DragTypes.NEW_EVENT: - var resource :DialogicEvent = data.duplicate() + var resource: DialogicEvent = data.duplicate() resource._load_custom_defaults() add_event_undoable(resource, index) @@ -380,7 +380,7 @@ func add_event_node(event_resource:DialogicEvent, at_index:int = -1, auto_select func create_end_branch_event(at_index:int, parent_node:Node) -> Node: - var end_branch_event :Control = load("res://addons/dialogic/Editor/Events/BranchEnd.tscn").instantiate() + var end_branch_event: Control = load("res://addons/dialogic/Editor/Events/BranchEnd.tscn").instantiate() end_branch_event.resource = DialogicEndBranchEvent.new() end_branch_event.gui_input.connect(_on_event_block_gui_input.bind(end_branch_event)) parent_node.end_node = end_branch_event @@ -474,7 +474,7 @@ func add_events_indexed(indexed_events:Dictionary) -> void: # now create the visual block. deselect_all_items() if event_resource is DialogicEndBranchEvent: - var idx :String = indexed_events[event_idx].trim_prefix('<>') + var idx: String = indexed_events[event_idx].trim_prefix('<>') if idx.begins_with('#'): # a global index events.append(create_end_branch_event(%Timeline.get_child_count(), %Timeline.get_child(int(idx.trim_prefix('#'))))) else: # a local index (index in the added events list) @@ -553,7 +553,7 @@ func copy_selected_events() -> void: func get_clipboard_data() -> Array: - var clipboard_parse :Variant= str_to_var(DisplayServer.clipboard_get()) + var clipboard_parse: Variant = str_to_var(DisplayServer.clipboard_get()) if clipboard_parse is Dictionary: if clipboard_parse.has("project_name"): @@ -605,7 +605,7 @@ func select_item(item: Node, multi_possible:bool = true) -> void: if len(selected_items) == 0: selected_items = [item] else: - var index :int= selected_items[-1].get_index() + var index: int = selected_items[-1].get_index() var goal_idx := item.get_index() while true: if index < goal_idx: index += 1 @@ -679,7 +679,7 @@ func _add_event_button_pressed(event_resource:DialogicEvent, force_resource := f else: at_index = %Timeline.get_child_count() - var resource :DialogicEvent = null + var resource: DialogicEvent = null if force_resource: resource = event_resource else: @@ -904,7 +904,7 @@ func indent_events() -> void: ################################################################################ func _on_event_popup_menu_index_pressed(index:int) -> void: - var item :Control = %EventPopupMenu.current_event + var item: Control = %EventPopupMenu.current_event if index == 0: if not item in selected_items: selected_items = [item] @@ -1044,7 +1044,7 @@ func _input(event:InputEvent) -> void: get_viewport().set_input_as_handled() ## Some shortcuts should be disabled when writing text. - var focus_owner : Control = get_viewport().gui_get_focus_owner() + var focus_owner: Control = get_viewport().gui_get_focus_owner() if focus_owner is TextEdit or focus_owner is LineEdit or (focus_owner is Button and focus_owner.get_parent_control().name == "Spin"): return @@ -1141,8 +1141,8 @@ func _input(event:InputEvent) -> void: func get_previous_character(double_previous := false) -> DialogicCharacter: - var character :DialogicCharacter = null - var idx :int = %Timeline.get_child_count() + var character: DialogicCharacter = null + var idx: int = %Timeline.get_child_count() if idx == 0: return null if len(selected_items): diff --git a/addons/dialogic/Editor/TimelineEditor/timeline_editor.gd b/addons/dialogic/Editor/TimelineEditor/timeline_editor.gd index ad6ea6b49..e5302a7ee 100644 --- a/addons/dialogic/Editor/TimelineEditor/timeline_editor.gd +++ b/addons/dialogic/Editor/TimelineEditor/timeline_editor.gd @@ -4,8 +4,11 @@ extends DialogicEditor ## Editor that holds both the visual and the text timeline editors. # references -var current_editor_mode: int = 0 # 0 = visal, 1 = text -var play_timeline_button : Button = null +enum EditorMode {VISUAL, TEXT} + +var current_editor_mode := EditorMode.VISUAL +var play_timeline_button: Button = null + ## Overwrite. Register to the editor manager in here. func _register() -> void: @@ -39,11 +42,11 @@ func _register() -> void: current_editor_mode = DialogicUtil.get_editor_setting('timeline_editor_mode', 0) match current_editor_mode: - 0: + EditorMode.VISUAL: %VisualEditor.show() %TextEditor.hide() %SwitchEditorMode.text = "Text Editor" - 1: + EditorMode.TEXT: %VisualEditor.hide() %TextEditor.show() %SwitchEditorMode.text = "Visual Editor" @@ -65,9 +68,9 @@ func _open_resource(resource:Resource) -> void: current_resource = resource current_resource_state = ResourceStates.SAVED match current_editor_mode: - 0: + EditorMode.VISUAL: %VisualEditor.load_timeline(current_resource) - 1: + EditorMode.TEXT: %TextEditor.load_timeline(current_resource) $NoTimelineScreen.hide() %TimelineName.text = DialogicResourceUtil.get_unique_identifier(current_resource.resource_path) @@ -77,9 +80,9 @@ func _open_resource(resource:Resource) -> void: ## If this editor supports editing resources, save them here (overwrite in subclass) func _save() -> void: match current_editor_mode: - 0: + EditorMode.VISUAL: %VisualEditor.save_timeline() - 1: + EditorMode.TEXT: %TextEditor.save_timeline() @@ -102,7 +105,7 @@ func _input(event: InputEvent) -> void: func play_timeline() -> void: _save() - var dialogic_plugin = DialogicUtil.get_dialogic_plugin() + var dialogic_plugin := DialogicUtil.get_dialogic_plugin() # Save the current opened timeline DialogicUtil.set_editor_setting('current_timeline_path', current_resource.resource_path) @@ -113,15 +116,15 @@ func play_timeline() -> void: ## Method to switch from visual to text editor (and vice versa). Connected to the button in the sidebar. func toggle_editor_mode() -> void: match current_editor_mode: - 0: - current_editor_mode = 1 + EditorMode.VISUAL: + current_editor_mode = EditorMode.TEXT %VisualEditor.save_timeline() %VisualEditor.hide() %TextEditor.show() %TextEditor.load_timeline(current_resource) %SwitchEditorMode.text = "Visual Editor" - 1: - current_editor_mode = 0 + EditorMode.TEXT: + current_editor_mode = EditorMode.VISUAL %TextEditor.save_timeline() %TextEditor.hide() %VisualEditor.load_timeline(current_resource) @@ -179,9 +182,9 @@ func _clear() -> void: current_resource = null current_resource_state = ResourceStates.SAVED match current_editor_mode: - 0: + EditorMode.VISUAL: %VisualEditor.clear_timeline_nodes() - 1: + EditorMode.TEXT: %TextEditor.clear_timeline() $NoTimelineScreen.show() play_timeline_button.disabled = true diff --git a/addons/dialogic/Editor/editors_manager.gd b/addons/dialogic/Editor/editors_manager.gd index 2bd4ed268..5e8dd3e31 100644 --- a/addons/dialogic/Editor/editors_manager.gd +++ b/addons/dialogic/Editor/editors_manager.gd @@ -7,11 +7,11 @@ signal resource_opened(resource) signal editor_changed(previous, current) ### References -@onready var hsplit = $HSplit -@onready var sidebar = $HSplit/Sidebar -@onready var editors_holder = $HSplit/VBox/Editors -@onready var toolbar = $HSplit/VBox/Toolbar -@onready var tabbar = $HSplit/VBox/Toolbar/EditorTabBar +@onready var hsplit := $HSplit +@onready var sidebar := $HSplit/Sidebar +@onready var editors_holder := $HSplit/VBox/Editors +@onready var toolbar := $HSplit/VBox/Toolbar +@onready var tabbar := $HSplit/VBox/Toolbar/EditorTabBar var reference_manager: Node: get: @@ -22,7 +22,7 @@ var current_editor: DialogicEditor = null var previous_editor: DialogicEditor = null var editors := {} var supported_file_extensions := [] -var used_resources_cache : Array = [] +var used_resources_cache: Array = [] ################################################################################ @@ -169,7 +169,7 @@ func open_editor(editor:DialogicEditor, save_previous: bool = true, extra_info:V tabbar.current_tab = editor.get_index() if editor.current_resource: - var text:String = editor.current_resource.resource_path.get_file() + var text: String = editor.current_resource.resource_path.get_file() if editor.current_resource_state == DialogicEditor.ResourceStates.UNSAVED: text += "(*)" @@ -201,7 +201,7 @@ func show_add_resource_dialog(accept_callable:Callable, filter:String = "*", tit func _on_add_resource_dialog_accepted(path:String, callable:Callable) -> void: - var file_name :String= path.get_file().trim_suffix('.'+path.get_extension()) + var file_name: String = path.get_file().trim_suffix('.'+path.get_extension()) for i in ['#','&','+',';','(',')','!','*','*','"',"'",'%', '$', ':','.',',']: file_name = file_name.replace(i, '') callable.call(path.trim_suffix(path.get_file()).path_join(file_name)+'.'+path.get_extension()) diff --git a/addons/dialogic/Example Assets/default_event.gd b/addons/dialogic/Example Assets/default_event.gd index a2cfa1ed0..6ffbc7145 100644 --- a/addons/dialogic/Example Assets/default_event.gd +++ b/addons/dialogic/Example Assets/default_event.gd @@ -2,7 +2,7 @@ extends DialogicEvent # DEFINE ALL PROPERTIES OF THE EVENT -# var MySetting :String = "" +# var MySetting: String = "" func _execute() -> void: # I have no idea how this event works ;) diff --git a/addons/dialogic/Example Assets/portraits/CustomPortrait_FaceAtlas.gd b/addons/dialogic/Example Assets/portraits/CustomPortrait_FaceAtlas.gd index acb600aa6..7b1b74a8b 100644 --- a/addons/dialogic/Example Assets/portraits/CustomPortrait_FaceAtlas.gd +++ b/addons/dialogic/Example Assets/portraits/CustomPortrait_FaceAtlas.gd @@ -3,7 +3,7 @@ extends DialogicPortrait enum Faces {BASED_ON_PORTRAIT_NAME, NEUTRAL, HAPPY, SAD, JOY, SHOCK, ANGRY} -@export var emotion : Faces = Faces.BASED_ON_PORTRAIT_NAME +@export var emotion: Faces = Faces.BASED_ON_PORTRAIT_NAME @export var portrait_width: int @export var portrait_height: int @export var alien := true diff --git a/addons/dialogic/Modules/Audio/event_music.gd b/addons/dialogic/Modules/Audio/event_music.gd index 4f4b5708e..c54c5bd9d 100644 --- a/addons/dialogic/Modules/Audio/event_music.gd +++ b/addons/dialogic/Modules/Audio/event_music.gd @@ -8,15 +8,15 @@ extends DialogicEvent ### Settings ## The file to play. If empty, the previous music will be faded out. -var file_path: String = "" +var file_path := "" ## The length of the fade. If 0 (by default) it's an instant change. var fade_length: float = 0 ## The volume the music will be played at. var volume: float = 0 ## The audio bus the music will be played at. -var audio_bus: String = "" +var audio_bus := "" ## If true, the audio will loop, otherwise only play once. -var loop: bool = true +var loop := true ################################################################################ diff --git a/addons/dialogic/Modules/Audio/event_sound.gd b/addons/dialogic/Modules/Audio/event_sound.gd index 389e4115b..844006177 100644 --- a/addons/dialogic/Modules/Audio/event_sound.gd +++ b/addons/dialogic/Modules/Audio/event_sound.gd @@ -8,13 +8,13 @@ extends DialogicEvent ### Settings ## The path to the file to play. -var file_path: String = "" +var file_path := "" ## The volume to play the sound at. var volume: float = 0 ## The bus to play the sound on. -var audio_bus: String = "" +var audio_bus := "" ## If true, the sound will loop infinitely. Not recommended (as there is no way to stop it). -var loop: bool = false +var loop := false ################################################################################ diff --git a/addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd b/addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd index deedc6ae9..ef3c57058 100644 --- a/addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd +++ b/addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd @@ -3,8 +3,8 @@ extends DialogicBackground ## The default background scene. ## Extend the DialogicBackground class to create your own background scene. -@onready var image_node = $Image -@onready var color_node = $ColorRect +@onready var image_node: TextureRect = $Image +@onready var color_node: ColorRect = $ColorRect func _ready() -> void: diff --git a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_diagonal_up_left.gd b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_diagonal_up_left.gd index 787ed404f..061f943c7 100644 --- a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_diagonal_up_left.gd +++ b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_diagonal_up_left.gd @@ -2,7 +2,7 @@ extends "res://addons/dialogic/Modules/Background/Transitions/simple_swipe_trans func _fade() -> void: var shader := setup_swipe_shader() - var texture :GradientTexture2D = shader.get_shader_parameter('wipe_texture') + var texture: GradientTexture2D = shader.get_shader_parameter('wipe_texture') texture.fill_from = Vector2.DOWN texture.fill_to = Vector2.RIGHT tween_shader_progress() diff --git a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_left_to_right.gd b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_left_to_right.gd index 32084e92e..8b55d4147 100644 --- a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_left_to_right.gd +++ b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_left_to_right.gd @@ -2,7 +2,7 @@ extends "res://addons/dialogic/Modules/Background/Transitions/simple_swipe_trans func _fade() -> void: var shader := setup_swipe_shader() - var texture :GradientTexture2D = shader.get_shader_parameter('wipe_texture') + var texture: GradientTexture2D = shader.get_shader_parameter('wipe_texture') texture.fill_from = Vector2.ZERO texture.fill_to = Vector2.RIGHT diff --git a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_right_to_left.gd b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_right_to_left.gd index 14005d9aa..5433d595b 100644 --- a/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_right_to_left.gd +++ b/addons/dialogic/Modules/Background/Transitions/Defaults/swipe_right_to_left.gd @@ -2,7 +2,7 @@ extends "res://addons/dialogic/Modules/Background/Transitions/simple_swipe_trans func _fade() -> void: var shader := setup_swipe_shader() - var texture :GradientTexture2D = shader.get_shader_parameter('wipe_texture') + var texture: GradientTexture2D = shader.get_shader_parameter('wipe_texture') texture.fill_from = Vector2.RIGHT texture.fill_to = Vector2.ZERO tween_shader_progress() diff --git a/addons/dialogic/Modules/Background/Transitions/class_dialogic_background_transition.gd b/addons/dialogic/Modules/Background/Transitions/class_dialogic_background_transition.gd index 620571111..3f4f1f015 100644 --- a/addons/dialogic/Modules/Background/Transitions/class_dialogic_background_transition.gd +++ b/addons/dialogic/Modules/Background/Transitions/class_dialogic_background_transition.gd @@ -2,7 +2,7 @@ class_name DialogicBackgroundTransition extends Node ## Helper -var this_folder : String = get_script().resource_path.get_base_dir() +var this_folder: String = get_script().resource_path.get_base_dir() ## Set before _fade() is called, will be the root node of the previous bg scene. diff --git a/addons/dialogic/Modules/Background/event_background.gd b/addons/dialogic/Modules/Background/event_background.gd index ca1a3a56b..0380e6981 100644 --- a/addons/dialogic/Modules/Background/event_background.gd +++ b/addons/dialogic/Modules/Background/event_background.gd @@ -10,14 +10,14 @@ extends DialogicEvent ## This scene supports images and fading. ## If you set it to a scene path, then that scene will be instanced. ## Learn more about custom backgrounds in the Subsystem_Background.gd docs. -var scene: String = "" +var scene := "" ## The argument that is passed to the background scene. ## For the default scene it's the path to the image to show. -var argument: String = "" +var argument := "" ## The time the fade animation will take. Leave at 0 for instant change. var fade: float = 0.0 ## Name of the transition to use. -var transition: String = "" +var transition := "" ## Helpers for visual editor enum ArgumentTypes {IMAGE, CUSTOM} diff --git a/addons/dialogic/Modules/Call/event_call.gd b/addons/dialogic/Modules/Call/event_call.gd index 635c85626..71643b2bb 100644 --- a/addons/dialogic/Modules/Call/event_call.gd +++ b/addons/dialogic/Modules/Call/event_call.gd @@ -7,16 +7,16 @@ extends DialogicEvent ### Settings ## The name of the autoload to call the method on. -var autoload_name: String = "" +var autoload_name := "" ## The name of the method to call on the given autoload. -var method: String = "": +var method := "": set(value): method = value if Engine.is_editor_hint(): update_argument_info() check_arguments_and_update_warning() ## A list of arguments to give to the call. -var arguments: Array = []: +var arguments := []: set(value): arguments = value if Engine.is_editor_hint(): @@ -193,7 +193,7 @@ func update_argument_info() -> void: if !ResourceLoader.exists(ProjectSettings.get_setting('autoload/'+autoload_name, '').trim_prefix('*')): _current_method_arg_hints = {} return - var script :Script = load(ProjectSettings.get_setting('autoload/'+autoload_name, '').trim_prefix('*')) + var script: Script = load(ProjectSettings.get_setting('autoload/'+autoload_name, '').trim_prefix('*')) for m in script.get_script_method_list(): if m.name == method: _current_method_arg_hints = {'a':autoload_name, 'm':method, 'info':m} @@ -214,7 +214,7 @@ func check_arguments_and_update_warning() -> void: if _current_method_arg_hints.info.args[idx].type != typeof(arg): if arg is String and arg.begins_with('@'): continue - var expected_type :String = "" + var expected_type: String = "" match _current_method_arg_hints.info.args[idx].type: TYPE_BOOL: expected_type = "bool" TYPE_STRING: expected_type = "string" diff --git a/addons/dialogic/Modules/Character/DefaultAnimations/shake_y.gd b/addons/dialogic/Modules/Character/DefaultAnimations/shake_y.gd index 2b6ee2043..870f42faa 100644 --- a/addons/dialogic/Modules/Character/DefaultAnimations/shake_y.gd +++ b/addons/dialogic/Modules/Character/DefaultAnimations/shake_y.gd @@ -4,7 +4,7 @@ func animate() -> void: var tween := (node.create_tween() as Tween) tween.set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE) - var strength :float = node.get_viewport().size.y/40 + var strength: float = node.get_viewport().size.y/40 tween.tween_property(node, 'position:y', orig_pos.y+strength, time*0.2) tween.tween_property(node, 'position:y', orig_pos.y-strength, time*0.1) tween.tween_property(node, 'position:y', orig_pos.y+strength, time*0.1) @@ -16,6 +16,7 @@ func animate() -> void: tween.finished.connect(emit_signal.bind('finished_once')) + func _get_named_variations() -> Dictionary: return { "shake y": {"type": AnimationType.ACTION}, diff --git a/addons/dialogic/Modules/Character/DefaultAnimations/tada.gd b/addons/dialogic/Modules/Character/DefaultAnimations/tada.gd index 93ce8ca65..0d578b186 100644 --- a/addons/dialogic/Modules/Character/DefaultAnimations/tada.gd +++ b/addons/dialogic/Modules/Character/DefaultAnimations/tada.gd @@ -4,7 +4,7 @@ func animate() -> void: var tween := (node.create_tween() as Tween) tween.set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT) - var strength :float = 0.01 + var strength: float = 0.01 tween.set_parallel(true) tween.tween_property(node, 'scale', Vector2(1,1)*(1+strength), time*0.3) @@ -18,6 +18,7 @@ func animate() -> void: tween.finished.connect(emit_signal.bind('finished_once')) + func _get_named_variations() -> Dictionary: return { "tada": {"type": AnimationType.ACTION}, diff --git a/addons/dialogic/Modules/Character/default_portrait.gd b/addons/dialogic/Modules/Character/default_portrait.gd index 25edb32e5..dcd89b01e 100644 --- a/addons/dialogic/Modules/Character/default_portrait.gd +++ b/addons/dialogic/Modules/Character/default_portrait.gd @@ -5,7 +5,7 @@ extends DialogicPortrait ## The parent class has a character and portrait variable. @export_group('Main') -@export_file var image : String = "" +@export_file var image := "" ## Load anything related to the given character and portrait diff --git a/addons/dialogic/Modules/Character/event_character.gd b/addons/dialogic/Modules/Character/event_character.gd index 6230b2136..51f3254b1 100644 --- a/addons/dialogic/Modules/Character/event_character.gd +++ b/addons/dialogic/Modules/Character/event_character.gd @@ -8,20 +8,20 @@ enum Actions {JOIN, LEAVE, UPDATE} ### Settings ## The type of action of this event (JOIN/LEAVE/UPDATE). See [Actions]. -var action : int = Actions.JOIN +var action := Actions.JOIN ## The character that will join/leave/update. -var character : DialogicCharacter = null +var character: DialogicCharacter = null ## For Join/Update, this will be the portrait of the character that is shown. ## Not used on Leave. ## If empty, the default portrait will be used. -var portrait: String = "" +var portrait := "" ## The index of the position this character should move to -var transform: String = "center" +var transform := "center" ## Name of the animation script (extending DialogicAnimation). ## On Join/Leave empty (default) will fallback to the animations set in the settings. ## On Update empty will mean no animation. -var animation_name: String = "" +var animation_name := "" ## Length of the animation. var animation_length: float = 0.5 ## How often the animation is repeated. Only for Update events. @@ -64,9 +64,9 @@ var trans_options := [ ## The z_index that the portrait should have. var z_index: int = 0 ## If true, the portrait will be set to mirrored. -var mirrored: bool = false +var mirrored := false ## If set, will be passed to the portrait scene. -var extra_data: String = "" +var extra_data := "" ### Helpers diff --git a/addons/dialogic/Modules/Character/event_position.gd b/addons/dialogic/Modules/Character/event_position.gd index e8b7e0a30..e5ae6db53 100644 --- a/addons/dialogic/Modules/Character/event_position.gd +++ b/addons/dialogic/Modules/Character/event_position.gd @@ -13,7 +13,7 @@ enum Actions {CHANGE, RESET, RESET_ALL} ## The type of action: SetRelative, SetAbsolute, Reset, ResetAll var action := Actions.CHANGE ## The position that should be affected -var position: String = "center" +var position := "center" var relative_change := false @@ -30,7 +30,7 @@ var set_rotation := false # auto-set var rect_size := "" var set_rect_size := false # auto-set -var scale: Vector2 = Vector2() +var scale := Vector2() var set_scale := false # auto-set ## The time the tweening will take. diff --git a/addons/dialogic/Modules/Character/node_portrait_container.gd b/addons/dialogic/Modules/Character/node_portrait_container.gd index 21f8ed76d..abe2679ec 100644 --- a/addons/dialogic/Modules/Character/node_portrait_container.gd +++ b/addons/dialogic/Modules/Character/node_portrait_container.gd @@ -63,7 +63,7 @@ enum PivotModes {AT_ORIGIN, PERCENTAGE, PIXELS} set(character): debug_character = character _update_debug_portrait_scene() -@export var debug_character_portrait: String = "": +@export var debug_character_portrait := "": set(portrait): debug_character_portrait = portrait _update_debug_portrait_scene() @@ -187,8 +187,8 @@ func _update_debug_portrait_scene() -> void: if mode == PositionModes.SPEAKER and !portrait_prefix.is_empty(): if portrait_prefix+debug_portrait in character.portraits: debug_portrait = portrait_prefix+debug_portrait - var portrait_info :Dictionary = character.get_portrait_info(debug_portrait) - var portrait_scene_path :String = portrait_info.get('scene', default_portrait_scene) + var portrait_info: Dictionary = character.get_portrait_info(debug_portrait) + var portrait_scene_path: String = portrait_info.get('scene', default_portrait_scene) if portrait_scene_path.is_empty(): portrait_scene_path = default_portrait_scene debug_character_scene_node = load(portrait_scene_path).instantiate() if !is_instance_valid(debug_character_scene_node): diff --git a/addons/dialogic/Modules/Choice/event_choice.gd b/addons/dialogic/Modules/Choice/event_choice.gd index a264f643b..59ce99037 100644 --- a/addons/dialogic/Modules/Choice/event_choice.gd +++ b/addons/dialogic/Modules/Choice/event_choice.gd @@ -13,7 +13,7 @@ var text := "" ## If not empty this condition will determine if this choice is active. var condition := "" ## Determines what happens if [condition] is false. Default will use the action set in the settings. -var else_action: = ElseActions.DEFAULT +var else_action := ElseActions.DEFAULT ## The text that is displayed if [condition] is false and [else_action] is Disable. ## If empty [text] will be used for disabled button as well. var disabled_text := "" diff --git a/addons/dialogic/Modules/Choice/node_button_sound.gd b/addons/dialogic/Modules/Choice/node_button_sound.gd index ccbff4a2f..3f6cdbefd 100644 --- a/addons/dialogic/Modules/Choice/node_button_sound.gd +++ b/addons/dialogic/Modules/Choice/node_button_sound.gd @@ -3,13 +3,13 @@ extends AudioStreamPlayer ## Node that is used for playing sound effects on hover/focus/press of sibling DialogicNode_ChoiceButtons. -## Sound to be played if one of the sibling ChoiceButtons is pressed. +## Sound to be played if one of the sibling ChoiceButtons is pressed. ## If sibling ChoiceButton has a sound_pressed set, that is prioritized. -@export var sound_pressed:AudioStream +@export var sound_pressed: AudioStream ## Sound to be played on hover. See [sound_pressed] for more. -@export var sound_hover:AudioStream +@export var sound_hover: AudioStream ## Sound to be played on focus. See [sound_pressed] for more. -@export var sound_focus:AudioStream +@export var sound_focus: AudioStream func _ready() -> void: add_to_group('dialogic_button_sound') diff --git a/addons/dialogic/Modules/Choice/settings_choices.gd b/addons/dialogic/Modules/Choice/settings_choices.gd index cfd736d8b..66e4482a4 100644 --- a/addons/dialogic/Modules/Choice/settings_choices.gd +++ b/addons/dialogic/Modules/Choice/settings_choices.gd @@ -7,8 +7,8 @@ func _refresh() -> void: %FalseBehaviour.select(ProjectSettings.get_setting('dialogic/choices/def_false_behaviour', 0)) %HotkeyType.select(ProjectSettings.get_setting('dialogic/choices/hotkey_behaviour', 0)) - var reveal_delay :float = ProjectSettings.get_setting('dialogic/choices/reveal_delay', 0) - var reveal_by_input :bool = ProjectSettings.get_setting('dialogic/choices/reveal_by_input', false) + var reveal_delay: float = ProjectSettings.get_setting('dialogic/choices/reveal_delay', 0) + var reveal_by_input: bool = ProjectSettings.get_setting('dialogic/choices/reveal_by_input', false) if not reveal_by_input and reveal_delay == 0: _on_appear_mode_item_selected(0) if not reveal_by_input and reveal_delay != 0: diff --git a/addons/dialogic/Modules/Choice/subsystem_choices.gd b/addons/dialogic/Modules/Choice/subsystem_choices.gd index 2f6ca78f7..8f0567fb8 100644 --- a/addons/dialogic/Modules/Choice/subsystem_choices.gd +++ b/addons/dialogic/Modules/Choice/subsystem_choices.gd @@ -12,13 +12,13 @@ signal choices_shown(info:Dictionary) var last_question_info := {} ## The delay between the text finishing revealing and the choices appearing -var reveal_delay: float = 0.0 +var reveal_delay := 0.0 ## If true the player has to click to reveal choices when they are reached -var reveal_by_input: bool = false +var reveal_by_input := false ## The delay between the choices becoming visible and being clickable. Can prevent accidental selection. -var block_delay: float = 0.2 +var block_delay := 0.2 ## If true, the first (top-most) choice will be focused -var autofocus_first_choice: bool = true +var autofocus_first_choice := true enum FalseBehaviour {HIDE=0, DISABLE=1} diff --git a/addons/dialogic/Modules/Choice/ui_choice_end.gd b/addons/dialogic/Modules/Choice/ui_choice_end.gd index f6e483733..acc5d827b 100644 --- a/addons/dialogic/Modules/Choice/ui_choice_end.gd +++ b/addons/dialogic/Modules/Choice/ui_choice_end.gd @@ -17,9 +17,9 @@ func refresh() -> void: func _on_add_choice_pressed() -> void: - var timeline = find_parent('VisualEditor') + var timeline := find_parent('VisualEditor') if timeline: - var resource = DialogicChoiceEvent.new() + var resource := DialogicChoiceEvent.new() resource.created_by_button = true timeline.add_event_undoable(resource, get_parent().get_index()+1) timeline.indent_events() diff --git a/addons/dialogic/Modules/Comment/event_comment.gd b/addons/dialogic/Modules/Comment/event_comment.gd index cbc25b822..ad0b1dd2b 100644 --- a/addons/dialogic/Modules/Comment/event_comment.gd +++ b/addons/dialogic/Modules/Comment/event_comment.gd @@ -8,7 +8,7 @@ extends DialogicEvent ### Settings ## Content of the comment. -var text :String = "" +var text := "" ################################################################################ @@ -36,8 +36,7 @@ func _init() -> void: ################################################################################ func to_text() -> String: - var result_string = "# "+text - return result_string + return "# "+text func from_text(string:String) -> void: diff --git a/addons/dialogic/Modules/Condition/event_condition.gd b/addons/dialogic/Modules/Condition/event_condition.gd index 3a21b8bf0..0f8bed887 100644 --- a/addons/dialogic/Modules/Condition/event_condition.gd +++ b/addons/dialogic/Modules/Condition/event_condition.gd @@ -10,7 +10,7 @@ enum ConditionTypes {IF, ELIF, ELSE} ## condition type (see [ConditionTypes]). Defaults to if. var condition_type := ConditionTypes.IF ## The condition as a string. Will be executed as an Expression. -var condition: String = "" +var condition := "" ################################################################################ @@ -26,7 +26,7 @@ func _execute() -> void: var result :bool= dialogic.Expressions.execute_condition(condition) if not result: - var idx :int= dialogic.current_event_idx + var idx :int = dialogic.current_event_idx var ignore := 1 while true: idx += 1 diff --git a/addons/dialogic/Modules/Condition/ui_condition_end.gd b/addons/dialogic/Modules/Condition/ui_condition_end.gd index b5200ce35..4a5ac1d0e 100644 --- a/addons/dialogic/Modules/Condition/ui_condition_end.gd +++ b/addons/dialogic/Modules/Condition/ui_condition_end.gd @@ -1,12 +1,14 @@ @tool extends HBoxContainer -var parent_resource = null +var parent_resource: DialogicEvent = null + func _ready() -> void: $AddElif.button_up.connect(add_elif) $AddElse.button_up.connect(add_else) + func refresh() -> void: if parent_resource is DialogicConditionEvent: # hide add elif and add else button on ELSE event @@ -15,9 +17,9 @@ func refresh() -> void: $Label.text = "End of "+["IF", "ELIF", "ELSE"][parent_resource.condition_type]+" ("+parent_resource.condition+")" # hide add add else button if followed by ELIF or ELSE event - var timeline_editor = find_parent('VisualEditor') + var timeline_editor := find_parent('VisualEditor') if timeline_editor: - var next_event = null + var next_event: DialogicEvent = null if timeline_editor.get_block_below(get_parent()): next_event = timeline_editor.get_block_below(get_parent()).resource if next_event is DialogicConditionEvent: @@ -28,19 +30,21 @@ func refresh() -> void: else: hide() + func add_elif() -> void: - var timeline = find_parent('VisualEditor') + var timeline := find_parent('VisualEditor') if timeline: - var resource = DialogicConditionEvent.new() + var resource := DialogicConditionEvent.new() resource.condition_type = DialogicConditionEvent.ConditionTypes.ELIF timeline.add_event_undoable(resource, get_parent().get_index()+1) timeline.indent_events() timeline.something_changed() + func add_else() -> void: - var timeline = find_parent('VisualEditor') + var timeline := find_parent('VisualEditor') if timeline: - var resource = DialogicConditionEvent.new() + var resource := DialogicConditionEvent.new() resource.condition_type = DialogicConditionEvent.ConditionTypes.ELSE timeline.add_event_undoable(resource, get_parent().get_index()+1) timeline.indent_events() diff --git a/addons/dialogic/Modules/Core/subsystem_input.gd b/addons/dialogic/Modules/Core/subsystem_input.gd index acb3aca81..939fd9fc9 100644 --- a/addons/dialogic/Modules/Core/subsystem_input.gd +++ b/addons/dialogic/Modules/Core/subsystem_input.gd @@ -20,7 +20,7 @@ var _auto_skip_timer_left: float = 0.0 var action_was_consumed := false var auto_skip: DialogicAutoSkip = null -var auto_advance : DialogicAutoAdvance = null +var auto_advance: DialogicAutoAdvance = null var manual_advance: DialogicManualAdvance = null diff --git a/addons/dialogic/Modules/DefaultLayoutParts/Base_TextBubble/text_bubble_base.gd b/addons/dialogic/Modules/DefaultLayoutParts/Base_TextBubble/text_bubble_base.gd index 6f18a3156..15f4b45c1 100644 --- a/addons/dialogic/Modules/DefaultLayoutParts/Base_TextBubble/text_bubble_base.gd +++ b/addons/dialogic/Modules/DefaultLayoutParts/Base_TextBubble/text_bubble_base.gd @@ -7,7 +7,7 @@ var bubbles: Array = [] var registered_characters: Dictionary = {} @export_group("Main") -@export_range(1, 25, 1) var bubble_count : int = 2 +@export_range(1, 25, 1) var bubble_count: int = 2 func _ready() -> void: diff --git a/addons/dialogic/Modules/DefaultLayoutParts/Layer_History/example_history_item.gd b/addons/dialogic/Modules/DefaultLayoutParts/Layer_History/example_history_item.gd index d52a25951..83fef5013 100644 --- a/addons/dialogic/Modules/DefaultLayoutParts/Layer_History/example_history_item.gd +++ b/addons/dialogic/Modules/DefaultLayoutParts/Layer_History/example_history_item.gd @@ -14,7 +14,7 @@ func get_icon() -> TextureRect: func load_info(text:String, character:String = "", character_color: Color =Color(), icon:Texture= null) -> void: get_text_box().text = text - var name_label : Label = get_name_label() + var name_label: Label = get_name_label() if character: name_label.text = character name_label.add_theme_color_override('font_color', character_color) @@ -22,9 +22,9 @@ func load_info(text:String, character:String = "", character_color: Color =Color else: name_label.hide() - var icon_node : TextureRect = get_icon() + var icon_node: TextureRect = get_icon() if icon == null: icon_node.hide() else: icon_node.show() - icon_node.texture = icon \ No newline at end of file + icon_node.texture = icon diff --git a/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/autoadvance_indicator.gd b/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/autoadvance_indicator.gd index fa8bbffcb..a4384bd60 100644 --- a/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/autoadvance_indicator.gd +++ b/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/autoadvance_indicator.gd @@ -1,6 +1,6 @@ extends Range -var enabled : bool = true +var enabled: bool = true func _process(_delta : float) -> void: if !enabled: diff --git a/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.gd b/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.gd index 7bbe6ce9e..95a4ce3cb 100644 --- a/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.gd +++ b/addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.gd @@ -38,10 +38,10 @@ enum AnimationsNewText {NONE, WIGGLE} @export_subgroup('Font') @export var text_use_global_font: bool = true -@export_file('*.ttf', '*.tres') var normal_font:String = "" -@export_file('*.ttf', '*.tres') var bold_font:String = "" -@export_file('*.ttf', '*.tres') var italics_font:String = "" -@export_file('*.ttf', '*.tres') var bold_italics_font:String = "" +@export_file('*.ttf', '*.tres') var normal_font: String = "" +@export_file('*.ttf', '*.tres') var bold_font: String = "" +@export_file('*.ttf', '*.tres') var italics_font: String = "" +@export_file('*.ttf', '*.tres') var bold_italics_font: String = "" @export_group("Box") diff --git a/addons/dialogic/Modules/Glossary/glossary_editor.gd b/addons/dialogic/Modules/Glossary/glossary_editor.gd index 2e8014ef2..403ed6d72 100644 --- a/addons/dialogic/Modules/Glossary/glossary_editor.gd +++ b/addons/dialogic/Modules/Glossary/glossary_editor.gd @@ -144,7 +144,7 @@ func _on_load_glossary_file_pressed() -> void: func load_glossary_file(path:String) -> void: - var list :Array= ProjectSettings.get_setting('dialogic/glossary/glossary_files', []) + var list: Array = ProjectSettings.get_setting('dialogic/glossary/glossary_files', []) if not path in list: list.append(path) diff --git a/addons/dialogic/Modules/Glossary/glossary_resource.gd b/addons/dialogic/Modules/Glossary/glossary_resource.gd index edc1fcc55..638d03697 100644 --- a/addons/dialogic/Modules/Glossary/glossary_resource.gd +++ b/addons/dialogic/Modules/Glossary/glossary_resource.gd @@ -10,7 +10,7 @@ extends Resource ## a string, representing the actual key for the key used. ## The string key-value pairs are the alias keys, they allow to redirect ## the actual glossary entry. -@export var entries: Dictionary = {} +@export var entries := {} ## If false, no entries from this glossary will be shown @export var enabled: bool = true @@ -39,13 +39,13 @@ const PRIVATE_PROPERTY_PREFIX := "_" ## Private ID assigned when this glossary is translated. -@export var _translation_id: String = "" +@export var _translation_id := "" ## Private lookup table used to find the translation ID of a glossary entry. ## The keys (String) are all translated words that may trigger a glossary entry to ## be shown. ## The values (String) are the translation ID. -@export var _translation_keys: Dictionary = {} +@export var _translation_keys := {} diff --git a/addons/dialogic/Modules/HighlightPortrait/simple_highlight_portrait.gd b/addons/dialogic/Modules/HighlightPortrait/simple_highlight_portrait.gd index 07d41cea8..5ed6649df 100644 --- a/addons/dialogic/Modules/HighlightPortrait/simple_highlight_portrait.gd +++ b/addons/dialogic/Modules/HighlightPortrait/simple_highlight_portrait.gd @@ -2,7 +2,7 @@ extends DialogicPortrait @export_group('Main') -@export_file var image: String = "" +@export_file var image := "" var unhighlighted_color := Color.DARK_GRAY var _prev_z_index := 0 diff --git a/addons/dialogic/Modules/Jump/event_jump.gd b/addons/dialogic/Modules/Jump/event_jump.gd index b6dc81e45..050dfa9a4 100644 --- a/addons/dialogic/Modules/Jump/event_jump.gd +++ b/addons/dialogic/Modules/Jump/event_jump.gd @@ -8,15 +8,15 @@ extends DialogicEvent ### Settings ## The timeline to jump to, if null then it's the current one. This setting should be a dialogic timeline resource. -var timeline : DialogicTimeline +var timeline: DialogicTimeline ## If not empty, the event will try to find a Label event with this set as name. Empty by default.. -var label_name : String = "" +var label_name := "" ### Helpers ## Used to set the timeline resource from the unique name identifier and vice versa -var timeline_identifier: String = "": +var timeline_identifier := "": get: if timeline: var identifier := DialogicResourceUtil.get_unique_identifier(timeline.resource_path) diff --git a/addons/dialogic/Modules/Jump/event_label.gd b/addons/dialogic/Modules/Jump/event_label.gd index 34a27d1b9..97f7ac653 100644 --- a/addons/dialogic/Modules/Jump/event_label.gd +++ b/addons/dialogic/Modules/Jump/event_label.gd @@ -8,8 +8,8 @@ extends DialogicEvent ### Settings ## Used to identify the label. Duplicate names in a timeline will mean it always chooses the first. -var name: String = "" -var display_name: String = "" +var name := "" +var display_name := "" @@ -56,7 +56,7 @@ func to_text() -> String: func from_text(string:String) -> void: - var regex = RegEx.create_from_string(r'label +(?[^(]+)(\((?.+)\))?') + var regex := RegEx.create_from_string(r'label +(?[^(]+)(\((?.+)\))?') var result := regex.search(string.strip_edges()) if result: name = result.get_string('name').strip_edges() diff --git a/addons/dialogic/Modules/Save/event_save.gd b/addons/dialogic/Modules/Save/event_save.gd index 804c4e0ff..4fed7a44a 100644 --- a/addons/dialogic/Modules/Save/event_save.gd +++ b/addons/dialogic/Modules/Save/event_save.gd @@ -9,7 +9,7 @@ extends DialogicEvent ## The name of the slot to save to. Learn more in the saving subsystem. ## If empty, the event will attempt to save to the latest slot, and otherwise use the default. -var slot_name: String = "" +var slot_name := "" ################################################################################ diff --git a/addons/dialogic/Modules/Save/subsystem_save.gd b/addons/dialogic/Modules/Save/subsystem_save.gd index 62571c8c4..0bc1866c4 100644 --- a/addons/dialogic/Modules/Save/subsystem_save.gd +++ b/addons/dialogic/Modules/Save/subsystem_save.gd @@ -28,7 +28,7 @@ const AUTO_SAVE_MODE_SETTINGS := "dialogic/save/autosave_mode" ## Temporarily stores a taken screen capture when using [take_slot_image()]. enum ThumbnailMode {NONE, TAKE_AND_STORE, STORE_ONLY} -var latest_thumbnail : Image = null +var latest_thumbnail: Image = null ## The different types of auto-save triggers. @@ -345,7 +345,7 @@ func get_default_slot() -> String: ## Returns the latest slot or empty if nothing was saved yet func get_latest_slot() -> String: - var latest_slot: String = "" + var latest_slot := "" if Engine.get_main_loop().has_meta('dialogic_latest_saved_slot'): latest_slot = Engine.get_main_loop().get_meta('dialogic_latest_saved_slot', '') diff --git a/addons/dialogic/Modules/Settings/event_setting.gd b/addons/dialogic/Modules/Settings/event_setting.gd index 9e5a8983c..16dfa14de 100644 --- a/addons/dialogic/Modules/Settings/event_setting.gd +++ b/addons/dialogic/Modules/Settings/event_setting.gd @@ -16,7 +16,7 @@ enum SettingValueType { } ## The name of the setting to save to. -var name: String = "" +var name := "" var _value_type := 0 : get: return _value_type diff --git a/addons/dialogic/Modules/Style/event_style.gd b/addons/dialogic/Modules/Style/event_style.gd index 25e53626a..9264b416d 100644 --- a/addons/dialogic/Modules/Style/event_style.gd +++ b/addons/dialogic/Modules/Style/event_style.gd @@ -8,7 +8,7 @@ extends DialogicEvent ### Settings ## The name of the style to change to. Can be set on the DialogicNode_Style. -var style_name: String = "" +var style_name := "" ################################################################################ diff --git a/addons/dialogic/Modules/Style/node_style.gd b/addons/dialogic/Modules/Style/node_style.gd index d53ffff0e..fce1e2f5d 100644 --- a/addons/dialogic/Modules/Style/node_style.gd +++ b/addons/dialogic/Modules/Style/node_style.gd @@ -1,7 +1,7 @@ class_name DialogicNode_StyleLayer extends Control -## Control node that is hidden and shown based on the current dialogic style. +## Control node that is hidden and shown based on the current dialogic style. ## The name this layer listens to @export var layer_name: String = 'Default' diff --git a/addons/dialogic/Modules/StyleEditor/style_editor.gd b/addons/dialogic/Modules/StyleEditor/style_editor.gd index 698293be9..643bb71a5 100644 --- a/addons/dialogic/Modules/StyleEditor/style_editor.gd +++ b/addons/dialogic/Modules/StyleEditor/style_editor.gd @@ -296,7 +296,7 @@ func _on_layout_style_name_text_submitted(new_text:String) -> void: func _on_layout_style_name_focus_exited() -> void: - var new_name :String= %LayoutStyleName.text.strip_edges() + var new_name: String = %LayoutStyleName.text.strip_edges() if new_name == current_style.name: return diff --git a/addons/dialogic/Modules/StyleEditor/style_layer_editor.gd b/addons/dialogic/Modules/StyleEditor/style_layer_editor.gd index 3f15caab2..1062743c8 100644 --- a/addons/dialogic/Modules/StyleEditor/style_layer_editor.gd +++ b/addons/dialogic/Modules/StyleEditor/style_layer_editor.gd @@ -377,9 +377,9 @@ func load_layout_scene_customization(custom_scene_path:String, overrides:Diction note.name = "General" return - var current_grid :GridContainer = null + var current_grid: GridContainer = null - var label_bg_style = get_theme_stylebox("CanvasItemInfoOverlay", "EditorStyles").duplicate() + var label_bg_style := get_theme_stylebox("CanvasItemInfoOverlay", "EditorStyles").duplicate() label_bg_style.content_margin_left = 5 label_bg_style.content_margin_right = 5 label_bg_style.content_margin_top = 5 @@ -391,7 +391,7 @@ func load_layout_scene_customization(custom_scene_path:String, overrides:Diction for i in settings: match i['id']: &"GROUP": - var main_scroll = ScrollContainer.new() + var main_scroll := ScrollContainer.new() main_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL main_scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL main_scroll.name = i['name'] @@ -430,7 +430,7 @@ func load_layout_scene_customization(custom_scene_path:String, overrides:Diction label.text = str(i['name'].trim_prefix(current_group_name+'_').trim_prefix(current_subgroup_name+'_')).capitalize() current_grid.add_child(label, true) - var scene_value = scene.get(i['name']) + var scene_value: Variant = scene.get(i['name']) customization_editor_info[i['name']] = {} if i['name'] in inherited_overrides: @@ -438,13 +438,13 @@ func load_layout_scene_customization(custom_scene_path:String, overrides:Diction else: customization_editor_info[i['name']]['orig'] = scene_value - var current_value :Variant + var current_value: Variant if i['name'] in overrides: current_value = str_to_var(overrides.get(i['name'])) else: current_value = customization_editor_info[i['name']]['orig'] - var input :Node = DialogicUtil.setup_script_property_edit_node(i, current_value, set_export_override) + var input: Node = DialogicUtil.setup_script_property_edit_node(i, current_value, set_export_override) input.size_flags_horizontal = SIZE_EXPAND_FILL customization_editor_info[i['name']]['node'] = input @@ -523,7 +523,7 @@ func _on_export_override_reset(property_name:String) -> void: func set_customization_value(property_name:String, value:Variant) -> void: - var node : Node = customization_editor_info[property_name]['node'] + var node: Node = customization_editor_info[property_name]['node'] if node is CheckBox: node.button_pressed = value elif node is LineEdit: diff --git a/addons/dialogic/Modules/Text/auto_skip.gd b/addons/dialogic/Modules/Text/auto_skip.gd index 2a614f257..40ec0f83b 100644 --- a/addons/dialogic/Modules/Text/auto_skip.gd +++ b/addons/dialogic/Modules/Text/auto_skip.gd @@ -13,23 +13,23 @@ signal toggled(is_enabled: bool) ## If Auto-Skip is referred to be [i]disabled[/i], it refers to setting this ## this variable to `false`. ## This variable will automatically emit [signal autoskip_changed] when changed. -var enabled: bool = false : set = _set_enabled +var enabled := false : set = _set_enabled ## If `true`, Auto-Skip will be disabled when the user presses a recognised ## input action. -var disable_on_user_input: bool = true +var disable_on_user_input := true ## If `true`, Auto-Skip will be disabled when the timeline advances to a ## unread Text event or an event requesting user input. -var disable_on_unread_text: bool = false +var disable_on_unread_text := false ## If `true`, Auto-Skip will be enabled when the timeline advances to a ## previously visited Text event. ## Useful if the player always wants to skip already-visited Text events. -var enable_on_visited: bool = false +var enable_on_visited := false ## If `true`, Auto-Skip will skip Voice events instead of playing them. -var skip_voice: bool = true +var skip_voice := true ## The amount of seconds each event may take. ## This is not enforced, each event must implement this behaviour. diff --git a/addons/dialogic/Modules/Text/character_settings/character_moods_settings.gd b/addons/dialogic/Modules/Text/character_settings/character_moods_settings.gd index f7bd85b7b..3a2110188 100644 --- a/addons/dialogic/Modules/Text/character_settings/character_moods_settings.gd +++ b/addons/dialogic/Modules/Text/character_settings/character_moods_settings.gd @@ -68,7 +68,7 @@ func update_mood_list(selected_name := "") -> void: %MoodList.clear() for mood in current_moods_info: - var idx :int = %MoodList.add_item(mood, get_theme_icon("AudioStreamPlayer", "EditorIcons")) + var idx: int = %MoodList.add_item(mood, get_theme_icon("AudioStreamPlayer", "EditorIcons")) if mood == selected_name: %MoodList.select(idx) _on_mood_list_item_selected(idx) diff --git a/addons/dialogic/Modules/Text/event_text.gd b/addons/dialogic/Modules/Text/event_text.gd index 37e069a37..d22bd13cb 100644 --- a/addons/dialogic/Modules/Text/event_text.gd +++ b/addons/dialogic/Modules/Text/event_text.gd @@ -11,13 +11,13 @@ extends DialogicEvent ## This is the content of the text event. ## It is supposed to be displayed by a DialogicNode_DialogText node. ## That means you can use bbcode, but also some custom commands. -var text: String = "" +var text := "" ## If this is not null, the given character (as a resource) will be associated with this event. ## The DialogicNode_NameLabel will show the characters display_name. If a typing sound is setup, ## it will play. var character: DialogicCharacter = null ## If a character is set, this setting can change the portrait of that character. -var portrait: String = "" +var portrait := "" ### Helpers @@ -483,7 +483,7 @@ func _get_syntax_highlighting(Highlighter:SyntaxHighlighter, dict:Dictionary, li dict = Highlighter.color_region(dict, Highlighter.variable_color, line, '{', '}', result.get_start('text')) for replace_mod_match in text_random_word_regex.search_all(result.get_string('text')): - var color :Color = Highlighter.string_color + var color: Color = Highlighter.string_color color = color.lerp(Highlighter.normal_color, 0.4) dict[replace_mod_match.get_start()+result.get_start('text')] = {'color':Highlighter.string_color} var offset := 1 diff --git a/addons/dialogic/Modules/Text/node_dialog_text.gd b/addons/dialogic/Modules/Text/node_dialog_text.gd index 36134b17f..ac4cf92cd 100644 --- a/addons/dialogic/Modules/Text/node_dialog_text.gd +++ b/addons/dialogic/Modules/Text/node_dialog_text.gd @@ -11,7 +11,7 @@ enum Alignment {LEFT, CENTER, RIGHT} @export var enabled := true @export var alignment := Alignment.LEFT -@export var textbox_root : Node = self +@export var textbox_root: Node = self @export var hide_when_empty := false @export var start_hidden := true diff --git a/addons/dialogic/Modules/Text/node_name_label.gd b/addons/dialogic/Modules/Text/node_name_label.gd index 15f276db6..6546e2be6 100644 --- a/addons/dialogic/Modules/Text/node_name_label.gd +++ b/addons/dialogic/Modules/Text/node_name_label.gd @@ -5,7 +5,7 @@ class_name DialogicNode_NameLabel # If true, the label will be hidden if no character speaks. @export var hide_when_empty := true -@export var name_label_root :Node = self +@export var name_label_root: Node = self @export var use_character_color := true func _ready() -> void: diff --git a/addons/dialogic/Modules/Text/node_type_sound.gd b/addons/dialogic/Modules/Text/node_type_sound.gd index 5d042e04c..59babda30 100644 --- a/addons/dialogic/Modules/Text/node_type_sound.gd +++ b/addons/dialogic/Modules/Text/node_type_sound.gd @@ -21,11 +21,11 @@ enum Modes {INTERRUPT, OVERLAP, AWAIT} ## Allows changing the volume by a random value from (volume - volume_variance) to (volume + volume_variance) @export_range(0, 10, 0.01) var volume_variance := 0.0 ## Characters that don't increase the 'characters_since_last_sound' variable, useful for the space or fullstop -@export var ignore_characters:String = ' .,' +@export var ignore_characters: String = ' .,' var characters_since_last_sound: int = 0 -var base_pitch :float = pitch_scale -var base_volume :float = volume_db +var base_pitch: float = pitch_scale +var base_volume: float = volume_db var RNG := RandomNumberGenerator.new() var current_overwrite_data := {} @@ -77,7 +77,7 @@ func _on_continued_revealing_text(new_character:String) -> void: characters_since_last_sound = 0 - var audio_player : AudioStreamPlayer = self + var audio_player: AudioStreamPlayer = self if current_overwrite_data.get('mode', mode) == Modes.OVERLAP: audio_player = AudioStreamPlayer.new() audio_player.bus = bus @@ -118,7 +118,7 @@ func load_overwrite(dictionary:Dictionary) -> void: static func load_sounds_from_path(path:String) -> Array[AudioStream]: if path.get_extension().to_lower() in ['mp3', 'wav', 'ogg'] and load(path) is AudioStream: return [load(path)] - var _sounds :Array[AudioStream]= [] + var _sounds: Array[AudioStream] = [] for file in DialogicUtil.listdir(path, true, false, true, true): if !file.ends_with('.import'): continue diff --git a/addons/dialogic/Modules/Text/subsystem_text.gd b/addons/dialogic/Modules/Text/subsystem_text.gd index 1c8adbe75..6ce73000a 100644 --- a/addons/dialogic/Modules/Text/subsystem_text.gd +++ b/addons/dialogic/Modules/Text/subsystem_text.gd @@ -558,10 +558,10 @@ func effect_mood(_text_node:Control, _skipped:bool, argument:String) -> void: var modifier_words_select_regex := RegEx.create_from_string(r"(?]+(\/[^\>]*)\>") func modifier_random_selection(text:String) -> String: for replace_mod_match in modifier_words_select_regex.search_all(text): - var string: String= replace_mod_match.get_string().trim_prefix("<").trim_suffix(">") + var string: String = replace_mod_match.get_string().trim_prefix("<").trim_suffix(">") string = string.replace('//', '') - var list: PackedStringArray= string.split('/') - var item: String= list[randi()%len(list)] + var list: PackedStringArray = string.split('/') + var item: String = list[randi()%len(list)] item = item.replace('', '/') text = text.replace(replace_mod_match.get_string(), item.strip_edges()) return text diff --git a/addons/dialogic/Modules/TextInput/event_text_input.gd b/addons/dialogic/Modules/TextInput/event_text_input.gd index 81fc5db97..184fcf8ab 100644 --- a/addons/dialogic/Modules/TextInput/event_text_input.gd +++ b/addons/dialogic/Modules/TextInput/event_text_input.gd @@ -8,15 +8,15 @@ extends DialogicEvent ### Settings ## The promt to be shown. -var text: String = "Please enter some text:" +var text := "Please enter some text:" ## The name/path of the variable to set. -var variable: String = "" +var variable := "" ## The placeholder text to show in the line edit. -var placeholder: String = "" +var placeholder := "" ## The value that should be in the line edit by default. -var default: String = "" +var default := "" ## If true, the player can continue if nothing is entered. -var allow_empty : bool = false +var allow_empty := false ################################################################################ @@ -92,7 +92,7 @@ func get_var_suggestions(filter:String="") -> Dictionary: suggestions[filter] = { 'value' : filter, 'editor_icon' : ["GuiScrollArrowRight", "EditorIcons"]} - var vars :Dictionary = ProjectSettings.get_setting('dialogic/variables', {}) + var vars: Dictionary = ProjectSettings.get_setting('dialogic/variables', {}) for var_path in DialogicUtil.list_variables(vars, "", DialogicUtil.VarTypes.STRING): suggestions[var_path] = {'value':var_path, 'icon':load("res://addons/dialogic/Editor/Images/Pieces/variable.svg")} return suggestions diff --git a/addons/dialogic/Modules/TextInput/node_text_input.gd b/addons/dialogic/Modules/TextInput/node_text_input.gd index 5dc80375b..9a18354ee 100644 --- a/addons/dialogic/Modules/TextInput/node_text_input.gd +++ b/addons/dialogic/Modules/TextInput/node_text_input.gd @@ -5,14 +5,14 @@ extends Control ## Should be connected to a (probably contained) label, a line edit and a button to work. ## The LineEdit to use. -@export_node_path var input_line_edit:NodePath +@export_node_path var input_line_edit: NodePath ## The Label to use. -@export_node_path var text_label:NodePath +@export_node_path var text_label: NodePath ## The Button to use. -@export_node_path var confirmation_button:NodePath +@export_node_path var confirmation_button: NodePath # This is set by the subsystem and used as a confirmation check. -var _allow_empty : bool = false +var _allow_empty := false func _ready() -> void: diff --git a/addons/dialogic/Modules/Variable/event_variable.gd b/addons/dialogic/Modules/Variable/event_variable.gd index b45dd42da..3111bdb9b 100644 --- a/addons/dialogic/Modules/Variable/event_variable.gd +++ b/addons/dialogic/Modules/Variable/event_variable.gd @@ -18,7 +18,7 @@ enum VarValueType { ## Settings ## Name/Path of the variable that should be changed. -var name: String = "": +var name := "": set(_value): name = _value if Engine.is_editor_hint() and not value: @@ -33,7 +33,7 @@ var name: String = "": update_editor_warning() ## The operation to perform. -var operation: int = Operations.SET: +var operation := Operations.SET: set(value): operation = value if operation != Operations.SET and _value_type == VarValueType.STRING: @@ -65,7 +65,7 @@ var random_max: int = 100 ## Used to suppress _value_type from overwriting value with a default value when the type changes ## This is only used when initializing the event_variable. -var _suppress_default_value: bool = false +var _suppress_default_value := false ################################################################################ diff --git a/addons/dialogic/Modules/Variable/subsystem_variables.gd b/addons/dialogic/Modules/Variable/subsystem_variables.gd index 0c6e0809e..b14ba6841 100644 --- a/addons/dialogic/Modules/Variable/subsystem_variables.gd +++ b/addons/dialogic/Modules/Variable/subsystem_variables.gd @@ -229,7 +229,7 @@ func merge_folder(new:Dictionary, defs:Dictionary) -> Dictionary: class VariableFolder: var data := {} var path := "" - var outside : DialogicSubsystem + var outside: DialogicSubsystem func _init(_data:Dictionary, _path:String, _outside:DialogicSubsystem): data = _data diff --git a/addons/dialogic/Modules/Variable/variables_editor/variable_tree.gd b/addons/dialogic/Modules/Variable/variables_editor/variable_tree.gd index f56226b40..bd2c1b9df 100644 --- a/addons/dialogic/Modules/Variable/variables_editor/variable_tree.gd +++ b/addons/dialogic/Modules/Variable/variables_editor/variable_tree.gd @@ -271,7 +271,7 @@ func _drop_data(position:Vector2, item:Variant) -> void: parent = to_item.get_parent() ## Test for inheritance-recursion - var test_item:= to_item + var test_item := to_item while true: if test_item == item: return diff --git a/addons/dialogic/Modules/Voice/event_voice.gd b/addons/dialogic/Modules/Voice/event_voice.gd index e16c60670..54c8a4e16 100644 --- a/addons/dialogic/Modules/Voice/event_voice.gd +++ b/addons/dialogic/Modules/Voice/event_voice.gd @@ -8,11 +8,11 @@ extends DialogicEvent ### Settings ## The path to the sound file. -var file_path: String = "" +var file_path := "" ## The volume the sound will be played at. var volume: float = 0 ## The audio bus to play the sound on. -var audio_bus: String = "Master" +var audio_bus := "Master" ################################################################################ diff --git a/addons/dialogic/Modules/Wait/event_wait.gd b/addons/dialogic/Modules/Wait/event_wait.gd index 04bf939fe..eff1cd2ea 100644 --- a/addons/dialogic/Modules/Wait/event_wait.gd +++ b/addons/dialogic/Modules/Wait/event_wait.gd @@ -10,7 +10,7 @@ extends DialogicEvent ## The time in seconds that the event will stop before continuing. var time: float = 1.0 ## If true the text box will be hidden while the event waits. -var hide_text: bool = true +var hide_text := true ################################################################################ diff --git a/addons/dialogic/Resources/TimelineResourceSaver.gd b/addons/dialogic/Resources/TimelineResourceSaver.gd index 74a2a99be..62bca8924 100644 --- a/addons/dialogic/Resources/TimelineResourceSaver.gd +++ b/addons/dialogic/Resources/TimelineResourceSaver.gd @@ -23,7 +23,7 @@ func _recognize(resource: Resource) -> bool: func _save(resource: Resource, path: String = '', _flags: int = 0) -> Error: if resource.get_meta("timeline_not_saved", false): - var timeline_as_text: String = "" + var timeline_as_text := "" # if events are resources, create text if resource.events_processed: diff --git a/addons/dialogic/Resources/event.gd b/addons/dialogic/Resources/event.gd index f6c6e861f..4a73cfc68 100644 --- a/addons/dialogic/Resources/event.gd +++ b/addons/dialogic/Resources/event.gd @@ -19,9 +19,9 @@ signal event_finished(event_resource:DialogicEvent) ### Main Event Properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## The event name that'll be displayed in the editor. -var event_name: String = "Event" +var event_name := "Event" ## Unique identifier used for translatable events. -var _translation_id: String = "" +var _translation_id := "" ## A reference to dialogic during execution, can be used the same as Dialogic (reference to the autoload) var dialogic: DialogicGameHandler = null @@ -30,48 +30,48 @@ var dialogic: DialogicGameHandler = null ### (these properties store how this event affects indentation/flow of timeline) ## If true this event can not be toplevel (e.g. Choice) -var needs_indentation: bool = false +var needs_indentation := false ## If true this event will spawn with an END BRANCH event and higher the indentation -var can_contain_events: bool = false +var can_contain_events := false ## If [can_contain_events] is true this is a reference to the end branch event var end_branch_event: DialogicEndBranchEvent = null ## If this is true this event will group with other similar events (like choices do). -var wants_to_group: bool = false +var wants_to_group := false ### Saving/Loading Properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Stores the event in a text format. Does NOT automatically update. -var event_node_as_text: String = "" +var event_node_as_text := "" ## Flags if the event has been processed or is only stored as text -var event_node_ready: bool = false +var event_node_ready := false ## How many empty lines are before this event -var empty_lines_above:int = 0 +var empty_lines_above: int = 0 ### Editor UI Properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## The event color that event node will take in the editor -var event_color: Color = Color("FBB13C") +var event_color := Color("FBB13C") ## If you are using the default color palette -var dialogic_color_name: String = '' +var dialogic_color_name: = "" ## To sort the buttons shown in the editor. Lower index is placed at the top of a category var event_sorting_index: int = 0 ## If true the event will not have a button in the visual editor sidebar -var disable_editor_button: bool = false +var disable_editor_button := false ## If false the event will hide it's body by default. Recommended for most events -var expand_by_default: bool = false +var expand_by_default := false ## The URL to open when right_click>Documentation is selected -var help_page_path: String = "" +var help_page_path := "" ## Is the event block created by a button? -var created_by_button: bool = false +var created_by_button := false ## Reference to the node, that represents this event. Only works while in visual editor mode. ## Use with care. var editor_node: Control = null ## The categories and which one to put it in (in the visual editor sidebar) -var event_category: String = "Other" +var event_category := "Other" ### Editor UI creation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -384,9 +384,9 @@ func is_string_full_event(string: String) -> bool: ## Used to get all the shortcode parameters in a string as a dictionary. func parse_shortcode_parameters(shortcode: String) -> Dictionary: - var regex: RegEx = RegEx.new() + var regex := RegEx.new() regex.compile(r'(?[^\s=]*)\s*=\s*"(?(\{[^}]*\}|\[[^]]*\]|([^"]|\\")*|))(? void: ## Stores all events in their text format and returns them as a string func as_text() -> String: - var result: String = "" + var result := "" if events_processed: var indent := 0