mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-01 11:13:06 +00:00
Polymod now properly accesses ZIP mods.
This commit is contained in:
parent
a8a2dc83d3
commit
f3ec29ea46
|
@ -1,5 +1,6 @@
|
|||
package funkin.modding;
|
||||
|
||||
import polymod.fs.ZipFileSystem;
|
||||
import funkin.data.dialogue.conversation.ConversationRegistry;
|
||||
import funkin.data.dialogue.dialoguebox.DialogueBoxRegistry;
|
||||
import funkin.data.dialogue.speaker.SpeakerRegistry;
|
||||
|
@ -54,6 +55,9 @@ class PolymodHandler
|
|||
|
||||
public static var loadedModIds:Array<String> = [];
|
||||
|
||||
// Use SysZipFileSystem on desktop and MemoryZipFilesystem on web.
|
||||
static var modFileSystem:Null<ZipFileSystem> = null;
|
||||
|
||||
/**
|
||||
* If the mods folder doesn't exist, create it.
|
||||
*/
|
||||
|
@ -115,6 +119,8 @@ class PolymodHandler
|
|||
|
||||
buildImports();
|
||||
|
||||
if (modFileSystem == null) modFileSystem = buildFileSystem();
|
||||
|
||||
var loadedModList:Array<ModMetadata> = polymod.Polymod.init(
|
||||
{
|
||||
// Root directory for all mods.
|
||||
|
@ -132,6 +138,8 @@ class PolymodHandler
|
|||
// A map telling Polymod what the asset type is for unfamiliar file extensions.
|
||||
// extensionMap: [],
|
||||
|
||||
customFilesystem: modFileSystem,
|
||||
|
||||
frameworkParams: buildFrameworkParams(),
|
||||
|
||||
// List of filenames to ignore in mods. Use the default list to ignore the metadata file, etc.
|
||||
|
@ -206,6 +214,16 @@ class PolymodHandler
|
|||
#end
|
||||
}
|
||||
|
||||
static function buildFileSystem():polymod.fs.ZipFileSystem
|
||||
{
|
||||
polymod.Polymod.onError = PolymodErrorHandler.onPolymodError;
|
||||
return new ZipFileSystem(
|
||||
{
|
||||
modRoot: MOD_FOLDER,
|
||||
autoScan: true
|
||||
});
|
||||
}
|
||||
|
||||
static function buildImports():Void
|
||||
{
|
||||
// Add default imports for common classes.
|
||||
|
@ -284,10 +302,14 @@ class PolymodHandler
|
|||
public static function getAllMods():Array<ModMetadata>
|
||||
{
|
||||
trace('Scanning the mods folder...');
|
||||
|
||||
if (modFileSystem == null) modFileSystem = buildFileSystem();
|
||||
|
||||
var modMetadata:Array<ModMetadata> = Polymod.scan(
|
||||
{
|
||||
modRoot: MOD_FOLDER,
|
||||
apiVersionRule: API_VERSION,
|
||||
fileSystem: modFileSystem,
|
||||
errorCallback: PolymodErrorHandler.onPolymodError
|
||||
});
|
||||
trace('Found ${modMetadata.length} mods when scanning.');
|
||||
|
|
Loading…
Reference in a new issue