Skip to content

Commit

Permalink
Merge pull request #1364 from ebkr/rom-plugin-installer
Browse files Browse the repository at this point in the history
Add ReturnOfModdingPluginInstaller
  • Loading branch information
anttimaki authored Sep 2, 2024
2 parents 382f3b3 + b46df64 commit fbdd7b6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 38 deletions.
40 changes: 38 additions & 2 deletions src/installers/ReturnOfModdingInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import path from "path";

import { InstallRuleInstaller } from "./InstallRuleInstaller";
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { PackageLoader } from "../model/installing/PackageLoader";
import FsProvider from "../providers/generic/file/FsProvider";
import { MODLOADER_PACKAGES } from "../r2mm/installing/profile_installers/ModLoaderVariantRecord";
import { PackageLoader } from "../model/installing/PackageLoader";

const basePackageFiles = ["manifest.json", "readme.md", "icon.png"];

Expand Down Expand Up @@ -40,3 +42,37 @@ export class ReturnOfModdingInstaller extends PackageInstaller {
}
}
}

export class ReturnOfModdingPluginInstaller extends PackageInstaller {
readonly installer = new InstallRuleInstaller({
gameName: "none" as any, // This isn't acutally used for actual installation but needs some value
rules: [
{
route: path.join("ReturnOfModding", "plugins"),
isDefaultLocation: true,
defaultFileExtensions: [],
trackingMethod: "SUBDIR",
subRoutes: [],
},
{
route: path.join("ReturnOfModding", "plugins_data"),
defaultFileExtensions: [],
trackingMethod: "SUBDIR",
subRoutes: [],
},
{
route: path.join("ReturnOfModding", "config"),
defaultFileExtensions: [],
trackingMethod: "SUBDIR",
subRoutes: [],
}
]
});

/**
* Handles installation of mods that use ReturnOfModding mod loader
*/
async install(args: InstallArgs) {
await this.installer.install(args);
}
}
3 changes: 2 additions & 1 deletion src/installers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PackageInstaller } from './PackageInstaller';
import { ShimloaderInstaller, ShimloaderPluginInstaller } from './ShimloaderInstaller';
import { LovelyInstaller, LovelyPluginInstaller } from './LovelyInstaller';
import { NorthstarInstaller } from './NorthstarInstaller';
import { ReturnOfModdingInstaller } from './ReturnOfModdingInstaller';
import { ReturnOfModdingInstaller, ReturnOfModdingPluginInstaller } from './ReturnOfModdingInstaller';


const _PackageInstallers = {
Expand All @@ -19,6 +19,7 @@ const _PackageInstallers = {
"lovely": new LovelyInstaller(),
"lovely-plugin": new LovelyPluginInstaller(),
"returnofmodding": new ReturnOfModdingInstaller(),
"returnofmodding-plugin": new ReturnOfModdingPluginInstaller(),
}

export type PackageInstallerId = keyof typeof _PackageInstallers;
Expand Down
1 change: 1 addition & 0 deletions src/model/installing/PackageLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function GetInstallerIdForPlugin(loader: PackageLoader): PackageInstaller
switch (loader) {
case PackageLoader.SHIMLOADER: return "shimloader-plugin";
case PackageLoader.LOVELY: return "lovely-plugin";
case PackageLoader.RETURN_OF_MODDING: return "returnofmodding-plugin";
}

return null;
Expand Down
1 change: 0 additions & 1 deletion src/providers/ror2/installing/ProfileInstallerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ProviderUtils from '../../generic/ProviderUtils';
import ManifestV2 from '../../../model/ManifestV2';
import R2Error from '../../../model/errors/R2Error';
import FileTree from '../../../model/file/FileTree';
import ModLoaderPackageMapping from '../../../model/installing/ModLoaderPackageMapping';
import Profile from '../../../model/Profile';

export default abstract class ProfileInstallerProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
import {
buildMelonLoaderRules
} from "../default_installation_rules/game_rules/InstallRules_MelonLoader";
import { buildReturnOfModdingRules } from './game_rules/InstallRules_ReturnOfModding';

export default class InstallationRuleApplicator {

Expand Down Expand Up @@ -127,7 +126,6 @@ export default class InstallationRuleApplicator {
buildBepInExRules("AgainstTheStorm"),
buildBepInExRules("Lycans"),
buildBepInExRules("CastleStory"),
buildReturnOfModdingRules("RiskofRainReturns"),
buildBepInExRules("Magicraft"),
buildBepInExRules("AnotherCrabsTreasure"),
buildBepInExRules("GladioMori"),
Expand Down

This file was deleted.

0 comments on commit fbdd7b6

Please sign in to comment.