From 4031e1384f396b7e9a14c18c8a2e4261d7ef848a Mon Sep 17 00:00:00 2001 From: Rendo Date: Wed, 17 Dec 2025 02:20:20 +0500 Subject: [PATCH] Update without restart --- systems/auto_update.gd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/systems/auto_update.gd b/systems/auto_update.gd index 2b6188e..68aa098 100644 --- a/systems/auto_update.gd +++ b/systems/auto_update.gd @@ -4,6 +4,7 @@ var popup_scene: PackedScene = preload("uid://5goo8fyxkv33") var new_version_avaiable: bool var popup: ConfirmationDialog +var pack_file: String signal update_version_text(to: StringName) @@ -14,10 +15,9 @@ func _ready() -> void: popup.confirmed.connect(download_button_pressed) var patch_request: HTTPRequest = popup.get_node("HTTPRequest") - var exec_path = OS.get_executable_path() - var splitted = exec_path.split("/") - var exec_dir = exec_path.replace(splitted[len(splitted)-1],"") - patch_request.download_file = exec_dir + "chelimbalo.pck" + var exec_dir = OS.get_executable_path().get_base_dir() + pack_file = exec_dir.path_join("chelimbalo.pck") + patch_request.download_file = pack_file patch_request.request_completed.connect(patch_downloaded) update_version_text.emit("Подгружаем данные с сервера...") @@ -42,7 +42,7 @@ func download_button_pressed() -> void: func patch_downloaded(result: int, _response_code: int, _headers: PackedStringArray, _body: PackedByteArray) -> void: if result == OK: - OS.create_process(OS.get_executable_path(),OS.get_cmdline_args()) - get_tree().quit() + ProjectSettings.load_resource_pack(pack_file) + get_tree().reload_current_scene() else: update_version_text.emit("[color=red]Ошибка загрузки новой версии:" + str(result) +"[/color]")