options_profile.gd 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. class_name ModLoaderOptionsProfile
  2. extends Resource
  3. ##
  4. ## Class to define and store Mod Loader Options.
  5. ##
  6. ## @tutorial(Example Customization Script): https://wiki.godotmodding.com/guides/integration/mod_loader_options/#game-version-validation
  7. ## Settings for game version validation.
  8. enum VERSION_VALIDATION {
  9. ## Uses the default semantic versioning (semver) validation.
  10. DEFAULT,
  11. ## Disables validation of the game version specified in [member semantic_version]
  12. ## and the mod's [member ModManifest.compatible_game_version].
  13. DISABLED,
  14. ## Enables custom game version validation.
  15. ## Use [member customize_script_path] to specify a script that customizes the Mod Loader options.
  16. ## In this script, you must set [member custom_game_version_validation_callable]
  17. ## to a custom validation [Callable].
  18. ## [br]
  19. ## ===[br]
  20. ## [b]Note:[color=note "Easier Mod Loader Updates"][/color][/b][br]
  21. ## Using a custom script allows you to keep your code outside the addons directory,
  22. ## making it easier to update the mod loader without affecting your modifications. [br]
  23. ## ===[br]
  24. CUSTOM,
  25. }
  26. ## Can be used to disable mods for specific plaforms by using feature overrides
  27. @export var enable_mods: bool = true
  28. ## List of mod ids that can't be turned on or off
  29. @export var locked_mods: Array[String] = []
  30. ## List of mods that will not be loaded
  31. @export var disabled_mods: Array[String] = []
  32. ## Disables the requirement for the mod loader autoloads to be first
  33. @export var allow_modloader_autoloads_anywhere: bool = false
  34. ## This script is loaded after [member ModLoaderStore.ml_options] has been initialized.
  35. ## It is instantiated with [member ModLoaderStore.ml_options] as an argument.
  36. ## Use this script to apply settings that cannot be configured through the editor UI.
  37. ##
  38. ## For an example, see [enum VERSION_VALIDATION] [code]CUSTOM[/code] or
  39. ## [code]res://addons/mod_loader/options/example_customize_script.gd[/code].
  40. @export_file var customize_script_path: String
  41. @export_group("Logging")
  42. ## Sets the logging verbosity level.
  43. ## Refer to [enum ModLoaderLog.VERBOSITY_LEVEL] for more details.
  44. @export var log_level := ModLoaderLog.VERBOSITY_LEVEL.DEBUG
  45. ## Stops the mod loader from logging any deprecation related errors.
  46. @export var ignore_deprecated_errors: bool = false
  47. ## Ignore messages from these namespaces.[br]
  48. ## Accepts * as wildcard. [br]
  49. ## [code]ModLoader:Dependency[/code] - ignore the exact name [br]
  50. ## [code]ModLoader:*[/code] - ignore all beginning with this name [br]
  51. @export var ignored_mod_names_in_log: Array[String] = []
  52. @export var hint_color := Color("#70bafa")
  53. @export_group("Game Data")
  54. ## Steam app id, can be found in the steam page url
  55. @export var steam_id: int = 0:
  56. get:
  57. return steam_id
  58. ## Semantic game version. [br]
  59. ## Replace the getter in options_profile.gd if your game stores the version somewhere else
  60. @export var semantic_version := "0.0.0":
  61. get:
  62. return semantic_version
  63. @export_group("Mod Sources")
  64. ## Indicates whether to load mods from the Steam Workshop directory, or the overridden workshop path.
  65. @export var load_from_steam_workshop: bool = false
  66. ## Indicates whether to load mods from the "mods" folder located at the game's install directory, or the overridden mods path.
  67. @export var load_from_local: bool = true
  68. ## Indicates whether to load mods from [code]"res://mods-unpacked"[/code] in the exported game.[br]
  69. ## ===[br]
  70. ## [b]Note:[color=note "Load from unpacked in the editor"][/color][/b][br]
  71. ## In the editor, mods inside [code]"res://mods-unpacked"[/code] are always loaded. Use [member enable_mods] to disable mod loading completely.[br]
  72. ## ===[br]
  73. @export var load_from_unpacked: bool = true
  74. ## Path to a folder containing mods [br]
  75. ## Mod zips should be directly in this folder
  76. @export_dir var override_path_to_mods = ""
  77. ## Use this option to override the default path where configs are stored.
  78. @export_dir var override_path_to_configs = ""
  79. ## Path to a folder containing workshop items.[br]
  80. ## Mods zips are placed in another folder, usually[br]
  81. ## [code]/<workshop id>/mod.zip[/code][br]
  82. ## The real workshop path ends with [br]
  83. ## [code]/workshop/content[/code] [br]
  84. @export_dir var override_path_to_workshop = ""
  85. @export_group("Mod Hooks")
  86. ## Can be used to override the default hook pack path, the hook pack is located inside the game's install directory by default.
  87. ## To override the path specify a new absolute path.
  88. @export_global_dir var override_path_to_hook_pack := ""
  89. ## Can be used to override the default hook pack name, by default it is [constant ModLoaderStore.MOD_HOOK_PACK_NAME]
  90. @export var override_hook_pack_name := ""
  91. ## Can be used to specify your own scene that is displayed if a game restart is required.
  92. ## For example if new mod hooks were generated.
  93. @export_dir var restart_notification_scene_path := "res://addons/mod_loader/restart_notification.tscn"
  94. ## Can be used to disable the mod loader's restart logic. Use the [signal ModLoader.new_hooks_created] to implement your own restart logic.
  95. @export var disable_restart := false
  96. @export_group("Mod Validation")
  97. ## Defines how the game version should be validated.
  98. ## This setting controls validation for the game version specified in [member semantic_version]
  99. ## and the mod's [member ModManifest.compatible_game_version].
  100. @export var game_version_validation := VERSION_VALIDATION.DEFAULT
  101. ## Callable that is executed during [ModManifest] validation
  102. ## if [member game_version_validation] is set to [enum VERSION_VALIDATION] [code]CUSTOM[/code].
  103. ## See the example under [enum VERSION_VALIDATION] [code]CUSTOM[/code] to learn how to set this up.
  104. var custom_game_version_validation_callable: Callable
  105. ## Stores the instance of the script specified in [member customize_script_path].
  106. var customize_script_instance: RefCounted