diff --git a/sharedlibs/magical-glass-redux/lib.json b/sharedlibs/magical-glass-redux/lib.json index e314c9cc7..67ab9e0e4 100644 --- a/sharedlibs/magical-glass-redux/lib.json +++ b/sharedlibs/magical-glass-redux/lib.json @@ -11,6 +11,9 @@ "version": "v2.25.23", "engineVer": "v0.10.0-dev", + // In DPR: Load assets once when the engine starts. + "preload_assets": true, + "config": { ///// Default Battle System diff --git a/src/engine/loadstate.lua b/src/engine/loadstate.lua index bf6d76b9d..6ea2e9eec 100644 --- a/src/engine/loadstate.lua +++ b/src/engine/loadstate.lua @@ -68,6 +68,16 @@ function Loading:beginLoad() self.load_complete = false Kristal.loadAssets("", "all", "") + local paths = {} + for _, name in ipairs(love.filesystem.getDirectoryItems("sharedlibs")) do + local lib_full_path = "sharedlibs/"..name + if love.filesystem.getInfo(lib_full_path .. "/lib.json") then + local data = JSON.decode(love.filesystem.read(lib_full_path.."/lib.json")) + if data.preload_assets then + Kristal.loadAssets(lib_full_path, "all", "") + end + end + end Kristal.loadAssets("", "plugins", "") Kristal.loadAssets("", "mods", "", function () self.loading = false diff --git a/src/kristal.lua b/src/kristal.lua index bd543d689..8e1e4e756 100644 --- a/src/kristal.lua +++ b/src/kristal.lua @@ -1275,7 +1275,11 @@ function Kristal.loadModAssets(id, asset_type, asset_paths, after) -- Finally load all assets (libraries first) for _, lib_id in ipairs(mod.lib_order) do - Kristal.loadAssets(mod.libs[lib_id].path, asset_type or "all", asset_paths or "", finishLoadStep) + if not mod.libs[lib_id].preload_assets then + Kristal.loadAssets(mod.libs[lib_id].path, asset_type or "all", asset_paths or "", finishLoadStep) + else + finishLoadStep() + end end Kristal.loadAssets(mod.path, asset_type or "all", asset_paths or "", finishLoadStep) for plugin in Kristal.PluginLoader.iterPlugins(true) do