Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--only-setup cli arg #94

Merged
merged 1 commit into from
Feb 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions addons/mod_loader/mod_loader_setup.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var modloaderutils: Node = load("res://addons/mod_loader/mod_loader_utils.gd").n

var path := {}
var file_name := {}
var is_only_setup: bool = modloaderutils.is_running_with_command_line_arg("--only-setup")


func _init() -> void:
Expand All @@ -56,10 +57,17 @@ func try_setup_modloader() -> void:
# prompt the user to quit and restart the game.
if is_loader_set_up() and not is_loader_setup_applied():
modloaderutils.log_info("ModLoader is set up, but the game needs to be restarted", LOG_NAME)
OS.alert("The Godot ModLoader has been set up. Restart the game to apply the changes. Confirm to quit.")
ProjectSettings.set_setting(settings.IS_LOADER_SETUP_APPLIED, true)
var _savecustom_error: int = ProjectSettings.save_custom(modloaderutils.get_override_path())
quit()

match true:
Qubus0 marked this conversation as resolved.
Show resolved Hide resolved
# If the --only-setup cli argument is passed, quit with exit code 0
is_only_setup:
quit(0)
# If no cli argument is passed, show message with OS.alert() and user has to restart the game
_:
OS.alert("The Godot ModLoader has been set up. Restart the game to apply the changes. Confirm to quit.")
quit(0)


# Set up the ModLoader as an autoload and register the other global classes.
Expand Down