1+ # API methods for deprecating funcs. Can be used by mods with public APIs.
12class_name ModLoaderDeprecated
23extends Node
34
4- # API methods for deprecating funcs. Can be used by mods with public APIs.
55
66const 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
1018static 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
2136static 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
3252static 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
3963static 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