Working on Compatibility for FVTT v10

updated migration stuff
This commit is contained in:
Vlyan
2022-07-24 11:19:05 +02:00
parent 075ce5f662
commit 71eed1b26d
3 changed files with 54 additions and 68 deletions

View File

@@ -16,7 +16,7 @@ export default class HooksL5r5e {
* Do anything once the system is ready
*/
static async ready() {
// If multiple GM connected, tag the 1st alive, useful for some traitements
// If multiple GM connected, tag the 1st alive, useful for some traitements that need to be done once (migration, delete...)
Object.defineProperty(game.user, "isFirstGM", {
get: function () {
return game.user.isGM && game.user.id === game.users.find((u) => u.active && u.isGM)?.id;
@@ -24,8 +24,8 @@ export default class HooksL5r5e {
});
// Migration stuff
if (game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) {
game.l5r5e.migrations.migrateWorld({ force: false });
if (game.user.isFirstGM && game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) {
game.l5r5e.migrations.migrateWorld({ force: false }).then();
}
// For some reasons, not always really ready, so wait a little