mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-07-05 14:10:42 -04:00
V10 compatibility with 0.7.0-alpha1 release
This commit is contained in:
parent
107aec3244
commit
e23893b6ca
12 changed files with 125 additions and 126 deletions
|
@ -33,8 +33,7 @@ Hooks.once("init", async function() {
|
|||
|
||||
game.worldbuilding = {
|
||||
SimpleActor,
|
||||
createWorldbuildingMacro,
|
||||
useEntity: foundry.utils.isNewerVersion("9", game.version ?? game.data.version)
|
||||
createWorldbuildingMacro
|
||||
};
|
||||
|
||||
// Define custom Document classes
|
||||
|
@ -108,17 +107,17 @@ Hooks.on("hotbarDrop", (bar, data, slot) => createWorldbuildingMacro(data, slot)
|
|||
* Adds the actor template context menu.
|
||||
*/
|
||||
Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
||||
const idAttr = game.worldbuilding.useEntity ? "entityId" : "documentId";
|
||||
|
||||
// Define an actor as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||
icon: '<i class="fas fa-stamp"></i>',
|
||||
condition: li => {
|
||||
const actor = game.actors.get(li.data(idAttr));
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
return !actor.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const actor = game.actors.get(li.data(idAttr));
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
actor.setFlag("worldbuilding", "isTemplate", true);
|
||||
}
|
||||
});
|
||||
|
@ -128,11 +127,11 @@ Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
|||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
condition: li => {
|
||||
const actor = game.actors.get(li.data(idAttr));
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
return actor.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const actor = game.actors.get(li.data(idAttr));
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
actor.setFlag("worldbuilding", "isTemplate", false);
|
||||
}
|
||||
});
|
||||
|
@ -142,17 +141,17 @@ Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
|||
* Adds the item template context menu.
|
||||
*/
|
||||
Hooks.on("getItemDirectoryEntryContext", (html, options) => {
|
||||
const idAttr = game.worldbuilding.useEntity ? "entityId" : "documentId";
|
||||
|
||||
// Define an item as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||
icon: '<i class="fas fa-stamp"></i>',
|
||||
condition: li => {
|
||||
const item = game.items.get(li.data(idAttr));
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
return !item.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const item = game.items.get(li.data(idAttr));
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
item.setFlag("worldbuilding", "isTemplate", true);
|
||||
}
|
||||
});
|
||||
|
@ -162,11 +161,11 @@ Hooks.on("getItemDirectoryEntryContext", (html, options) => {
|
|||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
condition: li => {
|
||||
const item = game.items.get(li.data(idAttr));
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
return item.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const item = game.items.get(li.data(idAttr));
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
item.setFlag("worldbuilding", "isTemplate", false);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue