Add support for Foundry 0.7.3

- Fixed an issue with the actor/item creation dialog that prevented
  it from working on Foundry 0.7.x versions.
- Removed obsolete translation string.
- Bumped minimum core version now that 0.7.3 is in beta.
This commit is contained in:
Matt Smith 2020-10-09 19:49:56 -05:00
parent f69f9c80ea
commit 8daec8bd92
3 changed files with 10 additions and 9 deletions

View file

@ -179,23 +179,23 @@ Hooks.on("getItemDirectoryEntryContext", (html, options) => {
/**
* Adds the actor template selection dialog.
*/
ActorDirectory.prototype._onCreate = async (event) => {
ActorDirectory.prototype._onCreateEntity = async (event) => {
// Do not allow the creation event to bubble to other listeners
event.preventDefault();
event.stopPropagation();
_simpleDirectoryTemplates('actor');
_simpleDirectoryTemplates('actor', event);
}
/**
* Adds the item template selection dialog.
*/
ItemDirectory.prototype._onCreate = async (event) => {
ItemDirectory.prototype._onCreateEntity = async (event) => {
// Do not allow the creation event to bubble to other listeners
event.preventDefault();
event.stopPropagation();
_simpleDirectoryTemplates('item');
_simpleDirectoryTemplates('item', event);
}
/**
@ -205,8 +205,9 @@ ItemDirectory.prototype._onCreate = async (event) => {
* defined for the entity type.
*
* @param {string} entityType - 'actor' or 'item'
* @param {MouseEvent} event - Triggering event
*/
async function _simpleDirectoryTemplates(entityType = 'actor') {
async function _simpleDirectoryTemplates(entityType = 'actor', event) {
// Retrieve the collection and class.
const entityCollection = entityType == 'actor' ? game.actors : game.items;
const cls = entityType == 'actor' ? Actor : Item;
@ -252,7 +253,8 @@ async function _simpleDirectoryTemplates(entityType = 'actor') {
yes: html => {
// Get the form data.
const form = html[0].querySelector("form");
mergeObject(createData, validateForm(form));
const fd = new FormDataExtended(form);
mergeObject(createData, fd.toObject());
// Store the type and name values, and retrieve the template entity.
let templateActor = entityCollection.getName(createData.type);

View file

@ -3,8 +3,8 @@
"title": "Simple World-Building",
"description": "A minimalist game system with very simple Actor and Item models to support free-form system agnostic gameplay.",
"version": 0.36,
"minimumCoreVersion": "0.5.6",
"compatibleCoreVersion": "0.5.7",
"minimumCoreVersion": "0.7.3",
"compatibleCoreVersion": "0.7.3",
"templateVersion": 2,
"author": "Atropos",
"esmodules": ["module/simple.js"],

View file

@ -11,6 +11,5 @@
<option value="{{this.value}}">{{this.label}}</option>
{{/each}}
</select>
<p class="notes">{{localize "ENTITY.TypeHint"}}</p>
</div>
</form>