Added a game.user.isFirstGM property

This commit is contained in:
Vlyan
2022-07-18 18:19:47 +02:00
parent d74d91d8b8
commit cf937c4979
6 changed files with 17 additions and 6 deletions

View File

@@ -16,6 +16,13 @@ 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
Object.defineProperty(game.user, "isFirstGM", {
get: function () {
return game.user.isGM && game.user.id === game.users.find((u) => u.active && u.isGM)?.id;
},
});
// Migration stuff
if (game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) {
game.l5r5e.migrations.migrateWorld({ force: false });