Skip to content

Replaced deprecated methods #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions root/mods-unpacked/AuthorName-ModName/extensions/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func _ready()->void:

# ! Note that you won't see this in the log immediately, because main.gd
# ! doesn't run until you start a run
ModLoaderUtils.log_info("Ready", MYMOD_LOG)
ModLoaderLog.info("Ready", MYMOD_LOG)

# ! These are custom functions. It will run after vanilla's own _ready is
# ! finished
Expand Down Expand Up @@ -45,4 +45,4 @@ func _modname_my_custom_edit_1()->void: # ! `void` means it doesn't return anyth


func _modname_my_custom_edit_2()->void:
ModLoaderUtils.log_info("Main.gd has been modified", MYMOD_LOG)
ModLoaderLog.info("Main.gd has been modified", MYMOD_LOG)
14 changes: 7 additions & 7 deletions root/mods-unpacked/AuthorName-ModName/mod_main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ var dir = ""
var ext_dir = ""


func _init(modLoader = ModLoader):
ModLoaderUtils.log_info("Init", MYMOD_LOG)
func _init():
ModLoaderLog.info("Init", MYMOD_LOG)

# ! We can't use `ModLoader` because the ModLoader instance isn't available
# ! at this point in the mod's loading process. Instead, the class instance
# ! is passed to a mod's `_init` func via the variable `modLoader`.
# ! It will be available in any other places in your mod though, such as in
# ! your _ready func.
dir = modLoader.UNPACKED_DIR + MOD_DIR
dir = ModLoaderMod.get_unpacked_dir() + MOD_DIR
ext_dir = dir + "extensions/" # ! any script extensions should go in this folder, and should follow the same folder structure as vanilla

# Add extensions
modLoader.install_script_extension(ext_dir + "main.gd") # brief description of this edit...
ModLoaderMod.install_script_extension(ext_dir + "main.gd") # brief description of this edit...
#modLoader.install_script_extension(ext_dir + "entities/units/player/player.gd") # ! Note that this file does not exist in this example mod

# ! Add extensions (longform version of the above)
Expand All @@ -40,12 +40,12 @@ func _init(modLoader = ModLoader):
# ! Godot will automatically generate a ".translation" file, eg "modname.en.translation".
# ! Note that in this example, only the file called "modname.csv" is custom;
# ! any other files in the "translations" folder were automatically generated by Godot
modLoader.add_translation_from_resource(dir + "translations/modname.en.translation")
ModLoaderMod.add_translation(dir + "translations/modname.en.translation")


func _ready()->void:
ModLoaderUtils.log_info("Ready", MYMOD_LOG)
ModLoaderLog.info("Ready", MYMOD_LOG)

# ! This uses Godot's native `tr` func, which translates a string. You'll
# ! find this particular string in the example CSV here: translations/modname.csv
ModLoaderUtils.log_info(str("Translation Demo: ", tr("MODNAME_READY_TEXT")), MYMOD_LOG)
ModLoaderLog.info(str("Translation Demo: ", tr("MODNAME_READY_TEXT")), MYMOD_LOG)