Skip to content

Commit a01a703

Browse files
authored
docs: 📝 Rewrote API class comments (#279)
* docs: 📝 moved class description above class_name * docs: 📝 extended comments for docs * docs: 📝 extended comments for docs in `ModLoaderLog` * docs: 📝 extended comments for docs in `ModLoaderMod` * docs: 📝 comments for docs in `ModLoaderUserProfile` * docs: 📝 added backticks to example
1 parent 90334fc commit a01a703

File tree

5 files changed

+363
-64
lines changed

5 files changed

+363
-64
lines changed

addons/mod_loader/api/config.gd

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
# This Class provides functionality for working with per-mod Configurations.
12
class_name ModLoaderConfig
23
extends Object
34

45

5-
# This Class provides functionality for working with per-mod Configurations.
6-
76
const LOG_NAME := "ModLoader:Config"
87
const DEFAULT_CONFIG_NAME := "default"
98

@@ -163,7 +162,7 @@ static func get_config_schema(mod_id: String) -> Dictionary:
163162
# Parameters:
164163
# - config (ModConfig): The ModConfig object from which to retrieve the schema.
165164
# - prop (String): The property key for which to retrieve the schema.
166-
# e.g. "parentProp.childProp.nthChildProp" || "propKey"
165+
# e.g. `parentProp.childProp.nthChildProp` || `propKey`
167166
#
168167
# Returns:
169168
# - Dictionary: The schema dictionary for the specified property.

addons/mod_loader/api/deprecated.gd

+32-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
# API methods for deprecating funcs. Can be used by mods with public APIs.
12
class_name ModLoaderDeprecated
23
extends Node
34

4-
# API methods for deprecating funcs. Can be used by mods with public APIs.
55

66
const LOG_NAME := "ModLoader:Deprecated"
77

88

9-
# A method has changed its name/class
9+
# Marks a method that has changed its name or class.
10+
#
11+
# Parameters:
12+
# - old_method (String): The name of the deprecated method.
13+
# - new_method (String): The name of the new method to use.
14+
# - since_version (String): The version number from which the method has been deprecated.
15+
# - show_removal_note (bool): (optional) If true, includes a note about future removal of the old method. Default is true.
16+
#
17+
# Returns: void
1018
static func deprecated_changed(old_method: String, new_method: String, since_version: String, show_removal_note: bool = true) -> void:
1119
_deprecated_log(str(
1220
"DEPRECATED: ",
@@ -16,8 +24,15 @@ static func deprecated_changed(old_method: String, new_method: String, since_ver
1624
))
1725

1826

19-
# A method has been entirely removed, with no replacement
20-
# (should never be needed but good to have just in case)
27+
# Marks a method that has been entirely removed, with no replacement.
28+
# Note: This should rarely be needed but is included for completeness.
29+
#
30+
# Parameters:
31+
# - old_method (String): The name of the removed method.
32+
# - since_version (String): The version number from which the method has been deprecated.
33+
# - show_removal_note (bool): (optional) If true, includes a note about future removal of the old method. Default is true.
34+
#
35+
# Returns: void
2136
static func deprecated_removed(old_method: String, since_version: String, show_removal_note: bool = true) -> void:
2237
_deprecated_log(str(
2338
"DEPRECATED: ",
@@ -27,15 +42,24 @@ static func deprecated_removed(old_method: String, since_version: String, show_r
2742
))
2843

2944

30-
# Freeform deprecation message.
31-
# Allows you to add a deprecation comment without specifying the old/new method
45+
# Marks a method with a freeform deprecation message.
46+
#
47+
# Parameters:
48+
# - msg (String): The deprecation message.
49+
# - since_version (String): (optional) The version number from which the deprecation applies.
50+
#
51+
# Returns: void
3252
static func deprecated_message(msg: String, since_version: String = "") -> void:
3353
var since_text := " (since version %s)" % since_version if since_version else ""
3454
_deprecated_log(str("DEPRECATED: ", msg, since_text))
3555

3656

37-
# Internal func for logging with support to trigger warnings instead of fatal
38-
# errors
57+
# Internal function for logging deprecation messages with support to trigger warnings instead of fatal errors.
58+
#
59+
# Parameters:
60+
# - msg (String): The deprecation message.
61+
#
62+
# Returns: void
3963
static func _deprecated_log(msg: String) -> void:
4064
if ModLoaderStore.ml_options.ignore_deprecated_errors or OS.has_feature("standalone"):
4165
ModLoaderLog.warning(msg, LOG_NAME)

0 commit comments

Comments
 (0)