mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-04-21 19:31:52 -04:00
squashed commits
This commit is contained in:
parent
d31ef12363
commit
760534a13e
3 changed files with 33 additions and 4 deletions
source
|
@ -49,6 +49,16 @@ class Main extends Sprite
|
|||
// TODO: Replace with loadEnabledMods() once the user can configure the mod list.
|
||||
funkin.modding.PolymodHandler.loadAllMods();
|
||||
|
||||
if (funkin.modding.PolymodHandler.outdatedMods.length > 0)
|
||||
{
|
||||
var description:String = 'Required Version: ${funkin.modding.PolymodHandler.API_VERSION_RULE}\n';
|
||||
for (mod in funkin.modding.PolymodHandler.outdatedMods)
|
||||
{
|
||||
description += '\n${mod.title} (v${mod.apiVersion}, id: ${mod.id})';
|
||||
}
|
||||
funkin.modding.PolymodErrorHandler.showAlert('Outdated Mods', description);
|
||||
}
|
||||
|
||||
if (stage != null)
|
||||
{
|
||||
init();
|
||||
|
|
|
@ -26,6 +26,7 @@ import funkin.play.character.CharacterData.CharacterDataParser;
|
|||
import funkin.play.notes.notekind.NoteKindManager;
|
||||
import funkin.play.PlayStatePlaylist;
|
||||
import funkin.ui.debug.charting.ChartEditorState;
|
||||
import funkin.modding.module.ModuleHandler;
|
||||
import funkin.ui.title.TitleState;
|
||||
import funkin.ui.transition.LoadingState;
|
||||
import funkin.util.CLIUtil;
|
||||
|
|
|
@ -19,6 +19,7 @@ import funkin.util.FileUtil;
|
|||
import funkin.util.macro.ClassMacro;
|
||||
import polymod.backends.PolymodAssets.PolymodAssetType;
|
||||
import polymod.format.ParseRules.TextFileFormat;
|
||||
import polymod.util.VersionUtil;
|
||||
import polymod.Polymod;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,7 @@ class PolymodHandler
|
|||
* Using more complex rules allows mods from older compatible versions to stay functioning,
|
||||
* while preventing mods made for future versions from being installed.
|
||||
*/
|
||||
static final API_VERSION_RULE:String = ">=0.5.0 <0.6.0";
|
||||
public static final API_VERSION_RULE:String = ">=0.5.0 <0.6.0";
|
||||
|
||||
/**
|
||||
* Where relative to the executable that mods are located.
|
||||
|
@ -61,6 +62,8 @@ class PolymodHandler
|
|||
null
|
||||
#end;
|
||||
|
||||
public static var outdatedMods(default, null):Array<ModMetadata> = [];
|
||||
|
||||
public static var loadedModIds:Array<String> = [];
|
||||
|
||||
// Use SysZipFileSystem on desktop and MemoryZipFilesystem on web.
|
||||
|
@ -408,12 +411,27 @@ class PolymodHandler
|
|||
var modMetadata:Array<ModMetadata> = Polymod.scan(
|
||||
{
|
||||
modRoot: MOD_FOLDER,
|
||||
apiVersionRule: API_VERSION_RULE,
|
||||
apiVersionRule: VersionUtil.DEFAULT_VERSION_RULE,
|
||||
fileSystem: modFileSystem,
|
||||
errorCallback: PolymodErrorHandler.onPolymodError
|
||||
});
|
||||
trace('Found ${modMetadata.length} mods when scanning.');
|
||||
return modMetadata;
|
||||
|
||||
outdatedMods = [];
|
||||
var validMods:Array<ModMetadata> = [];
|
||||
|
||||
for (data in modMetadata)
|
||||
{
|
||||
if (!VersionUtil.match(data.apiVersion, API_VERSION_RULE))
|
||||
{
|
||||
outdatedMods.push(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
validMods.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
return validMods;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue