Skip to content

Commit

Permalink
Three bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lupestro committed Oct 9, 2022
1 parent 60a46bb commit 2dd5228
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 61 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions lang/cn.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"I18N.LANGUAGE": "中文",
"I18N.MAINTAINERS": ["Chivell"],

"torch.playerTorches.name": "玩家火炬",
Expand Down
1 change: 1 addition & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"I18N.LANGUAGE": "Português (Brasil)",
"I18N.MAINTAINERS": ["Innocenti"],

"torch.playerTorches.name": "Tocha dos jogadores",
Expand Down
1 change: 1 addition & 0 deletions lang/zh-TW.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"I18N.LANGUAGE": "正體中文",
"I18N.MAINTAINERS": ["Chivell"],

"torch.playerTorches.name": "玩家火炬",
Expand Down
11 changes: 7 additions & 4 deletions library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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
};
}
}
Expand Down
131 changes: 74 additions & 57 deletions module.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
32 changes: 32 additions & 0 deletions test/tickets/issue-26/user-sources.json
Original file line number Diff line number Diff line change
@@ -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}
}]
}
}
}
}
1 change: 1 addition & 0 deletions torch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file modified torch.zip
Binary file not shown.

0 comments on commit 2dd5228

Please sign in to comment.