Skip to content

Commit 12780ad

Browse files
authored
V2.0.0 (#6)
* v1.0.6 * Safety first * v2.0.0 rewrite
1 parent 31823cd commit 12780ad

File tree

10 files changed

+1339
-289
lines changed

10 files changed

+1339
-289
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## v2.0.0
4+
5+
- Major rewrite of how the module is accessed.
6+
- Scene Packer now supports more than one ScenePacker enabled module in a world. Previously they would conflict with each other and cause issues.
7+
- DEPRECATED: Calls to `window['scene-packer']` have been deprecated in favour of a global `ScenePacker` object.
8+
- View the Readme for the new way to initialise Scene Packer.
9+
- `ScenePacker.Initialise({...});`
10+
- `ScenePacker.RelinkJournalEntries('module-name', {dryRun: true});`
11+
- `ScenePacker.PromptRelinkJournalEntries();`
12+
- `ScenePacker.HasPackedData(scene, moduleName);`
13+
- `ScenePacker['module-name'];`
14+
- etc.
15+
- Made the `Enable Scene Packer context menu` setting appear under `Library: Scene Packer` rather than the module utilising Scene Packer.
16+
- Packing a Scene will now store the initial view position of the Scene. Unpacking a Scene will use this value rather than defaulting to 0, 0 and a zoom of 1.
17+
- The Welcome Journal will now only show once per module version, rather than once per imported Scene. Upgrading the version of your module will redisplay the Welcome Journal (allowing you to show Changelogs etc.).
18+
- Added [libWrapper](https://foundryvtt.com/packages/lib-wrapper/) to set the `sourceId` value of entities imported from compendiums in versions of FoundryVTT prior to 0.8.0 (which does it by default).
19+
- This allows appropriate tracking and linking of entities imported.
20+
- Unpacking a Scene will show its associated Journal entry to an authorised person. Generally this is just the GM unless your Journal has different permissions.
21+
- Journal sheets will not automatically appear if you use the "Import All" option on the dialog you receive when first enabling a "packed" module.
22+
- Packing and Unpacking a Scene will prioritise matching based on `sourceId`'s for exact matches, rather than by name (it will still fall back to name based matching).
23+
- Before unpacking a Scene, a check will be made to ensure the Scene was packed with a compatible version of Scene Packer.
24+
- Added a performance report dialog option. Trigger it with `ScenePacker.ShowPerformanceReport();` or via the Macro in the compendium.
25+
- This can be useful when building your Scenes to get an idea of how "heavy" they are.
26+
- Removed warning about remembering to Unpack after Packing. It's no longer needed. Unpacking a Scene over the top of itself won't cause any problems.
27+
328
## v1.0.5
429

530
- Added "How to use" style journals to the Scene Packer compendium.

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ A library to help other developers package up Scenes and Adventures to solve the
66

77
- Scene Journal Pins link to the correct Journal
88
- Actor tokens on a Scene link to the correct Actor
9+
- Imported Journals link to their correct Journal entry
910
- Relink journal entries to compendium entities (to automatically fix the broken links after exporting from your World to your Compendium)
1011

12+
In summary, it makes importing a Scene from a Compendium (via an "adventure module") work as though you build it in your world.
13+
14+
Scene Packer is system agnostic, it doesn't matter whether you're packaging up a D&D5e module, or a Pathfinder one, or an Alien RPG one, Scene Packer doesn't mind.
15+
1116
## Installation
1217

1318
In the setup screen, use the URL <https://raw.githubusercontent.com/League-of-Foundry-Developers/scene-packer/master/module.json> to install the module.
1419

1520
## Usage
1621

22+
There are several `Journal entries` bundled with Scene Packer. In them, you can find references on how to use Scene Packer both as a Developer and as a GM.
23+
1724
To use the Scene Packer as part of your module you will need to add it as a dependency in your `module.json` file.
1825

1926
```json
@@ -58,17 +65,20 @@ const creaturePacks = [`${moduleName}.actors`, 'dnd5e.monsters'];
5865
* Set to the following to disable:
5966
* const journalPacks = [];
6067
*/
61-
const journalPacks = [`${moduleName}.journals`];/**
68+
const journalPacks = [`${moduleName}.journals`];
69+
/**
6270
* macroPacks is a list of compendium packs to look in for Macros by name (in prioritised order).
6371
* The first entry here assumes that you have a Macro pack in your module with the "name" of "macros".
6472
* Set to the following to disable:
6573
* const macroPacks = [];
6674
*/
6775
const macroPacks = [`${moduleName}.macros`];
6876

69-
Hooks.once('scenePackerReady', ({ getInstance }) => {
77+
Hooks.once('scenePackerReady', ScenePacker => {
7078
// Initialise the Scene Packer with your adventure name and module name
71-
let packer = getInstance(adventureName, moduleName, {
79+
let packer = ScenePacker.Initialise({
80+
adventureName,
81+
moduleName,
7282
creaturePacks,
7383
journalPacks,
7484
macroPacks,
@@ -90,9 +100,6 @@ To pack your scene ready for distribution:
90100
5. Re-export your Journals to compendiums, be sure to select the "Merge By Name" option to prevent the IDs from changing (and therefore re-breaking the links)
91101
6. Right click on your Scene in the Scenes Directory and choose `Pack Scene Data`.
92102
7. Export your Scene to your compendium.
93-
8. Right click on your Scene in the Scenes Directory and choose `Clear Packed Scene Data`.
94-
95-
- You want to choose this otherwise next time you open your Scene locally it will run the Scene import scripts.
96103

97104
![scene-context-menu](scene-context-menu.png)
98105

@@ -101,7 +108,7 @@ To pack your scene ready for distribution:
101108
When you build an adventure module, it's a painful process updating all of your Journal references to link to the compendium versions. You can simplify this by running the following command in your browser console putting in your appropriate module name (as per your manifest json name):
102109

103110
```js
104-
await window['scene-packer'].relinkJournalEntries('module-name', {dryRun: false});
111+
await ScenePacker.RelinkJournalEntries('module-name', {dryRun: false});
105112
```
106113

107114
Alternatively, you can run the macro `Relink compendium journal entries` that is included in the Scene Packer compendium, which will prompt you for your module name and whether you want to run in "dry run" mode (not saving changes).
@@ -110,10 +117,21 @@ This will automatically go through the Journal compendiums that belong to your m
110117

111118
## TODO
112119

113-
- Provide example complete module
120+
- Provide complete example module
121+
- Support v0.8.x (Scene Packer does not currently work with v0.8.0 and above)
114122

115123
## Acknowledgements
116124

117125
A portion of the code is based on code created by [honeybadger](https://github.com/trioderegion) and used with permission.
118126

119127
Thanks to [Baileywiki](https://www.patreon.com/baileywiki) for their initial testing and feedback.
128+
129+
## Support
130+
131+
Please submit any issues via the [Bug Reporter](https://foundryvtt.com/packages/bug-reporter) module or via [GitHub Issues](https://github.com/League-of-Foundry-Developers/scene-packer/issues).
132+
133+
You can contact me on Discord `blair#9056` if you have questions, comments, queries, concerns etc.
134+
135+
If you are making money and utilising this module, please consider sending a few dollars my way and/or providing me with the cool adventures and modules you're building :)
136+
137+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/A0A0488MI)

languages/en.json

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
"dont-ask": "Don't ask me again"
2323
},
2424
"notifications": {
25-
"first-launch": "First launch of this adventure! Unpacking scene...",
25+
"first-launch": "First launch of this Scene! Unpacking scene...",
2626
"done": "All done!",
2727
"pack-scene": {
28-
"clear-reminder": "Don't forget to \"Clear Packed Scene Data\" after exporting to prevent future duplicates.",
2928
"writing-journals": "Writing {number} journals to scene: {name}",
3029
"no-journal-pins": "No journal pins detected on the scene.",
3130
"no-token-name-warning": "Cannot pack a token that has no name. Check debug logs for details.",
3231
"no-token-name-log": "Trying to pack a token that has no name is not going to end well. Please ensure the Token and Actor have a name.",
3332
"no-journal-link-warning": "Cannot pack a journal pin that does not link to a valid journal entry. Journal pin is called: \"{pin}\". Check debug logs for details.",
3433
"no-journal-link-log": "Trying to pack a journal pin that does not link to a journal entry is not going to end well. Please ensure the pin \"{pin}\" is linked correctly.",
3534
"writing-tokens": "Writing {number} tokens to scene: {name}",
36-
"no-tokens": "No tokens detected on the scene."
35+
"no-tokens": "No tokens detected on the scene.",
36+
"already-shown-welcome": "The welcome journal \"{journal}\" has already been shown for this version \"{version\"."
3737
},
3838
"import-by-name": {
3939
"creating-data": "Importing {count} new {type}.",
@@ -47,6 +47,18 @@
4747
"missing-pack-details": "ImportByName was called to search for pack \"{packName}\" which is not found. Check for typos in your module setup."
4848
}
4949
},
50+
"find-journal-compendium": {
51+
"no-match": "Could not find a Journal entry named \"{journal}\" in the compendiums.",
52+
"invalid-index": "Error loading journal content from compendium. Check debug logs for details.",
53+
"missing-pack": "Invalid pack configuration. Cannot find compendium {packName}. Check console for more details.",
54+
"missing-pack-details": "FindJournalInCompendiums was called to search for pack \"{packName}\" which is not found. Check for typos in your module setup."
55+
},
56+
"find-actor-compendium": {
57+
"no-match": "Could not find an Actor entry named \"{actor}\" in the compendiums.",
58+
"invalid-index": "Error loading actor content from compendium. Check debug logs for details.",
59+
"missing-pack": "Invalid pack configuration. Cannot find compendium {packName}. Check console for more details.",
60+
"missing-pack-details": "FindActorInCompendiums was called to search for pack \"{packName}\" which is not found. Check for typos in your module setup."
61+
},
5062
"find-actor": {
5163
"missing-name": "Cannot find a token that has no name. Check debug logs for details.",
5264
"missing-name-details": "Trying to find a token that has no name is not going to end well. Please ensure the Token and Actor have a name prior to packing."
@@ -61,9 +73,6 @@
6173
"missing-details": "Could not find {count} notes to spawn. The following journals were not found.",
6274
"spawning": "Spawning {count} journal notes."
6375
},
64-
"unpack": {
65-
"no-items": "No items to configure. All done!"
66-
},
6776
"clear-data": {
6877
"done": "Finished clearing Packed Data."
6978
},
@@ -92,6 +101,13 @@
92101
"ui": "Invalid call to SetModuleName(). See console for details.",
93102
"details": "Invalid module name passed to \"SetModuleName()\". This must be the name of the module as defined in module.json under the \"name\" field."
94103
},
104+
"instance": {
105+
"ui": "Invalid call to ScenePacker. See console for details.",
106+
"details": "Invalid module name or method passed to \"ScenePacker\". The module name must be as defined in module.json under the \"name\" field. Ensure that the names are correct and that your module has initialised ScenePacker correctly - see Journal entries in the compendium for assistance."
107+
},
108+
"version": {
109+
"packed-low": "The scene \"{scene}\" (from module \"{sourceModule}\") was packed with Scene Packer version \"{version}\" which is older than the minimum compatible version of \"{supportedVersion}\". Please contact the author and ask them to re-Pack the Scene with a current version."
110+
},
95111
"welcomeJournal": {
96112
"ui": "Invalid call to SetWelcomeJournal(). See console for details.",
97113
"details": "Invalid journal name passed to \"SetWelcomeJournal()\". This must be the name of a journal in the module compendium.",
@@ -139,13 +155,29 @@
139155
"completed": "Completed!"
140156
}
141157
},
158+
"instance-prompt": {
159+
"title": "Select instance",
160+
"intro": "Select the module that you want to Pack against:",
161+
"none-found": "There are no modules installed that have registered with Scene Packer. See the Journal entries in the compendium for how to register your module with Scene Packer.",
162+
"select": "Select",
163+
"cancel": "Cancel"
164+
},
142165
"relink-prompt": {
143166
"title": "Relink Journal Entries",
144167
"intro": "Select the module you are using Scene Packer with:",
145168
"make-changes": "Save changes?",
146169
"make-changes-info": "Leaving this unchecked will operate in a \"dry run\" mode, where changes are only output to the console.",
147170
"relink": "Relink",
148-
"cancel": "Cancel"
171+
"cancel": "Cancel",
172+
"none": "There are no modules initialised with Scene Packer in this world."
173+
},
174+
"performance-report": {
175+
"title": "Performance Report",
176+
"copy": "Copy to clipboard",
177+
"close": "Close"
178+
},
179+
"deprecated": {
180+
"method": "The method \"{method}\" has been deprecated and will be removed in a future version. Please see the Journal entries in the Scene Packer compendium on how to correctly call Scene Packer."
149181
}
150182
}
151183
}

module.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "scene-packer",
33
"title": "Library: Scene Packer",
44
"description": "A module to assist with Scene and Adventure packing and unpacking.",
5-
"version": "1.0.5",
5+
"version": "2.0.0",
66
"library": "true",
77
"manifestPlusVersion": "1.0.0",
88
"minimumCoreVersion": "0.7.9",
@@ -15,7 +15,8 @@
1515
},
1616
{
1717
"name": "Blair McMillan",
18-
"discord": "blair#9056"
18+
"discord": "blair#9056",
19+
"ko-fi": "blairm"
1920
}
2021
],
2122
"packs": [
@@ -33,7 +34,8 @@
3334
}
3435
],
3536
"esmodules": [
36-
"/scripts/scene-packer.js"
37+
"/scripts/scene-packer.js",
38+
"/scripts/wrapped.js"
3739
],
3840
"languages": [
3941
{

0 commit comments

Comments
 (0)