diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe45a6..f8a4c42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Middle Kingdom - v10 -> main branch +### 2.18.0 - January 12, 2025 - Dim/Bright config is now purely fallback +- [FEATURE] Eliminated confusing name/bright/dim override setting. + * On systems that have no sources configured, a source with this name and those light values becomes the sole source. + * On systems that have sources configured, the name specifies which source to use by default, rather than "just picking one." (The dim/bright values are completely ignored on these systems.) + ### 2.17.0 - January 11, 2025 - Ignore Equipment flag - [FEATURE] New config flag to completely ignore user equipment. Users can turn on any light source defined for the system. - [FEATURE] Rearranged config settings in preparation for give the last three settings a clearer role. diff --git a/README.md b/README.md index 7b1e74e..41740b5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Torch module for Foundry VTT -This module provides a HUD toggle button for turning on and off a configurable radius of bright and dim light around you. This default source ("Self") is provided for any system for which we don't supply more specialized capabilities. (The bright and dim settings in the configuration are intended for use only in this case.) +This module provides a HUD toggle button for turning on and off a configurable radius of bright and dim light around you. A default source can be configured in settings for any system for which we don't supply more specialized capabilities. However, we now have a variety of core light sources configured for D&D 5th Ed, Savage Worlds, Pathfinder 1st and 2nd editions, GURPS, and Earthdawn. You can select which light source the button will manipulate by right-clicking and clicking the desired source from the menu of buttons that appear for light sources in the actor's inventory or spell list. @@ -45,7 +45,7 @@ Besides the user light source file described in the following section: It all depends how you want to run your game. -And, again, the bright and dim light settings are intended only as a fallback for use when you are playing in a system where nobody has supplied a set of light sources. (Ignore the name setting right above it. That is imminently about to go away.) +The bright and dim light settings are intended only as a fallback for use when you are playing in a system where nobody has supplied a set of light sources. The settings will appear with the light source name specified with them. (In systems which *do* have a set of light sources, the fallback name identifies the source to use if the user hasn't yet selected a light source.) ## Customizing light sources @@ -211,15 +211,15 @@ The following is the current status of translation. Some features have arrived, | Language | Completion | Contributors | | -------- | ---------- | ------------ | -| de | `[######################]` 22/23 (96%) | ToGreedy, Beff42 | -| en | `[######################]` 23/23 (100%) | deuce, lupestro | -| es | `[######################]` 22/23 (96%) | lozanoje, WallaceMcGregor | -| fr | `[##################----]` 18/23 (78%) | Aymeeric | -| it | `[######################]` 22/23 (96%) | GregoryWarn | -| ja | `[######################]` 22/23 (96%) | doumoku | -| pt-br | `[######################]` 22/23 (96%) | Innocenti, Andersants | -| zh-cn | `[##########------------]` 10/23 (43%) | xticime | -| zh-tw | `[############----------]` 12/23 (52%) | zeteticl | +| de | `[################--------]` 16/24 (67%) | ToGreedy, Beff42 | +| en | `[########################]` 24/24 (100%) | deuce, lupestro | +| es | `[################--------]` 16/24 (67%) | lozanoje, WallaceMcGregor | +| fr | `[############------------]` 12/24 (50%) | Aymeeric | +| it | `[################--------]` 16/24 (67%) | GregoryWarn | +| ja | `[################--------]` 16/24 (67%) | doumoku | +| pt-br | `[################--------]` 16/24 (67%) | Innocenti, Andersants | +| zh-cn | `[######------------------]` 06/24 (25%) | xticime | +| zh-tw | `[########----------------]` 08/24 (33%) | zeteticl | PRs for further translations will be dealt with promptly. While Korean is most especially desired (thank you, doumoku for Japanese, also on the short list) - all others are welcome. diff --git a/lang/cn.json b/lang/cn.json index 736c8c8..13571a4 100644 --- a/lang/cn.json +++ b/lang/cn.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "中文", "I18N.MAINTAINERS": ["Chivell"], - "torch.playerTorches.name": "玩家火炬", - "torch.playerTorches.hint": "允许玩家自行开关自己的火炬。", - "torch.brightRadius.hint": "发出多少格单位的亮光。", - "torch.dimRadius.hint": "发出多少格单位的微光。", - "torch.gmUsesInventory.name": "使用库存", - "torch.gmUsesInventory.hint": "当GM开关火炬时,将使用角色库存。", - "torch.gmInventoryItemName.name": "Inventory item name to use", - "torch.gmInventoryItemName.hint": "Name of the inventory item to use if \"GM Uses Inventory\" is set.", - "torch.turnOffAllLights": "强制亮/微光设置为OFF", - "torch.holdCtrlOnClick": "按住 Ctrl 点击", - "torch.dancingLightVision.name": "Give Dancing Lights Vision.", - "torch.dancingLightVision.hint": "When enabled, each dancing light has vision so can be used to reveal areas of the map players can't actually see.", - "torch.playerUsesInventory.name": "Player Uses Inventory", - "torch.playerUsesInventory.hint": "If set, when the player toggles a torch, it will use the actors inventory.", - "torch.gameLightSources.name": "Additional Light Sources", - "torch.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", - "torch.brightRadius.name": "Bright Light Radius", - "torch.dimRadius.name": "Dim Light Radius", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Additional Light Sources", + "torch.settings.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", + "torch.settings.playerTorches.name": "玩家火炬", + "torch.settings.playerTorches.hint": "允许玩家自行开关自己的火炬。", + "torch.settings.gmUsesInventory.name": "使用库存", + "torch.settings.gmUsesInventory.hint": "当GM开关火炬时,将使用角色库存。", + "torch.settings.playerUsesInventory.name": "Player Uses Inventory", + "torch.settings.playerUsesInventory.hint": "If set, when the player toggles a torch, it will use the actors inventory.", + "torch.settings.dancingLightVision.name": "Give Dancing Lights Vision.", + "torch.settings.dancingLightVision.hint": "When enabled, each dancing light has vision so can be used to reveal areas of the map players can't actually see.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "强制亮/微光设置为OFF", + "torch.help.holdCtrlOnClick": "按住 Ctrl 点击", "torch.help.supplyExhausted.title": "Supply Exhausted", "torch.help.supplyExhausted.body": "
Your light source is consumable and your quantity has dropped to zero. Increase the quantity of the item to light a fresh one.
", "torch.help.setupSources.title": "Setting Up Light Sources", diff --git a/lang/de.json b/lang/de.json index f99dd82..7de1e13 100644 --- a/lang/de.json +++ b/lang/de.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "Deutsch", "I18N.MAINTAINERS": ["ToGreedy"], - "torch.playerTorches.name": "Spieler Fackeln", - "torch.playerTorches.hint": "Erlaubt es Spielern, ihre eigenen Fackeln umzuschalten.", - "torch.brightRadius.hint": "Wie viele Rastereinheiten helles Licht sollen ausgestrahlt werden.", - "torch.dimRadius.hint": "Wie viele Rastereinheiten gedämpftes Licht sollen ausgestrahlt werden.", - "torch.gmUsesInventory.name": "GM verwendet Inventar", - "torch.gmUsesInventory.hint": "Wenn diese Option gesetzt ist, verwendet der GM beim Umschalten einer Fackel das Inventar des Spielers.", - "torch.gmInventoryItemName.name": "Name des Inventargegenstandes", - "torch.gmInventoryItemName.hint": "Name des zu verwendenden Inventargegenstandes, wenn \"GM verwendet Inventar\" eingestellt ist.", - "torch.turnOffAllLights": "Erzwingen Sie Hell- und Dimmwerte für die konfigurierten Werte \"Aus\".", - "torch.holdCtrlOnClick": "Halte Ctrl beim Klick", - "torch.dancingLightVision.name": "Sicht für \"Dancing Lights\".", - "torch.dancingLightVision.hint": "Wenn diese Option gesetzt ist, hat jedes \"Dancing Light\" sicht und kann dazu verwendet werden, Bereiche der Karte aufzudecken, die Spieler nicht sehen können.", - "torch.playerUsesInventory.name": "Spieler verwendet Inventar", - "torch.playerUsesInventory.hint": "Wenn diese Option gesetzt ist, verwendet der Spieler beim Umschalten einer Fackel sein Inventar.", - "torch.gameLightSources.name": "Zusätzliche Lichtquellen", - "torch.gameLightSources.hint": "JSON Datei mit zusätzlichen Lichtquellen, die über die mitgelieferten hinaus verwendet werden sollen", - "torch.brightRadius.name": "Radius des hellen Lichts", - "torch.dimRadius.name": "Radius des gedämpften Lichts", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Zusätzliche Lichtquellen", + "torch.settings.gameLightSources.hint": "JSON Datei mit zusätzlichen Lichtquellen, die über die mitgelieferten hinaus verwendet werden sollen", + "torch.settings.playerTorches.name": "Spieler Fackeln", + "torch.settings.playerTorches.hint": "Erlaubt es Spielern, ihre eigenen Fackeln umzuschalten.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "GM verwendet Inventar", + "torch.settings.gmUsesInventory.hint": "Wenn diese Option gesetzt ist, verwendet der GM beim Umschalten einer Fackel das Inventar des Spielers.", + "torch.settings.playerUsesInventory.name": "Spieler verwendet Inventar", + "torch.settings.playerUsesInventory.hint": "Wenn diese Option gesetzt ist, verwendet der Spieler beim Umschalten einer Fackel sein Inventar.", + "torch.settings.dancingLightVision.name": "Sicht für \"Dancing Lights\".", + "torch.settings.dancingLightVision.hint": "Wenn diese Option gesetzt ist, hat jedes \"Dancing Light\" sicht und kann dazu verwendet werden, Bereiche der Karte aufzudecken, die Spieler nicht sehen können.", + "torch.settings.fallbackSourceName.name": "Fallback Item Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Erzwingen Sie Hell- und Dimmwerte für die konfigurierten Werte \"Aus\".", + "torch.help.holdCtrlOnClick": "Halte Ctrl beim Klick", "torch.help.supplyExhausted.title": "Vorrat erschöpft", "torch.help.supplyExhausted.body": "Die Lichtquelle ist ein Verbrauchsgegenstand und es sind keine Gegenstände mehr übrig. Erhöhe die Anzahl der Gegenstände, um eine neue zu entzünden.
", "torch.help.setupSources.title": "Konfiguration von Lichtquellen", diff --git a/lang/en.json b/lang/en.json index 1d1188f..1f48bc5 100644 --- a/lang/en.json +++ b/lang/en.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "English", "I18N.MAINTAINERS": ["Lupestro"], - "torch.playerTorches.name": "Player Torches", - "torch.playerTorches.hint": "Allow players to toggle their own torches.", - "torch.brightRadius.hint": "How many grid units of bright light to emit.", - "torch.dimRadius.hint": "How many grid units of dim light to emit.", - "torch.gmUsesInventory.name": "GM Consumes Inventory", - "torch.gmUsesInventory.hint": "If set, when the GM toggles a torch, it will reduce the actor's inventory.", - "torch.gmInventoryItemName.name": "Inventory item name to use", - "torch.gmInventoryItemName.hint": "Name of the inventory item to consume if \"GM Consumes Inventory\" is set.", - "torch.turnOffAllLights": "Force bright and dim to configured \"off\" values.", - "torch.holdCtrlOnClick": "Hold Ctrl on Click", - "torch.dancingLightVision.name": "Give Dancing Lights Vision.", - "torch.dancingLightVision.hint": "When enabled, each dancing light has vision so can be used to reveal areas of the map players can't actually see.", - "torch.playerUsesInventory.name": "Player Consumes Inventory", - "torch.playerUsesInventory.hint": "If set, when the player toggles a torch, it will reduce the actor's inventory.", - "torch.gameLightSources.name": "Additional Light Sources", - "torch.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", - "torch.brightRadius.name": "Bright Light Radius", - "torch.dimRadius.name": "Dim Light Radius", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Additional Light Sources", + "torch.settings.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", + "torch.settings.playerTorches.name": "Player Torches", + "torch.settings.playerTorches.hint": "Allow players to toggle their own torches.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "GM Consumes Inventory", + "torch.settings.gmUsesInventory.hint": "If set, when the GM toggles a torch, it will reduce the actor's inventory.", + "torch.settings.playerUsesInventory.name": "Player Consumes Inventory", + "torch.settings.playerUsesInventory.hint": "If set, when the player toggles a torch, it will reduce the actor's inventory.", + "torch.settings.dancingLightVision.name": "Give Dancing Lights Vision.", + "torch.settings.dancingLightVision.hint": "When enabled, each dancing light has vision so can be used to reveal areas of the map players can't actually see.", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Force bright and dim to configured \"off\" values.", + "torch.help.holdCtrlOnClick": "Hold Ctrl on Click", "torch.help.supplyExhausted.title": "Supply Exhausted", "torch.help.supplyExhausted.body": "Your light source is consumable and your quantity has dropped to zero. Increase the quantity of the item to light a fresh one.
", "torch.help.setupSources.title": "Setting Up Light Sources", diff --git a/lang/es.json b/lang/es.json index 58297a6..e472f49 100644 --- a/lang/es.json +++ b/lang/es.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "Español", "I18N.MAINTAINERS": ["Deuce", "@Viriato139ac#0342"], - "torch.playerTorches.name": "Antorchas de los jugadores", - "torch.playerTorches.hint": "Permite que los jugadores activen y desactiven sus propias antorchas", - "torch.brightRadius.hint": "Número de unidades en la rejilla en las que se emite luz brillante", - "torch.dimRadius.hint": "Número de unidades en la rejilla en las que se emite luz tenue", - "torch.gmUsesInventory.name": "El GM consume el inventario", - "torch.gmUsesInventory.hint": "Si se activa, cuando el GM activa una antorcha, reducirá el inventario del actor.", - "torch.gmInventoryItemName.name": "Nombre del objeto en el inventario", - "torch.gmInventoryItemName.hint": "Nombre del objeto en el inventario que se consume cuando se activa \"El GM consume el inventario\"", - "torch.turnOffAllLights": "Forzar a valores \"off\" tanto en la emisión brillante como en la tenue", - "torch.holdCtrlOnClick": "Mantener pulsado CTRL al hacer clic", - "torch.dancingLightVision.name": "Dar visión a las luces danzantes", - "torch.dancingLightVision.hint": "Cuando se activa, cada luz danzante tendrá visión, por lo que puede utilizarse para revelar zonas del mapa que los jugadores no pueden ver.", - "torch.playerUsesInventory.name": "El jugador consume el inventario", - "torch.playerUsesInventory.hint": "Si se activa, cuando el jugador activa una antorcha, reducirá el inventario del actor.", - "torch.gameLightSources.name": "Fuentes de luz adicionales", - "torch.gameLightSources.hint": "Archivo JSON que contiene fuentes de luz adicionales a las especificadas", - "torch.brightRadius.name": "Radio de luz brillante", - "torch.dimRadius.name": "Radio de luz tenue", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Fuentes de luz adicionales", + "torch.settings.gameLightSources.hint": "Archivo JSON que contiene fuentes de luz adicionales a las especificadas", + "torch.settings.playerTorches.name": "Antorchas de los jugadores", + "torch.settings.playerTorches.hint": "Permite que los jugadores activen y desactiven sus propias antorchas", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "El GM consume el inventario", + "torch.settings.gmUsesInventory.hint": "Si se activa, cuando el GM activa una antorcha, reducirá el inventario del actor.", + "torch.settings.playerUsesInventory.name": "El jugador consume el inventario", + "torch.settings.playerUsesInventory.hint": "Si se activa, cuando el jugador activa una antorcha, reducirá el inventario del actor.", + "torch.settings.dancingLightVision.name": "Dar visión a las luces danzantes", + "torch.settings.dancingLightVision.hint": "Cuando se activa, cada luz danzante tendrá visión, por lo que puede utilizarse para revelar zonas del mapa que los jugadores no pueden ver.", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Forzar a valores \"off\" tanto en la emisión brillante como en la tenue", + "torch.help.holdCtrlOnClick": "Mantener pulsado CTRL al hacer clic", "torch.help.supplyExhausted.title": "Suministro agotado", "torch.help.supplyExhausted.body": "Tu fuente de luz es consumible y su cantidad ha bajado a cero. Aumenta la cantidad del objeto para encender una nueva.
", "torch.help.setupSources.title": "Configuración de las fuentes de luz", diff --git a/lang/fr.json b/lang/fr.json index 2a76067..c2dad0d 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "Français", "I18N.MAINTAINERS": ["Aymeeeric"], - "torch.playerTorches.name": "Autorisation des joueurs", - "torch.playerTorches.hint": "Autoriser les joueurs à allumer leurs propres torches.", - "torch.brightRadius.hint": "Détermine l'étendue (en unité de grille) de la lumière vive émise.", - "torch.dimRadius.hint": "Détermine l'étendue (en unité de grille) de la lumière faible émise.", - "torch.gmUsesInventory.name": "Activation par le MJ consomme l'inventaire", - "torch.gmUsesInventory.hint": "Si actif, lorsque une torche est allumée, elle sera déduite de l'inventaire du joueur cible.", - "torch.gmInventoryItemName.name": "Nom de l'objet à déduire de l'inventaire", - "torch.gmInventoryItemName.hint": "Préciser le nom de l'objet à déduire (si l'option est cochée) de l'inventaire des joueurs.", - "torch.turnOffAllLights": "Éteindre l'ensemble des lumières (vives et faibles).", - "torch.holdCtrlOnClick": "Maintenir Ctrl lors du clic.", - "torch.dancingLightVision.name": "Lumières dansantes", - "torch.dancingLightVision.hint": "Si actif, chaque lumière dansante est dotée d'une vision et peut donc être utilisée pour révéler des zones de la carte que les joueurs ne peuvent pas voir.", - "torch.playerUsesInventory.name": "Activation par le PJ consomme l'inventaire", - "torch.playerUsesInventory.hint": "Si actif, lorsque une torche est allumée, elle sera déduite de l'inventaire du joueur ayant activé sa torche.", - "torch.gameLightSources.name": "Sources de lumière additionnelles", - "torch.gameLightSources.hint": "Fichier JSON contenant des sources de lumière supplémentaires à utiliser en plus de celles fournies", - "torch.brightRadius.name": "Étendue lumière vive", - "torch.dimRadius.name": "Étendue lumière faible", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Sources de lumière additionnelles", + "torch.settings.gameLightSources.hint": "Fichier JSON contenant des sources de lumière supplémentaires à utiliser en plus de celles fournies", + "torch.settings.playerTorches.name": "Autorisation des joueurs", + "torch.settings.playerTorches.hint": "Autoriser les joueurs à allumer leurs propres torches.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "Activation par le MJ consomme l'inventaire", + "torch.settings.gmUsesInventory.hint": "Si actif, lorsque une torche est allumée, elle sera déduite de l'inventaire du joueur cible.", + "torch.settings.playerUsesInventory.name": "Activation par le PJ consomme l'inventaire", + "torch.settings.playerUsesInventory.hint": "Si actif, lorsque une torche est allumée, elle sera déduite de l'inventaire du joueur ayant activé sa torche.", + "torch.settings.dancingLightVision.name": "Lumières dansantes", + "torch.settings.dancingLightVision.hint": "Si actif, chaque lumière dansante est dotée d'une vision et peut donc être utilisée pour révéler des zones de la carte que les joueurs ne peuvent pas voir.", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Éteindre l'ensemble des lumières (vives et faibles).", + "torch.help.holdCtrlOnClick": "Maintenir Ctrl lors du clic.", "torch.help.supplyExhausted.title": "Supply Exhausted", "torch.help.supplyExhausted.body": "Your light source is consumable and your quantity has dropped to zero. Increase the quantity of the item to light a fresh one.
", "torch.help.setupSources.title": "Setting Up Light Sources", diff --git a/lang/it.json b/lang/it.json index 92b1469..568ff9b 100644 --- a/lang/it.json +++ b/lang/it.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "Italiano", "I18N.MAINTAINERS": ["GregoryWarn"], - "torch.playerTorches.name": "Torce Giocatore", - "torch.playerTorches.hint": "Consenti ai giocatori di accendere/spegnere le proprie torce.", - "torch.brightRadius.hint": "Quante unità di griglia di luce intensa emettere.", - "torch.dimRadius.hint": "Quante unità di griglia di luce fioca emettere.", - "torch.gmUsesInventory.name": "DM Consuma Inventario", - "torch.gmUsesInventory.hint": "Se attiva, quando un GM accende una torcia, verrà scalata dall'inventario del personaggio.", - "torch.gmInventoryItemName.name": "Nome dell'oggetto dell'inventario da usare", - "torch.gmInventoryItemName.hint": "Nome dell'oggetto dell'inventario da consumare se \"DM Consuma Inventario\" è attiva.", - "torch.turnOffAllLights": "Forza luce intensa e fioca ai valori \"off\" configurati.", - "torch.holdCtrlOnClick": "Premi Ctrl al Click", - "torch.dancingLightVision.name": "Fornisci Visione delle Luci Danzanti", - "torch.dancingLightVision.hint": "Quando abilitato, ogni Luce Danzante avrà una visione, quindi potrà essere utilizzata per rivelare aree della mappa che i giocatori non possono effettivamente vedere.", - "torch.playerUsesInventory.name": "Giocatore Consuma Inventario", - "torch.playerUsesInventory.hint": "Se attiva, quando un giocatore accende una torcia, verrà scalata dall'invetario dell'attore.", - "torch.gameLightSources.name": "Fonti di Luce Addizionali", - "torch.gameLightSources.hint": "File JSON contenente fonti di luce addizionali da usare in aggiunta a quelle fornite", - "torch.brightRadius.name": "Raggio Luce Intensa", - "torch.dimRadius.name": "Raggio Luce Fioca", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Fonti di Luce Addizionali", + "torch.settings.gameLightSources.hint": "File JSON contenente fonti di luce addizionali da usare in aggiunta a quelle fornite", + "torch.settings.playerTorches.name": "Torce Giocatore", + "torch.settings.playerTorches.hint": "Consenti ai giocatori di accendere/spegnere le proprie torce.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "DM Consuma Inventario", + "torch.settings.gmUsesInventory.hint": "Se attiva, quando un GM accende una torcia, verrà scalata dall'inventario del personaggio.", + "torch.settings.playerUsesInventory.name": "Giocatore Consuma Inventario", + "torch.settings.playerUsesInventory.hint": "Se attiva, quando un giocatore accende una torcia, verrà scalata dall'invetario dell'attore.", + "torch.settings.dancingLightVision.name": "Fornisci Visione delle Luci Danzanti", + "torch.settings.dancingLightVision.hint": "Quando abilitato, ogni Luce Danzante avrà una visione, quindi potrà essere utilizzata per rivelare aree della mappa che i giocatori non possono effettivamente vedere.", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Forza luce intensa e fioca ai valori \"off\" configurati.", + "torch.help.holdCtrlOnClick": "Premi Ctrl al Click", "torch.help.supplyExhausted.title": "Scorta Esaurita", "torch.help.supplyExhausted.body": "La tua fonte di luce è consumabile e la tua quantità è scesa a zero. Aumenta la quantità dell'oggetto per accenderne uno nuovo.
", "torch.help.setupSources.title": "Impostazione delle sorgenti luminose", diff --git a/lang/ja.json b/lang/ja.json index c402596..75495ac 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "日本語", "I18N.MAINTAINERS": ["doumoku"], - "torch.playerTorches.name": "プレイヤーtorch", - "torch.playerTorches.hint": "プレイヤーに自身のtorchのON/OFFを許可します。", - "torch.brightRadius.hint": "「明るい」光が届くマス数", - "torch.dimRadius.hint": "「薄暗い」光が届くマス数", - "torch.gmUsesInventory.name": "GMは所持数を消費する", - "torch.gmUsesInventory.hint": "有効化で、GMがtorchを起動した時、アクターの所持数を減らします。", - "torch.gmInventoryItemName.name": "使用する所持品のアイテム名", - "torch.gmInventoryItemName.hint": " \"「GMは所持数を消費する」\" が有効な時の所持品アイテム名を指定します。", - "torch.turnOffAllLights": " \"オフ\" の時の明暗の値を強制", - "torch.holdCtrlOnClick": "Ctrlを押しながらクリック", - "torch.dancingLightVision.name": "ダンシング・ライツに視覚を与える", - "torch.dancingLightVision.hint": "有効化で、 各ダンシング・ライツに視覚を持たせ、実際にはプレイヤーが見えないマップの位置を公開させます。", - "torch.playerUsesInventory.name": "プレイヤーは所持数を消費する", - "torch.playerUsesInventory.hint": "有効化で、プレイヤーがtorchを起動した時、アクターの所持数を減らします。", - "torch.gameLightSources.name": "追加の光源", - "torch.gameLightSources.hint": "追加の光源が含まれたJSONファイルを指定します。", - "torch.brightRadius.name": "「明るい」光半径", - "torch.dimRadius.name": "「薄暗い」光半径", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "追加の光源", + "torch.settings.gameLightSources.hint": "追加の光源が含まれたJSONファイルを指定します。", + "torch.settings.playerTorches.name": "プレイヤーtorch", + "torch.settings.playerTorches.hint": "プレイヤーに自身のtorchのON/OFFを許可します。", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "GMは所持数を消費する", + "torch.settings.gmUsesInventory.hint": "有効化で、GMがtorchを起動した時、アクターの所持数を減らします。", + "torch.settings.playerUsesInventory.name": "プレイヤーは所持数を消費する", + "torch.settings.playerUsesInventory.hint": "有効化で、プレイヤーがtorchを起動した時、アクターの所持数を減らします。", + "torch.settings.dancingLightVision.name": "ダンシング・ライツに視覚を与える", + "torch.settings.dancingLightVision.hint": "有効化で、 各ダンシング・ライツに視覚を持たせ、実際にはプレイヤーが見えないマップの位置を公開させます。", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": " \"オフ\" の時の明暗の値を強制", + "torch.help.holdCtrlOnClick": "Ctrlを押しながらクリック", "torch.help.supplyExhausted.title": "底が尽きた", "torch.help.supplyExhausted.body": "君の光源は消費可能で、所持数が0個になった。新たに灯す場合は所持数を増やすこと。
", "torch.help.setupSources.title": "光源を設定", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 9bcf155..665a445 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "Português (Brasil)", "I18N.MAINTAINERS": ["Andersants"], - "torch.playerTorches.name": "Tochas dos Jogadores", - "torch.playerTorches.hint": "Permitir que os jogadores alternem suas próprias tochas.", - "torch.brightRadius.hint": "Quantas unidades de grade de luz brilhante emitir.", - "torch.dimRadius.hint": "Quantas unidades de grade de luz fraca emitir.", - "torch.gmUsesInventory.name": "GM Consome Inventário", - "torch.gmUsesInventory.hint": "Se definido, quando o GM alterna uma tocha, ela reduzirá o inventário do ator.", - "torch.gmInventoryItemName.name": "Nome do item do inventário a ser usado", - "torch.gmInventoryItemName.hint": "Nome do item do inventário a ser consumido se \"GM Consome Inventário\" estiver definido.", - "torch.turnOffAllLights": "Forçar brilho e fraca a valores \"desligados\" configurados.", - "torch.holdCtrlOnClick": "Segure Ctrl ao clicar", - "torch.dancingLightVision.name": "Dar Visão às Luzes Dançantes", - "torch.dancingLightVision.hint": "Quando habilitado, cada luz dançante terá visão e pode ser usada para revelar áreas do mapa que os jogadores não podem ver realmente.", - "torch.playerUsesInventory.name": "Jogador Consome Inventário", - "torch.playerUsesInventory.hint": "Se definido, quando o jogador alterna uma tocha, ela reduzirá o inventário do ator.", - "torch.gameLightSources.name": "Fontes de Luz Adicionais", - "torch.gameLightSources.hint": "Arquivo JSON contendo fontes de luz adicionais para usar além das fornecidas", - "torch.brightRadius.name": "Raio de Luz Brilhante", - "torch.dimRadius.name": "Raio de Luz Fraca", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Fontes de Luz Adicionais", + "torch.settings.gameLightSources.hint": "Arquivo JSON contendo fontes de luz adicionais para usar além das fornecidas", + "torch.settings.playerTorches.name": "Tochas dos Jogadores", + "torch.settings.playerTorches.hint": "Permitir que os jogadores alternem suas próprias tochas.", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "GM Consome Inventário", + "torch.settings.gmUsesInventory.hint": "Se definido, quando o GM alterna uma tocha, ela reduzirá o inventário do ator.", + "torch.settings.playerUsesInventory.name": "Jogador Consome Inventário", + "torch.settings.playerUsesInventory.hint": "Se definido, quando o jogador alterna uma tocha, ela reduzirá o inventário do ator.", + "torch.settings.dancingLightVision.name": "Dar Visão às Luzes Dançantes", + "torch.settings.dancingLightVision.hint": "Quando habilitado, cada luz dançante terá visão e pode ser usada para revelar áreas do mapa que os jogadores não podem ver realmente.", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "Forçar brilho e fraca a valores \"desligados\" configurados.", + "torch.help.holdCtrlOnClick": "Segure Ctrl ao clicar", "torch.help.supplyExhausted.title": "Suprimento Esgotado", "torch.help.supplyExhausted.body": "Seu fonte de luz é consumível e sua quantidade caiu para zero. Aumente a quantidade do item para acender um novo.
", "torch.help.setupSources.title": "Configurar Fontes de Luz", diff --git a/lang/zh-TW.json b/lang/zh-TW.json index 4a8817b..2e1bf0a 100644 --- a/lang/zh-TW.json +++ b/lang/zh-TW.json @@ -2,26 +2,26 @@ "I18N.LANGUAGE": "正體中文", "I18N.MAINTAINERS": ["Chivell"], - "torch.playerTorches.name": "玩家火炬", - "torch.playerTorches.hint": "允許玩家自行開關自己的火炬。", - "torch.brightRadius.hint": "發出多少格單位的亮光。", - "torch.dimRadius.hint": "發出多少格單位的微光。", - "torch.gmUsesInventory.name": "使用庫存", - "torch.gmUsesInventory.hint": "當GM開關火炬時,將使用角色庫存。", - "torch.gmInventoryItemName.name": "使用庫存物品的名稱", - "torch.gmInventoryItemName.hint": "如果啓用了\"GM使用庫存\",則使用庫存物品的名稱。", - "torch.turnOffAllLights": "強制亮/微光設置為OFF", - "torch.holdCtrlOnClick": "按住 Ctrl 點擊", - "torch.dancingLightVision.name": "賦予舞動燈火視野。", - "torch.dancingLightVision.hint": "啓用後,每個舞動燈火都擁有視野,因此可用來顯示玩家實際上無法看到的地圖區域。", - "torch.playerUsesInventory.name": "Player Uses Inventory", - "torch.playerUsesInventory.hint": "If set, when the player toggles a torch, it will use the actors inventory.", - "torch.gameLightSources.name": "Additional Light Sources", - "torch.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", - "torch.brightRadius.name": "Bright Light Radius", - "torch.dimRadius.name": "Dim Light Radius", - "torch.ignoreEquipment.name": "Ignore Equipment", - "torch.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gameLightSources.name": "Additional Light Sources", + "torch.settings.gameLightSources.hint": "JSON file containing additional light sources to use beyond those supplied", + "torch.settings.playerTorches.name": "玩家火炬", + "torch.settings.playerTorches.hint": "允許玩家自行開關自己的火炬。", + "torch.settings.ignoreEquipment.name": "Ignore Equipment", + "torch.settings.ignoreEquipment.hint": "Offer light sources regardless of actor's owned equipment", + "torch.settings.gmUsesInventory.name": "使用庫存", + "torch.settings.gmUsesInventory.hint": "當GM開關火炬時,將使用角色庫存。", + "torch.settings.playerUsesInventory.name": "Player Uses Inventory", + "torch.settings.playerUsesInventory.hint": "If set, when the player toggles a torch, it will use the actors inventory.", + "torch.settings.dancingLightVision.name": "賦予舞動燈火視野。", + "torch.settings.dancingLightVision.hint": "啓用後,每個舞動燈火都擁有視野,因此可用來顯示玩家實際上無法看到的地圖區域。", + "torch.settings.fallbackSourceName.name": "Fallback Source Name", + "torch.settings.fallbackSourceName.hint": "Name to show for fallback light source.", + "torch.settings.fallbackBrightRadius.name": "Fallback Bright Light Radius", + "torch.settings.fallbackBrightRadius.hint": "How many grid units of bright light to emit on systems without light source configuration.", + "torch.settings.fallbackDimRadius.name": "Fallback Dim Light Radius", + "torch.settings.fallbackDimRadius.hint": "How many grid units of dim light to emit on systems without light source configuration.", + "torch.help.turnOffAllLights": "強制亮/微光設置為OFF", + "torch.help.holdCtrlOnClick": "按住 Ctrl 點擊", "torch.help.supplyExhausted.title": "Supply Exhausted", "torch.help.supplyExhausted.body": "Your light source is consumable and your quantity has dropped to zero. Increase the quantity of the item to light a fresh one.
", "torch.help.setupSources.title": "Setting Up Light Sources", diff --git a/module.json b/module.json index e95bbe1..cd23e83 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "id": "torch", "title": "Torch", "description": "Torch HUD Controls", - "version": "2.17.0", + "version": "2.18.0", "authors": [ { "name": "Deuce", @@ -77,7 +77,7 @@ "torch.css" ], "manifest": "https://raw.githubusercontent.com/League-of-Foundry-Developers/torch/main/module.json", - "download": "https://github.com/League-of-Foundry-Developers/torch/releases/download/v2.17.0/torch-v2.17.0.zip", + "download": "https://github.com/League-of-Foundry-Developers/torch/releases/download/v2.18.0/torch-v2.18.0.zip", "url": "https://github.com/League-of-Foundry-Developers/torch", "compatibility": { "minimum": "10", diff --git a/package.json b/package.json index 82a352b..4c1ac2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "torch", - "version": "2.17.0", + "version": "2.18.0", "description": "Torch HUD Controls", "main": "src/torch.js", diff --git a/src/api.mjs b/src/api.mjs index deb87f1..ca567b2 100644 --- a/src/api.mjs +++ b/src/api.mjs @@ -10,11 +10,12 @@ export default class TorchAPI { let library = await SourceLibrary.load( game.system.id, - Settings.lightRadii.bright, - Settings.lightRadii.dim, - Settings.inventoryItemName, + Settings.fallbackLightRadii.bright, + Settings.fallbackLightRadii.dim, + Settings.fallbackSourceName, Settings.gameLightSources, actor.prototypeToken.light, + Settings.ignoreEquipment, ); return new TorchToken(tokenDoc, library); } diff --git a/src/library.mjs b/src/library.mjs index 60bce76..2bb9dd0 100644 --- a/src/library.mjs +++ b/src/library.mjs @@ -190,15 +190,6 @@ export default class SourceLibrary { this.applyFieldDefaults(SourceLibrary.commonLibrary); } - let defaultLight = Object.assign({}, protoLight); - defaultLight.bright = selfBright; - defaultLight.dim = selfDim; - let configuredLight = { - system: systemId, - name: selfItem, - states: 2, - light: [defaultLight], - }; // If userLibrary is a string, it needs to be fetched, otherwise it is literal data. let userData; if (userLibrary) { @@ -221,7 +212,6 @@ export default class SourceLibrary { let mergedLibrary = mergeLibraries( userData, SourceLibrary.commonLibrary, - configuredLight, ignoreEquipment, //Makes nothing consumable ); @@ -245,6 +235,11 @@ export default class SourceLibrary { let defaultLibrary = mergedLibrary["default"]; defaultLibrary.sources["Self"].light[0].bright = selfBright; defaultLibrary.sources["Self"].light[0].dim = selfDim; + if (selfItem && selfItem.length > 0) { + defaultLibrary.sources[selfItem] = defaultLibrary.sources["Self"]; + defaultLibrary.sources[selfItem].name = selfItem; + delete defaultLibrary.sources.Self; + } const library = new SourceLibrary(defaultLibrary); library.ignoreEquipment = ignoreEquipment; return library; @@ -321,7 +316,6 @@ export default class SourceLibrary { let mergeLibraries = function ( userLibrary, commonLibrary, - configuredLight, nothingIsConsumable, ) { let mergedLibrary = {}; @@ -362,53 +356,13 @@ let mergeLibraries = function ( }; } } - // Source properties for configured source override common library but not user library - let configuredName = ""; - if (configuredLight.name) { - let inUserLibrary = false; - let template = null; - if (system === configuredLight.system) { - for (let source in mergedLibrary[system].sources) { - if (source.toLowerCase() === configuredLight.name.toLowerCase()) { - inUserLibrary = true; - break; - } - } - if (!inUserLibrary && commonLibrary[system]) { - for (let source in commonLibrary[system].sources) { - if (source.toLowerCase() === configuredLight.name.toLowerCase()) { - configuredName = source; - template = commonLibrary[system].sources[source]; - break; - } - } - if (!configuredName) { - configuredName = configuredLight.name; //But might be blank - } - // We finally have the best name to use and perhaps a template - // We can build one - mergedLibrary[system].sources[configuredName] = { - name: configuredName, - type: template ? template["type"] : "equipment", - consumable: nothingIsConsumable - ? false - : template - ? template["consumable"] - : true, - states: configuredLight.states, - light: configuredLight.light, - }; - } - } - } // Finally, we will deal with the common library for whatever is left if (system in commonLibrary) { for (let source in commonLibrary[system].sources) { if ( - (!userLibrary || - !(system in userLibrary) || - !(source in userLibrary[system].sources)) && - (!configuredName || source !== configuredName) + !userLibrary || + !(system in userLibrary) || + !(source in userLibrary[system].sources) ) { let commonSource = commonLibrary[system].sources[source]; mergedLibrary[system].sources[source] = { diff --git a/src/settings.mjs b/src/settings.mjs index 6580053..bca3f43 100644 --- a/src/settings.mjs +++ b/src/settings.mjs @@ -24,14 +24,13 @@ export default class Settings { static get userUsesInventory() { return game.settings.get("torch", "playerUsesInventory"); } - - static get inventoryItemName() { - return game.settings.get("torch", "gmInventoryItemName"); + static get fallbackSourceName() { + return game.settings.get("torch", "fallbackSourceName"); } - static get lightRadii() { + static get fallbackLightRadii() { return { - bright: game.settings.get("torch", "brightRadius"), - dim: game.settings.get("torch", "dimRadius"), + bright: game.settings.get("torch", "fallbackBrightRadius"), + dim: game.settings.get("torch", "fallbackDimRadius"), }; } static get gameLightSources() { @@ -45,14 +44,14 @@ export default class Settings { } static get helpText() { - let turnOffLights = game.i18n.localize("torch.turnOffAllLights"); - let ctrlOnClick = game.i18n.localize("torch.holdCtrlOnClick"); + let turnOffLights = game.i18n.localize("torch.help.turnOffAllLights"); + let ctrlOnClick = game.i18n.localize("torch.help.holdCtrlOnClick"); return CTRL_REF_HTML(turnOffLights, ctrlOnClick); } static register() { game.settings.register("torch", "gameLightSources", { - name: game.i18n.localize("torch.gameLightSources.name"), - hint: game.i18n.localize("torch.gameLightSources.hint"), + name: game.i18n.localize("torch.settings.gameLightSources.name"), + hint: game.i18n.localize("torch.settings.gameLightSources.hint"), filePicker: "any", scope: "world", config: true, @@ -60,32 +59,32 @@ export default class Settings { type: String, }); game.settings.register("torch", "playerTorches", { - name: game.i18n.localize("torch.playerTorches.name"), - hint: game.i18n.localize("torch.playerTorches.hint"), + name: game.i18n.localize("torch.settings.playerTorches.name"), + hint: game.i18n.localize("torch.settings.playerTorches.hint"), scope: "world", config: true, default: true, type: Boolean, }); game.settings.register("torch", "ignoreEquipment", { - name: game.i18n.localize("torch.ignoreEquipment.name"), - hint: game.i18n.localize("torch.ignoreEquipment.hint"), + name: game.i18n.localize("torch.settings.ignoreEquipment.name"), + hint: game.i18n.localize("torch.settings.ignoreEquipment.hint"), scope: "world", config: true, default: false, type: Boolean, }); game.settings.register("torch", "gmUsesInventory", { - name: game.i18n.localize("torch.gmUsesInventory.name"), - hint: game.i18n.localize("torch.gmUsesInventory.hint"), + name: game.i18n.localize("torch.settings.gmUsesInventory.name"), + hint: game.i18n.localize("torch.settings.gmUsesInventory.hint"), scope: "world", config: true, default: false, type: Boolean, }); game.settings.register("torch", "playerUsesInventory", { - name: game.i18n.localize("torch.playerUsesInventory.name"), - hint: game.i18n.localize("torch.playerUsesInventory.hint"), + name: game.i18n.localize("torch.settings.playerUsesInventory.name"), + hint: game.i18n.localize("torch.settings.playerUsesInventory.hint"), scope: "world", config: true, default: true, @@ -93,33 +92,33 @@ export default class Settings { }); if (game.system.id === "dnd5e") { game.settings.register("torch", "dancingLightVision", { - name: game.i18n.localize("torch.dancingLightVision.name"), - hint: game.i18n.localize("torch.dancingLightVision.hint"), + name: game.i18n.localize("torch.settings.dancingLightVision.name"), + hint: game.i18n.localize("torch.settings.dancingLightVision.hint"), scope: "world", config: true, default: false, type: Boolean, }); } - game.settings.register("torch", "gmInventoryItemName", { - name: game.i18n.localize("torch.gmInventoryItemName.name"), - hint: game.i18n.localize("torch.gmInventoryItemName.hint"), + game.settings.register("torch", "fallbackSourceName", { + name: game.i18n.localize("torch.settings.fallbackSourceName.name"), + hint: game.i18n.localize("torch.settings.fallbackSourceName.hint"), scope: "world", config: true, default: "torch", type: String, }); - game.settings.register("torch", "brightRadius", { - name: game.i18n.localize("torch.brightRadius.name"), - hint: game.i18n.localize("torch.brightRadius.hint"), + game.settings.register("torch", "fallbackBrightRadius", { + name: game.i18n.localize("torch.settings.fallbackBrightRadius.name"), + hint: game.i18n.localize("torch.settings.fallbackBrightRadius.hint"), scope: "world", config: true, default: 20, type: Number, }); - game.settings.register("torch", "dimRadius", { - name: game.i18n.localize("torch.dimRadius.name"), - hint: game.i18n.localize("torch.dimRadius.hint"), + game.settings.register("torch", "fallbackDimRadius", { + name: game.i18n.localize("torch.settings.fallbackDimRadius.name"), + hint: game.i18n.localize("torch.settings.fallbackDimRadius.hint"), scope: "world", config: true, default: 40, diff --git a/src/token.mjs b/src/token.mjs index 118a2c7..50b4873 100644 --- a/src/token.mjs +++ b/src/token.mjs @@ -50,7 +50,7 @@ export default class TorchToken { return lightSource; } // The one the GM asked for - let itemName = Settings.inventoryItemName; + let itemName = Settings.fallbackSourceName; let namedSource = itemName ? this._ownedSources.find( (item) => item.name.toLowerCase() === itemName.toLowerCase(), diff --git a/src/topology.mjs b/src/topology.mjs index d5cae94..361a02e 100644 --- a/src/topology.mjs +++ b/src/topology.mjs @@ -115,7 +115,7 @@ class DefaultLightTopology { quantityField = "quantity"; constructor(/*quantityField*/) {} actorHasLightSource(actor, lightSource) { - return !!(lightSource && lightSource.name === "Self"); + return !!lightSource; } getImage(/*actor, lightSource*/) { return DEFAULT_IMAGE_URL; diff --git a/src/torch.mjs b/src/torch.mjs index 8e5a92b..ff3790e 100644 --- a/src/torch.mjs +++ b/src/torch.mjs @@ -29,9 +29,9 @@ class Torch { let actor = game.actors.get(hud.object.document.actorId); let library = await SourceLibrary.load( game.system.id, - Settings.lightRadii.bright, - Settings.lightRadii.dim, - Settings.inventoryItemName, + Settings.fallbackLightRadii.bright, + Settings.fallbackLightRadii.dim, + Settings.fallbackSourceName, Settings.gameLightSources, actor.prototypeToken.light, Settings.ignoreEquipment, diff --git a/test/library-tests.mjs b/test/library-tests.mjs index 9770d7e..dfb6b9e 100644 --- a/test/library-tests.mjs +++ b/test/library-tests.mjs @@ -166,8 +166,8 @@ describe("Torch Library Tests >", () => { let torch = library.getLightSource("torch"); assert.deepEqual( torch.light[0], - { bright: 10, dim: 50 }, - "torch brightness from settings came in correctly", + { bright: 20, dim: 40, angle: 360 }, + "torch brightness came in from library not from fallback", ); let phantom = library.getLightSource("phantom torch"); assert.equal(phantom, undefined, "No phantom torch defined as expected"); @@ -205,8 +205,8 @@ describe("Torch Library Tests >", () => { let torch = library.getLightSource("torch"); assert.deepEqual( torch.light[0], - { bright: 10, dim: 50 }, - "torch brightness from settings came in correctly", + { bright: 20, dim: 40, angle: 360 }, + "torch brightness came in from library not from fallback", ); let candle = library.getLightSource("candle"); assert.deepEqual( @@ -253,5 +253,24 @@ describe("Torch Library Tests >", () => { "user flashlight light settings match", ); }); + it("library load for an unspecified system without a user library", async () => { + assert.equal( + SourceLibrary.commonLibrary, + undefined, + "no common library loaded initially", + ); + let library = await SourceLibrary.load("unspecified", 10, 50, "Torch"); + assert.ok(SourceLibrary.commonLibrary, "common library loaded"); + let torch = library.getLightSource("torch"); + assert.deepEqual( + torch.light[0], + { bright: 10, dim: 50, angle: 360 }, + "torch brightness came in from the fallback settings", + ); + let candle = library.getLightSource("candle"); + assert.equal(candle, undefined, "No phantom torch defined as expected"); + let phantom = library.getLightSource("phantom torch"); + assert.equal(phantom, undefined, "No phantom torch defined as expected"); + }); }); });