Skip to content
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

feat: ✨ added load_before #185

Merged
merged 4 commits into from
Mar 25, 2023

Conversation

KANAjetzt
Copy link
Member

The code from

Original Description

Adds functionality to specify a mod you want to load before your own mod.

Load before field added to manifest.json in extra -> godot -> load_before

For example:
"load_before": ["Darkly77-ContentLoader"],

{
	"name": "WhatAmILookingAt",
	"namespace": "KANA",
	"version_number": "1.0.0",
	"description": "Tells you where this thing is from.",
	"website_url": "https://github.com/BrotatoMods",
	"dependencies": [],
	"extra": {
		"godot": {
			"incompatibilities": [],
			"load_before": ["Darkly77-ContentLoader"],
			"authors": ["KANA"],
			"compatible_mod_loader_version": "4.3.0",
			"compatible_game_version": ["0.8.0.3"],
			"config_defaults": {}
		}
	}
}

Will need some more testing, this is just a naive implementation.


closes #114


I tested it a bit more

  • Mods added to load_before should not be added to dependencies this cancels out the effect.
    Because a cyclic reference is created and the dependency check will break out of the loop, so both mods end up with the same importance score.
  • It worked successfully for this simple test case
    • Mod 1 no dependencies
    • Mod 2 load_before Mod 1
    • Mod 3 dependency on Mod 1

Adds functionality to specify a mod you want to load before your own mod.

closes GodotModding#114
@KANAjetzt KANAjetzt added the enhancement New feature or request label Mar 24, 2023
@KANAjetzt KANAjetzt added this to the v6.0.0 milestone Mar 24, 2023
@KANAjetzt KANAjetzt requested review from ithinkandicode, Qubus0 and a team March 24, 2023 16:31
Copy link
Collaborator

@Qubus0 Qubus0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this looks good for now. I think this will work well with #122 optional dependencies, since we can just add them there and it won't complain.

addons/mod_loader/mod_loader.gd Outdated Show resolved Hide resolved
addons/mod_loader/mod_loader.gd Show resolved Hide resolved
Makes sure the mod with the `load_before` in the manifest, is not added a second time to the mod specified in the `load_before` array.
Copy link
Collaborator

@ithinkandicode ithinkandicode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, only one suggestion: The PR description says that a mod shouldn't list another mod in both its load_before and dependencies, so could there be an error if a mod developer tries to do this?

Copy link
Collaborator

@Qubus0 Qubus0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, well done.
@ithinkandicode duplicate in deps and load before should be handled here, that remark is just outdated

# Check if it's already a dependency
if mod.dir_name in load_before_mod_dependencies:
ModLoaderUtils.log_debug("Load before - Skipping because it's already a dependency for %s" % load_before_id, LOG_NAME)
continue

@KANAjetzt
Copy link
Member Author

@ithinkandicode I opened #187 for that.
I will fix this with a manifest validation 👍
Ty for the review :)

@KANAjetzt KANAjetzt added this pull request to the merge queue Mar 25, 2023
Merged via the queue into GodotModding:development with commit 7649406 Mar 25, 2023
@KANAjetzt KANAjetzt deleted the load_before branch March 26, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants