Skip to content

feat: loader specific enabled handling - #2282

Open
WilsontheWolf wants to merge 2 commits into
ebkr:developfrom
WilsontheWolf:loader-disabling
Open

WilsontheWolf wants to merge 2 commits into
ebkr:developfrom
WilsontheWolf:loader-disabling

Conversation

@WilsontheWolf

Copy link
Copy Markdown

This adds the ability for PackageInstallers to control mod enabled/disabled states. This is done via the following methods:

PackageInstaller.isLoaderDisabled?(args: InstallArgs): Promise<boolean|undefined>;

Which allows a package installer to indicate whether a mod is enabled or disabled (or if r2mm should handle it, undefined), if the method has been defined, and:

ProfileInstallerProvider.isModLoaderDisabled(mod: ManifestV2, profile: ImmutableProfile): Promise<R2Error | boolean | undefined> ;

which is used to get the value of the aformentiond isLoaderDisabled for a specific mod, handling loaders that don't define the method.
This is then used when querying the list of mods to force enable or disable a mod if isModLoaderDisabled returns true/false.

The LovelyPluginInstaller now provides isLoaderDisabled, and it now opts to rely soley on lovely's built in disabling mechanims rather than r2mm's, which improves compatbility with mods that rely on this (for example, Steamodded's mod menu now shows disabled mods correctly, and they can be (dis/en)abled from there and sync to r2mm).

When disabling a mod it adds a .lovelyignore, and when enabling it will handle both .lovelyignore and the blacklist correctly.

This might cause some issues if a user disables a mod in an old version of r2mm, and updates to this new version as the mechanism has been changed. I didn't really know how to solve this so I just didn't

@CLAassistant

CLAassistant commented Sep 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ebkr
ebkr requested a review from ethangreen-dev September 17, 2026 12:53
for(let modIndex in parsedYaml){
const mod = new ManifestV2().fromJsObject(parsedYaml[modIndex]);
// Mod loaders don't support disabling.
if (!installer.isModLoader(mod)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I get a TS2339: Property 'isModLoader' does not exist on type 'ProfileInstallerProvider' error here

mod,
} = args;
const info = await this.isDisabled(args, false)
if (!info) return console.warn("Told to enable a lovely mod (" + mod.getName() + "), but mod was not disabled?");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will fire on every package uninstall as well, IIRC. Not really necessary.

Comment on lines +42 to +48

/**
* Returns a boolean if a mod is disabled in the loader. Returns undefined if the loader doesn't support disabling.
* For loaders without a disabling mechanism, this function should always return false.
* @param mod
*/
public abstract isModLoaderDisabled(mod: ManifestV2, profile: ImmutableProfile): Promise<R2Error | boolean | undefined> ;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Both the docstring and the function name are confusing. Does this function return false or undefined? Clarify.

}
}

async disable(args: InstallArgs) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This implementation works except for disabled mods that existed before the user updated r2modman. Those disabled packages would get forcibly re-enabled, which isn't really what we want.

Off the top of my head, disabled packages should be detectable via:

  1. Does mods.yml say it is disabled?
  2. Is there a .lovelyignore or blacklist entry?
  3. Are the mod's files missing?

This whole part of r2modman is kinda confusing so if I don't make sense I'm sorry. It's late and I'm sleeeeeepy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants