-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmoulinette-scenes.js
95 lines (83 loc) · 2.9 KB
/
moulinette-scenes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { MoulinetteExport } from "./modules/moulinette-export.js"
import { MoulinetteLocalExport } from "./modules/moulinette-localexport.js"
Hooks.once("init", async function () {
console.log("Moulinette Scenes | Init")
game.settings.register("moulinette-scenes", "createFolders", {
name: game.i18n.localize("mtte.configCreateFolders"),
hint: game.i18n.localize("mtte.configCreateFoldersHint"),
scope: "world",
config: true,
default: true,
type: Boolean
});
game.settings.register("moulinette-scenes", "generateThumbnails", {
name: game.i18n.localize("mtte.configGenerateThumbnails"),
hint: game.i18n.localize("mtte.configGenerateThumbnailsHint"),
scope: "world",
config: true,
default: true,
type: Boolean
});
})
/**
* Ready: defines a shortcut to open Moulinette Interface
*/
Hooks.once("ready", async function () {
if (game.user.isGM) {
// create default home folder for scenes
await game.moulinette.applications.MoulinetteFileUtil.createFolderRecursive("moulinette/scenes/custom")
const moduleClass = (await import("./modules/moulinette-scenes.js")).MoulinetteScenes
game.moulinette.forge.push({
id: "scenes",
icon: "fas fa-map",
name: game.i18n.localize("mtte.scenes"),
description: game.i18n.localize("mtte.scenesDescription"),
instance: new moduleClass(),
actions: [
{id: "configureSources", icon: "fas fa-cogs" ,name: game.i18n.localize("mtte.configureSources"), help: game.i18n.localize("mtte.configureSourcesToolTip") },
{id: "howto", icon: "fas fa-question-circle" ,name: game.i18n.localize("mtte.howto"), help: game.i18n.localize("mtte.howtoToolTip") }
]
})
console.log("Moulinette Scenes | Module loaded")
}
});
/**
* Hook for submitting a scene
*/
Hooks.on("getSceneDirectoryEntryContext", (html, options) => {
options.push({
name: game.i18n.localize("mtte.localexport"),
icon: '<i class="fas fa-upload"></i>',
callback: async function(li) {
const scene = game.scenes.get(li.data("documentId"))
new MoulinetteLocalExport(scene, null).render(true)
},
condition: li => {
return true;
},
});
});
Hooks.on("getSceneDirectoryFolderContext", (html, options) => {
options.push({
name: game.i18n.localize("mtte.export"),
icon: '<i class="fas fa-cloud-upload-alt"></i>',
callback: async function(li) {
const folder = game.folders.get($(li).closest("li").data("folderId"))
new MoulinetteExport(folder).render(true)
},
condition: li => {
return true;
},
});
options.push({
name: game.i18n.localize("mtte.localexport"),
icon: '<i class="fas fa-upload"></i>',
callback: async function(li) {
const folder = game.folders.get($(li).closest("li").data("folderId"))
new MoulinetteLocalExport(null, folder).render(true)
},
condition: li => {
return true;
},
});
});