Skip to content

Commit

Permalink
Merge branch 'v10' to master
Browse files Browse the repository at this point in the history
  • Loading branch information
lupestro committed Dec 4, 2022
2 parents 8ee77da + e5cfa3a commit 6657e01
Show file tree
Hide file tree
Showing 30 changed files with 2,210 additions and 641 deletions.
102 changes: 102 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Change Log

## Middle Kingdom - v10 branch

### 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.
* 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.
* Using 57 degrees is the fairest solution available within Foundry's constraints.
* The extra beam width compensates for what you lose in the corners that radial light won't reach.
* 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.

### 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.

### 2.1.1 - September 6, 2022
- [BUGFIX] (Lupestro) Fixed issue where unlinked tokens were adjusting inventory on source token.
- [BUGFIX] (Lupestro) Fixed designation of which stock light sources are consumable in GURPS
- [BUGFIX] (Lupestro) Adjusted manifest to use strings for minimumCoreVersion and compatibility values.

### 2.1.0 - July 24, 2022
- [BUGFIX] (Lupestro) Context menu wasn't opening in HUD after exhausting a source - had to reopen HUD.
- [BUGFIX] (Lupestro) Making Dancing Lights respond to configured settings.
- [FEATURE] (ToGreedy) German translation.

### 2.0.0 - July 23, 2022
- [BREAKING] (Lupestro) This release supports v10 of Foundry, and not v0.7, v0.8, or v9.
- [FEATURE] (Lupestro) Now supports selection among a variety of light sources on right-click menu from torch button - a long time coming, I know.
* Bullseye Lantern has cone beam on token facing.
* Hooded Lantern toggles on-dim-off on click.
* Candle and Torch consume inventory, indicate when exhausted.
* Limitations:
* Aside from existing Dancing Lights behavior in dnd5e, light sources remain carried by the actor
* One actor may have only one light source active per scene at a time.
* No support for setting a light source down and stepping away.
* We probably won't get too deep into spells beyond the two cantrips we support
- The PHB only lists 7 other spells with explicit light effects
- All the spells except Continual Flame and Daylight have other effects - weapon, damage, etc - that you'd want a more sophisticated module to deliver.
- We could offer the Produce Flame cantrip as a half-sized Light cantrip without its thrown weapon effect, but would that be satisfying?
- Anything that consumes spell slots (including Continual Flame and Daylight) should probably be invoked as a normal spell rather than a light source anyway.
- [FEATURE] (Lupestro) Now supports specific light sources for a modest variety of systems, with extensibility to override settings or add light sources through a JSON file.
- [INTERNAL] (Lupestro) Separated concerns into multiple js files and a CSS file
* The additional UI and the more complex state finally made it necessary.
* Separate root, hud, token, settings, light sources, topologies, and socket comms are much easier to follow.
* This will make planned future work much easier as well.
* The mere thimbleful of HTML needed is fine sitting in the top of the hud.js for now.

## Intermediate period - master branch

### 1.4.4 - March 19, 2022
- [BUGFIX] (Lupestro) Dancing Lights now work better for players - sends entire create / remove cycle to GM when users lack permissions on tokens.
### 1.4.3 - December 17, 2021
- [CLEANUP] (Lupestro) Bumped official compatibility to Foundry 9, after testing with final test version. No code change.
### 1.4.2 - October 31, 2021
- [FEATURE] (Lupestro) Now works in Foundry 9, but still works in Foundry 7 and 8.
- [BUGFIX] (Lupestro) Function in Foundry 7 is restored - it had broken in restructuring.
- [INTERNAL] (Lupestro) Established test foundation - explicit cases, worlds, automation, fluid dev->test.
### 1.4.1 - October 23, 2021
- [BUGFIX] (Lupestro) Fixed bug in restructuring that broke features for non-DnD5e.
### 1.4.0 - October 23, 2021
- [BUGFIX] (C-S-McFarland) Fix for bug when you have torch and light spell.
- [INTERNAL] (Lupestro) Major restructuring with cleanup of race conditions.
### 1.3.2 - June 29, 2021
- [FEATURE] (Lupestro, zarmstrong, lozalojo) Spanish updates and URL in module.json
### 1.3.1 - June 29, 2021
- [FEATURE] (Lupestro) Updated zh-tw translation from zeteticl and pt-br translation from rinnocenti to 100% of strings. Thanks y'all!
### 1.3.0 - June 25, 2021
- [FEATURE] (Lupestro) Incorporated pending Taiwan Chinese and Brazilian Portuguese translations from zeteticl and rinnocenti.
### 1.2.1 - June 11, 2021
- [CLEANUP] (Lupestro) Cleaned up console logging noise I had created
### 1.2.0 - June 10, 2021 -
- [FEATURE] (Lupestro) Updated for 0.8.6, but ensured it still functions in 0.7.x.

## Old Kingdom - master branch

Everything from here down has needed to be pieced together from unearthed inscriptions (the GIT history.)

* 1.1.4 - October 21, 2020 - (Stephen Hurd) Marked as 0.7.5 compatible.
* 1.1.3 - October 18, 2020 - (Stephen Hurd) Fix spelling.
* 1.1.2 - October 18, 2020 - (Stephen Hurd) Fix JSON syntax.
* 1.1.1 - October 18, 2020 - (Stephen Hurd) Name adjustment.
* 1.1.0 - October 18, 2020 - (Jose E Lozano) Add Spanish,
(Stephen Hurd) Fix bright/dim radius of Dancing Lights.
* 1.0.9 - May 28, 2020 - (Stephen Hurd) Marked as 0.6.0 compatible.
* 1.0.8 - May 19, 2020 - (Aymeric DeMoura) Add French, Marked as 0.5.8 compatible.
* 1.0.7 - April 29, 2020 - (Stephen Hurd) Add Chinese, fix torch inventory usage.
* 1.0.6 - April 18, 2020 - (Stephen Hurd) Fix dancing lights removal.
* 1.0.5 - April 18, 2020 - (Stephen Hurd) Remove socket code for dancing lights removal.
* 1.0.4 - April 18, 2020 - (Stephen Hurd) Update to mark as 0.5.4 compatible.
* 1.0.3 - April 15, 2020 - (MtnTiger) - Updated with API changes.
* 1.0.2 - January 22, 2020 - (Stephen Hurd) Update for 0.4.4.
* 1.0.1 - November 26, 2019 - (Stephen Hurd) - Use await on all promises.
* 1.0.0 - November 25, 2019 - (Stephen Hurd) - Add support for Dancing Lights.

126 changes: 77 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,93 @@
# 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 base function works regardless of game system.

Additionally, in D&D5e only:
* The single HUD control will trigger the 'Dancing Lights' cantrip if you have it.
* Failing that, it will perform the 'Light' cantrip if you have that.
* Failing that, if you have torches, it consumes one, decrementing the quantity on each use.
* The button will show as disabled when you turn on the HUD if you have no torches left.
## Changelog

This has needed to be pieced together a bit, but here's what I've gleaned from the GIT history.
* 1.4.4 - March 19, 2022 - Dancing Lights now work better for players - sends entire create / remove cycle to GM when users lack permissions on tokens.
* 1.4.3 - December 17, 2021 - Bumped official compatibility to Foundry 9, after testing with final test version. No code change.
* 1.4.2 - October 31, 2021 - (Lupestro)
- [Feature] Now works in Foundry 9, but still works in Foundry 7 and 8.
- [Bugfix] Function in Foundry 7 is restored - it had broken in restructuring.
- [Internal] Established test foundation - explicit cases, worlds, automation, fluid dev->test.
* 1.4.1 - October 23, 2021 - (Lupestro) Fixed bug in restructuring that broke features for non-DnD5e.
* 1.4.0 - October 23, 2021 -
- (C-S-McFarland) Fix for bug when you have torch and light spell.
- (Lupestro) Major restructuring with cleanup of race conditions.
* 1.3.2 - June 29, 2021 - (Lupestro, zarmstrong, lozalojo) Spanish updates and URL in module.json
* 1.3.1 - June 29, 2021 - (Lupestro) Updated zh-tw translation from zeteticl and pt-br translation from rinnocenti to 100% of strings. Thanks y'all!
* 1.3.0 - June 25, 2021 - (Lupestro) Incorporated pending Taiwan Chinese and Brazilian Portuguese translations from zeteticl and rinnocenti.
* 1.2.1 - June 11, 2021 - (Lupestro) Cleaned up console logging noise I had created
* 1.2.0 - June 10, 2021 - (Lupestro) Updated for 0.8.6, but ensured it still functions in 0.7.x.
* 1.1.4 - October 21, 2020 - (Stephen Hurd) Marked as 0.7.5 compatible.
* 1.1.3 - October 18, 2020 - (Stephen Hurd) Fix spelling.
* 1.1.2 - October 18, 2020 - (Stephen Hurd) Fix JSON syntax.
* 1.1.1 - October 18, 2020 - (Stephen Hurd) Name adjustment.
* 1.1.0 - October 18, 2020 - (Jose E Lozano) Add Spanish,
(Stephen Hurd) Fix bright/dim radius of Dancing Lights.
* 1.0.9 - May 28, 2020 - (Stephen Hurd) Marked as 0.6.0 compatible.
* 1.0.8 - May 19, 2020 - (Aymeric DeMoura) Add French, Marked as 0.5.8 compatible.
* 1.0.7 - April 29, 2020 - (Stephen Hurd) Add Chinese, fix torch inventory usage.
* 1.0.6 - April 18, 2020 - (Stephen Hurd) Fix dancing lights removal.
* 1.0.5 - April 18, 2020 - (Stephen Hurd) Remove socket code for dancing lights removal.
* 1.0.4 - April 18, 2020 - (Stephen Hurd) Update to mark as 0.5.4 compatible.
* 1.0.3 - April 15, 2020 - (MtnTiger) - Updated with API changes.
* 1.0.2 - January 22, 2020 - (Stephen Hurd) Update for 0.4.4.
* 1.0.1 - November 26, 2019 - (Stephen Hurd) - Use await on all promises.
* 1.0.0 - November 25, 2019 - (Stephen Hurd) - Add support for Dancing Lights.
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.

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.

Despite all that we have added, this module continues to follow the philosophy of being controllable in play from a single toggle button on the token HUD, and quickly configurable from there.

Out of the box, the following are available:

| System | Sources |
|--------|---------|
| dnd5e | Candle, Torch, Lamp, Bullseye Lantern, Hooded Lantern, Light, Dancing Lights
| swade | Candle, Flashlight, Lantern, Torch
| pf1 | Candle, Lamp, Lantern, Bullseye Lantern, Hooded Lantern, Miner's Lantern, Torch
| pf2e | Candle, Lantern (Hooded), Lantern (Bull's Eye), Torch
| earthdawn4e | Candle, Lantern (Hooded), Lantern (Bullseye), Torch
| gurps | "Candle, Tallow", "Flashlight, Heavy", "Mini Flashlight", "Micro Flashlight", "Survival Flashlight", "Lantern", "Torch", "Bull's-Eye Lantern", "Electric Lantern, Small", "Electric Lantern, Large", "Small Tactical Light", "Large Tactical Light", "Floodlight"

This module just sheds light from the location of a player token upon demand based upon equipment inventory. It is recommended *not* to use this module for spells or equipment that have other capabilities you intend to use, like performing damage or setting down the equipment, but to rely upon other common approaches, like active effects or item piles, for those.

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.
```json
{
"dnd5e": {
"system": "dnd5e",
"topology": "standard",
"quantity" : "quantity",
"sources": {
"Candle": {
"name": "Candle",
"type": "equipment",
"consumable": true,
"states": 2,
"light": [
{
"bright": 10, "dim": 15, "angle": 360, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 5, "intensity": 5, "reverse": false }
}
]
}
}
},
...
}
```
The key in the top-level hash is the id of the system.

We support two `topology` values at present:
* In `standard` topology, equipment are `Item` objects with a property to track how many you have. Set `quantity` to the property name used by the system to count the inventory of the item.
* In `gurps` topology, light sources are collected under a property of the actor and require GURPS-specific functions to manipulate inventory. Set `quantity` to `amount`.

A source with `"consumable": false`, like a lamp or a cantrip, doesn't deduct one from inventory with every use. A source with `"consumable": true`, like a torch or a candle, will have a quantity that is reduced as you use them and will become unavailable when the quantity drops to zero. If you find tracking inventory a complete distraction from your game, you can turn this feature off using the "GM Uses Inventory" and "Player Uses Inventory" settings.

`states` specifies how many states the light source toggles through. For on/off sources, `states` is 2. For high/low/off sources, like hooded lanterns, states is 3.

The `light` array contains a hash of light properties for each "on" state, so most things will have one hash between the brackets, but a hooded lantern will have two. The hash can contain any combination of valid token light properties, providing the same degree of configurability as the token's Light tab.

To use this module with game systems using different topologies will require code but very little code. Define the new topology in topology.js. PRs gratefully accepted. :)

