mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Merge branch '0.6.x' into 'master'
Update for v9 compatibility. See merge request foundrynet/worldbuilding!16
This commit is contained in:
commit
bea3bf18d1
4 changed files with 22 additions and 20 deletions
|
@ -518,7 +518,7 @@ export class EntitySheetHelper {
|
||||||
const documentName = this.metadata.name;
|
const documentName = this.metadata.name;
|
||||||
const folders = game.folders.filter(f => (f.data.type === documentName) && f.displayed);
|
const folders = game.folders.filter(f => (f.data.type === documentName) && f.displayed);
|
||||||
const label = game.i18n.localize(this.metadata.label);
|
const label = game.i18n.localize(this.metadata.label);
|
||||||
const title = game.i18n.format("ENTITY.Create", {entity: label});
|
const title = game.i18n.format("DOCUMENT.Create", {type: label});
|
||||||
|
|
||||||
// Identify the template Actor types
|
// Identify the template Actor types
|
||||||
const collection = game.collections.get(this.documentName);
|
const collection = game.collections.get(this.documentName);
|
||||||
|
@ -531,9 +531,11 @@ export class EntitySheetHelper {
|
||||||
types[a.id] = a.name;
|
types[a.id] = a.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the entity creation form
|
// Render the document creation form
|
||||||
const html = await renderTemplate(`templates/sidebar/entity-create.html`, {
|
const useEntity = foundry.utils.isNewerVersion("9", game.version ?? game.data.version);
|
||||||
name: data.name || game.i18n.format("ENTITY.New", {entity: label}),
|
const template = `templates/sidebar/${useEntity ? "entity" : "document" }-create.html`;
|
||||||
|
const html = await renderTemplate(template, {
|
||||||
|
name: data.name || game.i18n.format("DOCUMENT.New", {type: label}),
|
||||||
folder: data.folder,
|
folder: data.folder,
|
||||||
folders: folders,
|
folders: folders,
|
||||||
hasFolders: folders.length > 1,
|
hasFolders: folders.length > 1,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
export async function createWorldbuildingMacro(data, slot) {
|
export async function createWorldbuildingMacro(data, slot) {
|
||||||
const command = `const roll = new Roll("${data.roll}", actor ? actor.getRollData() : {});
|
const command = `const roll = new Roll("${data.roll}", actor ? actor.getRollData() : {});
|
||||||
roll.toMessage({speaker, flavor: "${data.label}"});`;
|
roll.toMessage({speaker, flavor: "${data.label}"});`;
|
||||||
let macro = game.macros.entities.find(m => (m.name === item.label) && (m.command === command));
|
let macro = game.macros.find(m => (m.name === item.label) && (m.command === command));
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
macro = await Macro.create({
|
macro = await Macro.create({
|
||||||
name: data.label,
|
name: data.label,
|
||||||
|
|
|
@ -35,7 +35,7 @@ Hooks.once("init", async function() {
|
||||||
createWorldbuildingMacro
|
createWorldbuildingMacro
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define custom Entity classes
|
// Define custom Document classes
|
||||||
CONFIG.Actor.documentClass = SimpleActor;
|
CONFIG.Actor.documentClass = SimpleActor;
|
||||||
CONFIG.Item.documentClass = SimpleItem;
|
CONFIG.Item.documentClass = SimpleItem;
|
||||||
|
|
||||||
|
@ -109,11 +109,11 @@ Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
||||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||||
icon: '<i class="fas fa-stamp"></i>',
|
icon: '<i class="fas fa-stamp"></i>',
|
||||||
condition: li => {
|
condition: li => {
|
||||||
const actor = game.actors.get(li.data("entityId"));
|
const actor = game.actors.get(li.data("documentId"));
|
||||||
return !actor.getFlag("worldbuilding", "isTemplate");
|
return !actor.getFlag("worldbuilding", "isTemplate");
|
||||||
},
|
},
|
||||||
callback: li => {
|
callback: li => {
|
||||||
const actor = game.actors.get(li.data("entityId"));
|
const actor = game.actors.get(li.data("documentId"));
|
||||||
actor.setFlag("worldbuilding", "isTemplate", true);
|
actor.setFlag("worldbuilding", "isTemplate", true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -123,11 +123,11 @@ Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
||||||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||||
icon: '<i class="fas fa-times"></i>',
|
icon: '<i class="fas fa-times"></i>',
|
||||||
condition: li => {
|
condition: li => {
|
||||||
const actor = game.actors.get(li.data("entityId"));
|
const actor = game.actors.get(li.data("documentId"));
|
||||||
return actor.getFlag("worldbuilding", "isTemplate");
|
return actor.getFlag("worldbuilding", "isTemplate");
|
||||||
},
|
},
|
||||||
callback: li => {
|
callback: li => {
|
||||||
const actor = game.actors.get(li.data("entityId"));
|
const actor = game.actors.get(li.data("documentId"));
|
||||||
actor.setFlag("worldbuilding", "isTemplate", false);
|
actor.setFlag("worldbuilding", "isTemplate", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -142,11 +142,11 @@ Hooks.on("getItemDirectoryEntryContext", (html, options) => {
|
||||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||||
icon: '<i class="fas fa-stamp"></i>',
|
icon: '<i class="fas fa-stamp"></i>',
|
||||||
condition: li => {
|
condition: li => {
|
||||||
const item = game.items.get(li.data("entityId"));
|
const item = game.items.get(li.data("documentId"));
|
||||||
return !item.getFlag("worldbuilding", "isTemplate");
|
return !item.getFlag("worldbuilding", "isTemplate");
|
||||||
},
|
},
|
||||||
callback: li => {
|
callback: li => {
|
||||||
const item = game.items.get(li.data("entityId"));
|
const item = game.items.get(li.data("documentId"));
|
||||||
item.setFlag("worldbuilding", "isTemplate", true);
|
item.setFlag("worldbuilding", "isTemplate", true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,11 +156,11 @@ Hooks.on("getItemDirectoryEntryContext", (html, options) => {
|
||||||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||||
icon: '<i class="fas fa-times"></i>',
|
icon: '<i class="fas fa-times"></i>',
|
||||||
condition: li => {
|
condition: li => {
|
||||||
const item = game.items.get(li.data("entityId"));
|
const item = game.items.get(li.data("documentId"));
|
||||||
return item.getFlag("worldbuilding", "isTemplate");
|
return item.getFlag("worldbuilding", "isTemplate");
|
||||||
},
|
},
|
||||||
callback: li => {
|
callback: li => {
|
||||||
const item = game.items.get(li.data("entityId"));
|
const item = game.items.get(li.data("documentId"));
|
||||||
item.setFlag("worldbuilding", "isTemplate", false);
|
item.setFlag("worldbuilding", "isTemplate", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
10
system.json
10
system.json
|
@ -2,9 +2,9 @@
|
||||||
"name": "worldbuilding",
|
"name": "worldbuilding",
|
||||||
"title": "Simple World-Building",
|
"title": "Simple World-Building",
|
||||||
"description": "A minimalist game system which provides configurable Actor and Item templates to support free-form system agnostic game-play.",
|
"description": "A minimalist game system which provides configurable Actor and Item templates to support free-form system agnostic game-play.",
|
||||||
"version": "0.5.0",
|
"version": "0.6.0",
|
||||||
"minimumCoreVersion": "0.8.4",
|
"minimumCoreVersion": "0.8.9",
|
||||||
"compatibleCoreVersion": "0.8.6",
|
"compatibleCoreVersion": "9",
|
||||||
"author": "Atropos",
|
"author": "Atropos",
|
||||||
"esmodules": ["module/simple.js"],
|
"esmodules": ["module/simple.js"],
|
||||||
"styles": ["styles/simple.css"],
|
"styles": ["styles/simple.css"],
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"primaryTokenAttribute": "health",
|
"primaryTokenAttribute": "health",
|
||||||
"secondaryTokenAttribute": "power",
|
"secondaryTokenAttribute": "power",
|
||||||
"url": "https://gitlab.com/foundrynet/worldbuilding/",
|
"url": "https://gitlab.com/foundrynet/worldbuilding/",
|
||||||
"manifest": "https://gitlab.com/foundrynet/worldbuilding/raw/0.5.x/system.json",
|
"manifest": "https://gitlab.com/foundrynet/worldbuilding/raw/0.6.x/system.json",
|
||||||
"download": "https://gitlab.com/foundrynet/worldbuilding/-/archive/release-050/worldbuilding-release-050.zip",
|
"download": "https://gitlab.com/foundrynet/worldbuilding/-/archive/release-060/worldbuilding-release-060.zip",
|
||||||
"license": "LICENSE.txt"
|
"license": "LICENSE.txt"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue