@@ -4,45 +4,48 @@ extends Resource
44## Class to define and store Mod Loader Options.
55
66
7- ## Settings for the game version validation.
7+ ## Settings for game version validation.
88enum VERSION_VALIDATION {
9- ## The default semver version validation
9+ ## Uses the default semantic versioning (semver) validation.
1010 DEFAULT ,
11- ## Activate this option to disable validation of the game version specified in [member semantic_version]
11+
12+ ## Disables validation of the game version specified in [member semantic_version]
1213 ## and the mod's [member ModManifest.compatible_game_version].
1314 DISABLED ,
14- ## Activate this option to use a custom game version validation, use the [member customize_script_path]
15- ## to specify a script to customize the Mod Loader Options. In this script you have to set [member custom_game_version_validation_callable]
16- ## with a custom validation [Callable].
17- ##
18- ## [codeblock]
19- ## extends RefCounted
20- ##
15+
16+ ## Enables custom game version validation.
17+ ## Use [member customize_script_path] to specify a script that customizes the Mod Loader options.
18+ ## In this script, you must set [member custom_game_version_validation_callable]
19+ ## to a custom validation [Callable].
2120 ##
22- ## func _init(ml_options: ModLoaderOptionsProfile) -> void:
23- ## # Setting the custom_game_version_validation_callable here.
24- ## # Use `OS.has_feature(feature_tag)` to apply different validations for different feature tags.
25- ## ml_options.custom_game_version_validation_callable = custom_is_game_version_compatible
21+ ## Example:
22+ ## [codeblock]
23+ ## extends RefCounted
2624 ##
25+ ## func _init(ml_options: ModLoaderOptionsProfile) -> void:
26+ ## # Assign a custom validation function.
27+ ## # Use `OS.has_feature(feature_tag)` to apply different validations for different platforms.
28+ ## ml_options.custom_game_version_validation_callable = custom_is_game_version_compatible
2729 ##
28- ## func custom_is_game_version_compatible(manifest: ModManifest) -> bool:
29- ## print("! ☞゚ヮ゚)☞ CUSTOM VALIDATION HERE ☜゚ヮ゚☜) !")
30+ ## func custom_is_game_version_compatible(manifest: ModManifest) -> bool:
31+ ## print("! ☞゚ヮ゚)☞ CUSTOM VALIDATION HERE ☜゚ヮ゚☜) !")
3032 ##
31- ## var mod_id := manifest.get_mod_id()
33+ ## var mod_id := manifest.get_mod_id()
3234 ##
33- ## for version in manifest.compatible_game_version:
34- ## if not version == "pizza":
35- ## manifest.validation_messages_warning.push_back(
36- ## "The mod \"%s\" may not be compatible with the current game version.
37- ## Enable at your own risk. (current game version: %s, mod compatible with game versions: %s)" %
38- ## [mod_id, MyGlobalVars.MyGameVersion, manifest.compatible_game_version]
39- ## )
40- ## return false
35+ ## for version in manifest.compatible_game_version:
36+ ## if not version == "pizza":
37+ ## manifest.validation_messages_warning.push_back(
38+ ## "The mod \"%s\" may not be compatible with the current game version.
39+ ## Enable at your own risk. (current game version: %s, mod compatible with game versions: %s)" %
40+ ## [mod_id, MyGlobalVars.MyGameVersion, manifest.compatible_game_version]
41+ ## )
42+ ## return false
4143 ##
42- ## return true
43- ## [/codeblock]
44+ ## return true
45+ ## [/codeblock]
4446 ##
45- ## Using the customization script allows you to place your custom code outside of the addon directory to simplify mod loader updates.
47+ ## Using a customization script allows you to keep your custom code outside the addon directory,
48+ ## making it easier to update the mod loader without affecting your modifications.
4649 ##
4750 CUSTOM ,
4851}
@@ -56,10 +59,11 @@ enum VERSION_VALIDATION {
5659## Disables the requirement for the mod loader autoloads to be first
5760@export var allow_modloader_autoloads_anywhere : bool = false
5861## This script is loaded after [member ModLoaderStore.ml_options] has been initialized.
59- ## It is initialized with [member ModLoaderStore.ml_options] as an argument. Use it to apply any settings
60- ## that cannot be configured through the editor UI.
61- ## See [enum VERSION_VALIDATION] [code]CUSTOM[/code] or
62- ## [code]res://addons/mod_loader/options/example_customize_script.gd[/code] for an example.
62+ ## It is instantiated with [member ModLoaderStore.ml_options] as an argument.
63+ ## Use this script to apply settings that cannot be configured through the editor UI.
64+ ##
65+ ## For an example, see [enum VERSION_VALIDATION] [code]CUSTOM[/code] or
66+ ## [code]res://addons/mod_loader/options/example_customize_script.gd[/code].
6367@export_file var customize_script_path : String
6468
6569@export_group ("Logging" )
@@ -116,12 +120,15 @@ enum VERSION_VALIDATION {
116120@export var disable_restart := false
117121
118122@export_group ("Mod Validation" )
119- ## Settings for validation of the game version specified in [member semantic_version]
123+ ## Defines how the game version should be validated.
124+ ## This setting controls validation for the game version specified in [member semantic_version]
120125## and the mod's [member ModManifest.compatible_game_version].
121- @export var game_version_validation := VERSION_VALIDATION .DEFAULT
122- ## This is the callable that is called during [ModManifest] validation.
123- ## See the example at [enum VERSION_VALIDATION] [code]CUSTOM[/code] to learn how to set this.
126+ @export var game_version_validation := VERSION_VALIDATION .DEFAULT
127+
128+ ## Callable that is executed during [ModManifest] validation
129+ ## if [member game_version_validation] is set to [enum VERSION_VALIDATION] [code]CUSTOM[/code].
130+ ## See the example under [enum VERSION_VALIDATION] [code]CUSTOM[/code] to learn how to set this up.
124131var custom_game_version_validation_callable : Callable
125132
126- ## This is where the instance of [member customize_script_path] is stored .
133+ ## Stores the instance of the script specified in [member customize_script_path].
127134var customize_script_instance : RefCounted
0 commit comments