diff --git a/changelog.md b/changelog.md index d12e388..a55d9a8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ # Changelog +## 4.0.5 +- migration is now an asynchronous Task that will not break the module. ## 4.0.4 - translated to Brazilian Portuguese by [Andersants](https://github.com/Andersants) ## 4.0.3 diff --git a/module.json b/module.json index 9e7c602..30872f1 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "title": "Beaver's Crafting Module", "description": "A Module for crafting, brewing, harvesting, mining, fabricating, gathering, character advancement, tech tree, skill tree, ability tree, downtime activities, factions / organisation reputation, quest logs, skill training", "id": "beavers-crafting", - "version": "4.0.4", + "version": "4.0.5", "authors": [ { "name": "angryBeaver", diff --git a/package.json b/package.json index f8f3524..c82cd93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "beavers-crafting", "title": "Beaver's Crafting", - "version": "4.0.4", + "version": "4.0.5", "description": "Crafting", "devDir": "c:\\vtts\\v12.331\\Data\\modules", "#devDir": "c:\\vtts\\v11.315\\Data\\modules", diff --git a/src/main.js b/src/main.js index 99084d4..71d4fab 100644 --- a/src/main.js +++ b/src/main.js @@ -26,20 +26,7 @@ Hooks.on("ready", async function(){ } }) -Hooks.once("beavers-system-interface.ready", async function(){ - Settings.init(); - if(!game[Settings.NAMESPACE])game[Settings.NAMESPACE]={}; - game[Settings.NAMESPACE].Crafting = Crafting; - game[Settings.NAMESPACE].RecipeCompendium = RecipeCompendium; - game[Settings.NAMESPACE].Recipe = Recipe; - game[Settings.NAMESPACE].Settings = Settings; - game[Settings.NAMESPACE].migrateRecipeAddItemType = itemTypeMigration; - game[Settings.NAMESPACE].migrateRecipeSkillToTests= migrateRecipeSkillToTests; - game[Settings.NAMESPACE].migrateDeprecateTools= migrateDeprecateTools; - game[Settings.NAMESPACE].migrateRecipeToOrConditions= migrateRecipeToOrConditions; - game[Settings.NAMESPACE].migrateRecipeTestsToBeaversTests= migrateRecipeTestsToBeaversTests; - - hookChatLog(); +async function migrate(){ const version = Settings.get(Settings.MAJOR_VERSION); if(version == 2){ await migrateDeprecateTools(); @@ -51,11 +38,27 @@ Hooks.once("beavers-system-interface.ready", async function(){ await migrateRecipeToOrConditions(); } if(version < 400){ - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise(resolve => setTimeout(resolve, 10000)); await migrateRecipeTestsToBeaversTests(); } Settings.set(Settings.MAJOR_VERSION,400); +} +Hooks.once("beavers-system-interface.ready", async function(){ + Settings.init(); + if(!game[Settings.NAMESPACE])game[Settings.NAMESPACE]={}; + game[Settings.NAMESPACE].Crafting = Crafting; + game[Settings.NAMESPACE].RecipeCompendium = RecipeCompendium; + game[Settings.NAMESPACE].Recipe = Recipe; + game[Settings.NAMESPACE].Settings = Settings; + game[Settings.NAMESPACE].migrateRecipeAddItemType = itemTypeMigration; + game[Settings.NAMESPACE].migrateRecipeSkillToTests= migrateRecipeSkillToTests; + game[Settings.NAMESPACE].migrateDeprecateTools= migrateDeprecateTools; + game[Settings.NAMESPACE].migrateRecipeToOrConditions= migrateRecipeToOrConditions; + game[Settings.NAMESPACE].migrateRecipeTestsToBeaversTests= migrateRecipeTestsToBeaversTests; + + hookChatLog(); + migrate(); beaversSystemInterface.addExtension(Settings.NAMESPACE,{componentAddFlags:["crafted","isCrafted"]}) if(Settings.get(Settings.SEPARATE_CRAFTED_ITEMS) === "full"){