## Changelog - now in [separate file](./CHANGELOG.md)

## Translation Status

The following is the current status of translation. Some features have arrived, introducing new strings, since translations were last done.

| Language | Completion | Contributors |
| -------- | ---------- | ------------ |
| en | `[##########]` 16/16 (100%) | deuce |
| zh-cn | `[#######---]` 12/16 (75%) | xticime |
| es | `[##########]` 14/16 (100%) | lozalojo |
| fr | `[#########-]` 14/16 (87%) | Aymeeric |
| pt-br | `[##########]` 16/16 (100%) | rinnocenti |
| zh-tw | `[##########]` 16/16 (100%) | zeteticl |
| en | `[##################]` 18/18 (100%) | deuce, lupestro |
| zh-cn | `[##########--------]` 10/18 (56%) | xticime |
| es | `[############------]` 12/18 (67%) | lozalojo |
| fr | `[##########--------]` 10/18 (56%) | Aymeeric |
| pt-br | `[############------]` 12/18 (67%) | rinnocenti |
| zh-tw | `[############------]` 12/18 (67%) | zeteticl |
| de | `[##################]` 18/18 (100%) | ToGreedy |

PRs for further translations will be dealt with promptly. While German, Japanese, and Korean are most especially desired - our translation story seems deeply incomplete without them - all others are welcome.

It's only 16 strings so far, a satisfying afternoon, even for someone who's never committed to an open source project before, and your name will go into the readme right here next to the language. Fork, clone, update, _test locally_, commit, and then submit a PR. Holler for @lupestro on Discord if you need help getting started.
It's only 18 strings so far, a satisfying afternoon, even for someone who's never committed to an open source project before, and your name will go into the readme right here next to the language. Fork, clone, update, _test locally_, commit, and then submit a PR. Holler for @lupestro on Discord if you need help getting started.

## History

This module was originally written by @Deuce. After it sustained several months of inactivity in 2021, @lupestro submitted a PR to get its features working reliably in FoundryVTT 0.8. Deuce agreed to transfer control to the League with @lupestro as maintainer, the changes were committed and a release was made from the League fork. All the PRs that were open at the time of the transfer are now committed and attention has turned to fulfilling some of the feature requests in a maintainable way while retaining the "one-button" character of the original module.
This module was originally written by @Deuce. After it sustained several months of inactivity in 2021, @lupestro submitted a PR to get its features working reliably in FoundryVTT 0.8. Deuce agreed to transfer control to the League with @lupestro as maintainer, the changes were committed and a release was made from the League fork.

All the PRs that were open at the time of the transfer are now committed and attention has turned to fulfilling some of the feature requests in a maintainable way while retaining the "one-button" character of the original module.

With Foundry VTT V10, the module code was rewritten, broken into several JS files to prepare for implementation of the most asked for features, still behind the single button, supported by a couple of new settings. This mechanism is now complete, pending possible requests for additional equipment topologies.

## License

Expand Down
1 change: 0 additions & 1 deletion design/more-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ In a later round, the behavior of the flame toggle icon will be dependent upon t

## Development plan

All initial development will take place on the v10-prep branch. The code base there is simpler because it gets rid of all the legacy of v7, v8, and v9 naming, (and yes, there were small changes at each major release) and the timing is about right for when this will be done. We will not do a v10 release that doesn't let people using v9 still pull the final v9 version and we will still perform any critical bug fixes against v9, but new features will become available with v10.
### Prefactoring - Code structure

We're adding a fair amount of complexity here. The goal of this round is to restructure the existing code to prepare for growth without adding any new features.
Expand Down
Loading

0 comments on commit 6657e01

Please sign in to comment.