Skip to content

Commit

Permalink
Merge pull request #94 from KANAjetzt/only_setup_cmd_arg
Browse files Browse the repository at this point in the history
--only-setup cli arg
  • Loading branch information
KANAjetzt authored Feb 5, 2023
2 parents 3decb33 + a50f01c commit cad3397
Showing 1 changed file with 10 additions and 2 deletions.
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:
# 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

0 comments on commit cad3397

Please sign in to comment.