diff --git a/CHANGELOG.md b/CHANGELOG.md index c063a7f..dab5ab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,20 @@ ## Middle Kingdom - v10 branch +### Unreleased - December 6, 2022 +- [FEATURE] (Lupestro) Updated README for clarity in creating user settings. (Issue #27 - many participants) +- [FEATURE] (Lupestro) Improved and simplified source JSON syntax with defaults for most fields. (Issue #27 - many participants) + * This change shouldn't invalidate any existing light source JSON files. +- [FEATURE] (Lupestro) Introduced aliases to JSON to give new names to light sources defined elsewhere. + * Using this in a very simple custom JSON will make this module more useful to those who play in a non-English language. +- [FEATURE] (Lupestro) Provided aliases for dnd5e light sources that should provide smoother integration with ddb-importer. (Issues raised by MrPrimate and emmoth) +- [FEATURE] (Lupestro) Improved name and description of options for consuming torches, candles, etc. to avoid confusion. (In response to comments by vgeirnaert) + +I'm looking at loading localized language JSON files for the out-of-the-box sources on startup in a future release. This will need the actual (i.e. matching letter-by-letter) light source names used in various games when played in different languages. Contact me if you play with light sources in another language and you're interested in helping out. + ### 2.1.4 - December 4, 2022 - - [BUGFIX] DnD5e Bullseye Lantern had wrong dim/bright ranges due to copy/paste error. - - [BUGFIX] Bullseye lanterns in all systems that had 53 degree radius, now have 57 degree radius. + - [BUGFIX] (Lupestro) DnD5e Bullseye Lantern had wrong dim/bright ranges due to copy/paste error. (Issue reported by Fragmenri. Thanks!) + - [BUGFIX] (Lupestro) Bullseye lanterns in all systems that had 53 degree radius, now have 57 degree radius. * 53 degrees is technically correct for a cone (n units wide at center distance n, per rules). * 57 degrees (1 radian) would be correct for a (spherical) sector of radius n and arc length n. * Foundry projects light radially, so you get a spherical sector, regardless of the game rules. @@ -13,13 +24,13 @@ * You can always reduce it back to 53 degrees with a custom JSON, of course, if you feel strongly about it. ### 2.1.3 - October 8, 2022 - - [BUGFIX] Corrected issue (found by vkdolea) where user-supplied sources for new systems weren't processing properly. - - [BUGFIX] Now pulling non-dim/bright light properties for the light source configured in settings from the prototype token. - - [BUGFIX] Fixed the translation files for several languages. + - [BUGFIX] (Lupestro) Corrected issue (found by vkdolea) where user-supplied sources for new systems weren't processing properly. + - [BUGFIX] (Lupestro) Now pulling non-dim/bright light properties for the light source configured in settings from the prototype token. (Issue reported by Jensenator360) + - [BUGFIX] (Lupestro) Fixed the translation files for several languages. ### 2.1.2 - September 14, 2022 - - [BUGFIX] Fixed image used for dancing lights - - [BUGFIX] Reset precedence order to user-supplied light sources first, then the source in config settings, then module-provided defaults based on game rules. + - [BUGFIX] (Lupestro) Fixed image used for dancing lights + - [BUGFIX] (Lupestro) Reset precedence order to user-supplied light sources first, then the source in config settings, then module-provided defaults based on game rules. ### 2.1.1 - September 6, 2022 - [BUGFIX] (Lupestro) Fixed issue where unlinked tokens were adjusting inventory on source token. diff --git a/README.md b/README.md index 46741e1..f07b9e6 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This module just sheds light from the location of a player token upon demand bas Because the light source to use is now user-configurable, we no longer select a light source for you based on fallbacks. As it stands, if you do not explicitly select your light source, it will pick any among the light sources you have equipped, in no particular order. ## Customizing light sources -You can supersede these settings or supply settings for your own light sources for any system with a JSON file, which you can deliver through the "Additional Light Sources" setting. The following shows a fully specified light source: +You can supersede these settings or supply settings for your own light sources for any system with a JSON file, which you can deliver through the "Additional Light Sources" setting. The following shows a fully specified light source and a couple of aliases: ```json { "dnd5e": { @@ -30,8 +30,8 @@ You can supersede these settings or supply settings for your own light sources f "topology": "standard", "quantity" : "quantity", "aliases": { - "Bullseye Lantern": "Lantern (Bullseye)", - "Hooded Lantern": "Lantern (Hooded)" + "Lantern (Bullseye)": "Bullseye Lantern", + "Lantern (Hooded)": "Hooded Lantern" } "sources": { "Candle": { @@ -78,8 +78,8 @@ The JSON has one top-level property per system, keyed by the Foundry id of the s * If you supply a single object rather than an array of objects, the module will treat it as an array of one item, (a light source with a single "on" state, the most common condition), and `states` will default to 2. * The `aliases` property lets you specify alternate names for existing sources. Each entry has a key and a value: - * The key is the name of the existing source that the alias will duplicate. - * The value is the name of the new source as a string. + * The key is the new name of the source . + * The value is the name (as a string) of the existing source being duplicated. * The source you duplicate with a new name can either be one of the predefined sources or one of the sources from the same user settings. ### Determining your system's id, topology, and quantity diff --git a/library.js b/library.js index 0b3e0e7..f5770a0 100644 --- a/library.js +++ b/library.js @@ -56,8 +56,8 @@ export default class SourceLibrary { } let sources = library[system].sources; let aliases = library[system].aliases; - for (const aliasref in aliases) { - let alias = aliases[aliasref]; + for (const alias in aliases) { + let aliasref = aliases[alias]; let aliasedSource = sources[aliasref] ? sources[aliasref] : ref && ref.sources[aliasref] ? ref.sources[aliasref] : null; if (aliasedSource) { sources[alias] = Object.assign({}, aliasedSource, {name: alias}); diff --git a/sources.json b/sources.json index 2d38122..3ebf3a6 100644 --- a/sources.json +++ b/sources.json @@ -4,8 +4,8 @@ "topology": "standard", "quantity" : "quantity", "aliases": { - "Hooded Lantern": "Lantern, Hooded", - "Bullseye Lantern": "Lantern, Bullseye" + "Lantern, Hooded": "Hooded Lantern", + "Lantern, Bullseye": "Bullseye Lantern" }, "sources": { "Candle": { diff --git a/test/common-library-tests.js b/test/common-library-tests.js index 1511f6a..4c00154 100644 --- a/test/common-library-tests.js +++ b/test/common-library-tests.js @@ -11,8 +11,8 @@ export let torchCommonLibraryTests = (context) => { other: { light: [ {bright: 10, dim: 20, angle: 360} ] } }, aliases: { - nuke: "bomb", - other: "alt" + bomb: "nuke", + alt: "other" } } } @@ -51,7 +51,7 @@ export let torchCommonLibraryTests = (context) => { other: { light: [ {bright: 10, dim: 20, angle: 360} ] } }, aliases: { - special: "crazy" + crazy: "special" } } };