Skip to content

Commit

Permalink
Preparing for first release for v10
Browse files Browse the repository at this point in the history
  • Loading branch information
lupestro committed Jul 23, 2022
1 parent c1f2f4a commit d6212e2
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 41 deletions.
22 changes: 6 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,26 @@
## Middle Kingdom - v10 branch

### 2.0.0 - [TBD]
- [BREAKING] (Lupestro) This release supports v10 of Foundry - but only v10 and hopefully some way well beyond it.
- [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, light sources remain carried by the actor
* 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.
* Right now, aside from a generalized actor-token light capability, we only support specific light sources in DnD5e today, but we're poised for growth there.
* No support **_yet_** for setting a light source down and stepping away.
- There are subtleties once these things have identity.
- Can somebody else turn them on? Do they cease to belong to your actor?
- What are the rules for interacting with placed light sources?
- How do you avoid turning off the wrong one?
- Do they remain placed after being turned off?
- Where do you have to be to turn them off?
- There's stuff to work out and I wanted to get this out there first.
- We can use the existing logic supporting Dancing Lights as the basis for a very limited implementation with one active light source per actor per scene, but would that be satisfying? We're getting into "piles" territory.
* 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.
* We might do better to integrate light into other modules dealing with objects than to let this get too sophisticated.

- [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, socket comms are much easier to follow.
* 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 thimble of HTML needed is fine sitting in the top of the hud.js for now.
* The mere thimbleful of HTML needed is fine sitting in the top of the hud.js for now.

## Intermediate period - master branch

Expand Down
85 changes: 71 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,65 @@
# 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.
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.

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

Expand All @@ -16,20 +69,24 @@ The following is the current status of translation. Some features have arrived,

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

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
4 changes: 3 additions & 1 deletion lang/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"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.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"
}
5 changes: 3 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"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.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"
}
4 changes: 3 additions & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
"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.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"
}
4 changes: 3 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
"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.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"
}
4 changes: 3 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"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.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"
}
4 changes: 3 additions & 1 deletion lang/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"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.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"
}
5 changes: 3 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "torch",
"name": "torch",
"title": "Torch",
"description": "Torch HUD Controls",
"version": "2.0.0",
Expand Down Expand Up @@ -43,9 +44,9 @@
"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,
"maximum": 10
"verified": 10
}
}
4 changes: 2 additions & 2 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ export default class Settings {
type: String,
});
game.settings.register("torch", "brightRadius", {
name: game.i18n.localize("LIGHT.Bright"),
name: game.i18n.localize("torch.brightRadius.name"),
hint: game.i18n.localize("torch.brightRadius.hint"),
scope: "world",
config: true,
default: 20,
type: Number,
});
game.settings.register("torch", "dimRadius", {
name: game.i18n.localize("LIGHT.Dim"),
name: game.i18n.localize("torch.dimRadius.name"),
hint: game.i18n.localize("torch.dimRadius.hint"),
scope: "world",
config: true,
Expand Down

0 comments on commit d6212e2

Please sign in to comment.