Skip to content

Commit

Permalink
Patch to disable synthetic quest type registration for v9+ of Foundry…
Browse files Browse the repository at this point in the history
… preventing a hard crash of FQL. There is a replacement module / continuation of the quest log that is being released soon that will enable this functionality against with a different implementation. You can receive announcements when this is ready on the TyphonJS Discord server: https://discord.gg/mnbgN8f
  • Loading branch information
typhonrt committed Dec 19, 2021
1 parent 6712b8f commit 7c77bb6
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/control/FQLHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,28 @@ export default class FQLHooks
// Only attempt to run DB migration for GM.
if (game.user.isGM) { await DBMigration.migrate(); }

// Add the FQL unique Quest data type to the Foundry core data types.
CONST.ENTITY_TYPES?.push(Quest.documentName);
CONST.ENTITY_LINK_TYPES?.push(Quest.documentName);

// Add the FQL Quest data type to CONFIG.
CONFIG[Quest.documentName] = {
entityClass: Quest,
documentClass: Quest,
collection: QuestCollection,
sidebarIcon: 'fas fa-scroll',
sheetClass: QuestPreview
};
// Disable synthetic quest type registration for Foundry `v9+`. As it turns out `CONST` was locked down last
// minute in the v9 release cycle. There is a replacement module / continuing the quest log that will enable this
// functionality again with a different implementation. You can join the TyphonJS Discord server to get an
// announcement when that is available: https://discord.gg/mnbgN8f
if (!foundry.utils.isNewerVersion(game.version ?? game.data.version, '0.8.9'))
{
// Add the FQL unique Quest data type to the Foundry core data types.
CONST.ENTITY_TYPES?.push(Quest.documentName);
CONST.ENTITY_LINK_TYPES?.push(Quest.documentName);

// Add the FQL Quest data type to CONFIG.
CONFIG[Quest.documentName] = {
entityClass: Quest,
documentClass: Quest,
collection: QuestCollection,
sidebarIcon: 'fas fa-scroll',
sheetClass: QuestPreview
};

// Add our QuestCollection to the game collections.
game.collections.set(Quest.documentName, new QuestCollection());
// Add our QuestCollection to the game collections.
game.collections.set(Quest.documentName, new QuestCollection());
}

// Initialize the in-memory QuestDB. Loads all quests that the user can see at this point.
await QuestDB.init();
Expand Down

0 comments on commit 7c77bb6

Please sign in to comment.