diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b629b..f549c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Middle Kingdom - v10 branch +### 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. + ### 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. diff --git a/lang/cn.json b/lang/cn.json index 5c5c0da..1506f61 100644 --- a/lang/cn.json +++ b/lang/cn.json @@ -1,4 +1,5 @@ { + "I18N.LANGUAGE": "中文", "I18N.MAINTAINERS": ["Chivell"], "torch.playerTorches.name": "玩家火炬", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 8901593..e4fb12d 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -1,4 +1,5 @@ { + "I18N.LANGUAGE": "Português (Brasil)", "I18N.MAINTAINERS": ["Innocenti"], "torch.playerTorches.name": "Tocha dos jogadores", diff --git a/lang/zh-TW.json b/lang/zh-TW.json index 9a66d3c..8181469 100644 --- a/lang/zh-TW.json +++ b/lang/zh-TW.json @@ -1,4 +1,5 @@ { + "I18N.LANGUAGE": "正體中文", "I18N.MAINTAINERS": ["Chivell"], "torch.playerTorches.name": "玩家火炬", diff --git a/library.js b/library.js index d38b386..fc3232e 100644 --- a/library.js +++ b/library.js @@ -9,17 +9,20 @@ export default class SourceLibrary { this.library = library; } - static async load(systemId, selfBright, selfDim, selfItem, userLibrary) { + static async load(systemId, selfBright, selfDim, selfItem, userLibrary, protoLight) { // The common library is cached - to update it, you must reload the game. if (!SourceLibrary.commonLibrary) { SourceLibrary.commonLibrary = await fetch('/modules/torch/sources.json') .then( response => { return response.json(); }); } + let defaultLight = Object.assign({}, protoLight); + defaultLight.bright = selfBright; + defaultLight.dim = selfDim; let configuredLight = { system: systemId, name: selfItem, states: 2, - light: [ {bright: selfBright, dim:selfDim, angle:360} ] + light: [ defaultLight ] }; // The user library reloads every time you open the HUD to permit cut and try. let mergedLibrary = userLibrary ? await fetch(userLibrary) @@ -151,7 +154,7 @@ let mergeLibraries = function (userLibrary, commonLibrary, configuredLight) { break; } } - if (!inUserLibrary) { + if (!inUserLibrary && commonLibrary[system]) { for (let source in commonLibrary[system].sources) { if (source.toLowerCase() === configuredLight.name.toLowerCase()) { configuredName = source; @@ -169,7 +172,7 @@ let mergeLibraries = function (userLibrary, commonLibrary, configuredLight) { "type": template ? template["type"] :"equipment", "consumable": template ? template["consumable"] : true, "states": configuredLight.states, - "light": Object.assign({}, configuredLight.light ) + "light": configuredLight.light }; } } diff --git a/module.json b/module.json index 35d6fdc..a3a1031 100644 --- a/module.json +++ b/module.json @@ -1,58 +1,75 @@ { - "id": "torch", - "name": "torch", - "title": "Torch", - "description": "Torch HUD Controls", - "version": "2.1.2", - "authors": [{ "name": "Deuce"},{ "name": "Lupestro"}], - "languages": [ - { - "lang": "en", - "name": "English", - "path": "./lang/en.json" - }, - { - "lang": "cn", - "name": "中文", - "path": "./lang/cn.json" - }, - { - "lang": "de", - "name": "Deutsch", - "path": "./lang/de.json" - }, - { - "lang": "fr", - "name": "Français", - "path": "./lang/fr.json" - }, - { - "lang": "es", - "name": "Español", - "path": "./lang/es.json" - }, - { - "lang": "pt-br", - "name": "Português (Brasil)", - "path": "./lang/pt-BR.json" - }, - { - "lang": "zh-tw", - "name": "正體中文", - "path": "./lang/zh-TW.json" - } - ], - "esmodules": ["./torch.js"], - "socket": true, - "styles": ["./torch.css"], - "packs": [], - "manifest": "https://raw.githubusercontent.com/League-of-Foundry-Developers/torch/v10/module.json", - "download": "https://raw.githubusercontent.com/League-of-Foundry-Developers/torch/v10/torch.zip", - "url": "https://github.com/League-of-Foundry-Developers/torch", - "minimumCoreVersion": "10", - "compatibility": { - "minimum": "10", - "verified": "10.285", - "maximum": "10" - } -} + "id": "torch", + "title": "Torch", + "description": "Torch HUD Controls", + "version": "2.1.3", + "authors": [ + { + "name": "Deuce", + "flags": {} + }, + { + "name": "Lupestro", + "flags": {} + } + ], + "languages": [ + { + "lang": "en", + "name": "English", + "path": "lang/en.json", + "flags": {} + }, + { + "lang": "cn", + "name": "中文", + "path": "lang/cn.json", + "flags": {} + }, + { + "lang": "de", + "name": "Deutsch", + "path": "lang/de.json", + "flags": {} + }, + { + "lang": "fr", + "name": "Français", + "path": "lang/fr.json", + "flags": {} + }, + { + "lang": "es", + "name": "Español", + "path": "lang/es.json", + "flags": {} + }, + { + "lang": "pt-BR", + "name": "Português (Brasil)", + "path": "lang/pt-BR.json", + "flags": {} + }, + { + "lang": "zh-TW", + "name": "正體中文", + "path": "lang/zh-TW.json", + "flags": {} + } + ], + "esmodules": [ + "torch.js" + ], + "socket": true, + "styles": [ + "torch.css" + ], + "manifest": "https://raw.githubusercontent.com/League-of-Foundry-Developers/torch/v10/module.json", + "download": "https://raw.githubusercontent.com/League-of-Foundry-Developers/torch/v10/torch.zip", + "url": "https://github.com/League-of-Foundry-Developers/torch", + "compatibility": { + "minimum": "10", + "verified": "10.287", + "maximum": "10" + } +} \ No newline at end of file diff --git a/test/tickets/issue-26/user-sources.json b/test/tickets/issue-26/user-sources.json new file mode 100644 index 0000000..d17e0a5 --- /dev/null +++ b/test/tickets/issue-26/user-sources.json @@ -0,0 +1,32 @@ +{ + "age-system": { + "system": "age-system", + "topology": "standard", + "quantity" : "quantity", + "sources": { + "Lanterna": { + "name": "Lanterna", + "type": "equipment", + "consumable": false, + "states": 2, + "light": [ + { + "bright": 10, "dim": 15, "angle": 30, "color": "#ff9329", "alpha": 0.5, + "animation": { "type": "torch", "speed": 5, "intensity": 5, "reverse": false } + } + ] + }, + "Visão Noturna": { + "name": "Visão Noturna", + "type": "equipment", + "consumable": false, + "states": 2, + "light": [{ + "bright": 1000, "dim": 1000, "angle": 360, "color": "#184601", "alpha": 0.4, + "animation": { "type": "none", "speed": 5, "intensity": 5, "reverse": false }, + "light": {"luminosity": 0.3} + }] + } + } + } +} \ No newline at end of file diff --git a/torch.js b/torch.js index 554521c..d18d3f8 100644 --- a/torch.js +++ b/torch.js @@ -31,6 +31,7 @@ class Torch { Settings.lightRadii.dim, Settings.inventoryItemName, Settings.gameLightSources, + hud.object.actor.prototypeToken.light, ); let token = new TorchToken(hud.object.document, library); let lightSources = token.ownedLightSources; diff --git a/torch.zip b/torch.zip index 5073007..c33db5d 100644 Binary files a/torch.zip and b/torch.zip differ