Tools for painting grid cells with terrain heights.
Designed for LANCER, Terrain Height Tools takes inspiration from the way painting tiles works in the Political Map Overlay module by cirrahn; and augments it with some line of sight calculation functionality and the ability to render the heights on the token layer.
Usage
Once installed, the first thing you need to do is configure the paintable terrain types for your world. You can think of terrain types like colours of paint for your paintbrush. This can be done either by:
- Going on to 'Configure Settings' in the Foundry right-hand menu, clicking 'Terrain Height Tools' on the navigation list, then clicking the 'Configure Terrain Types' button.
- Alternatively, you can click the new 'Terrain Height Tools' button on the scene controls (icon is 3 vertical bars of different heights), selecting the 'Paint' tool (icon is a paintbrush), and clicking the cog button on the top right of the 'Terrain Palette' window that appears.
See below for more details about configuring terrain types.
Once at least one type of terrain has been configured, you can then use the tools in the 'Terrain Height Tools' menu to paint terrain onto the map. To do this, you need to click the type of terrain you want to paint in the 'Terrain Palette' window and choose a height for the terrain. You can also optionally enter an elevation. Adjacent grid cells will merge together if their terrain types, their heights, and their elevations are the same.
Line of Sight
Terrain Height Tools provides two tools for testing line of sight (LoS) against the terrain that has been drawn to the scene. Both of them can be found under the tokens menu.
The first, is the humble 'Line of Sight Ruler'. The ruler behaves similarlly to the standard ruler built in to Foundry. You can click and drag between two points, and it will test the line of sight along this line, and highlight any intersections with the terrain. You will also see a 'H' number next to either end of the ruler. This represents the height of that endpoint. You can change this either by using the +
and -
keys on your keyboard, or typing values into the config window that appears.
The second tool is the 'Token Line of Sight' tool. When you click this tool, you will see a config window appear. Click on the bullseye icon and then click on a token on the scene, for both the boxes that appear. Terrain Height Tools will then draw 3 LoS rays: one from the centre of the first token to the centre of the second; one between the left-most edges of the tokens; and one between the right-most edges. The H value of these lines depends on how the LoS is configured, but it is based on the token's elevation + a modifier multiplied by the token's width (there is no 'vertical height' field for tokens in Foundry, so tokens are assumed to be as tall as they are wide); For example in the default configuration a token with an elevation of 3 and a size of 2, the H would be 5; This represents the top of the token. The tool can instead draw the LoS from the middle or the bottom of a token.
When the LoS rays are drawn to the scene, you will see a line drawn from the source point to the target point. This line is formatted depending on what state it is in at that point:
- A solid white line means that the line is not intersecting with anything.
- A coloured line means that the line is touching or intersecting with some terrain. The colour matches the terrain's colour.
- If a coloured line is solid, it means that the ray touches a terrain shape, but does not actually intersect it.
- If a coloured line is dashed, it means that the ray completely intersects a shape.
It's also worth noting that the ray is calculated in 3D space, so if you see it abruptly stop intersecting a shape part way through, it has likely impacted the top or bottom of the shape.
Configuring Terrain Types
To add a new terrain type simply:
- Click the "Add Terrain Type" button in the bottom left.
- Give it a name (labelled 2 in the above image). Note that this is what shows in the palette window, NOT what is shown to players on the scene canvas.
- Select whether or not the terrain type should have a height/elevation.
- This is the default, however for some types (e.g. objective/control zones) it may not make sense to give them a height. This setting will disable the height option in the palette, and prevent you from accidentally having areas with different heights. Note that disabling this will NOT affect already-painted grid cells.
- Configure the style of the area that will be painted on the scene - these settings should be familiar if you have used the default Foundry drawing tool before.
- One thing to note though is that the 'Text Label' (number 8 in the above image), which is what the area will be labelled as, allows a
%h%
and/or a%e%
placeholder to be used. These will be replaced with the height or elevation value of the painted terrain respectively. For example, if you create a type with a label ofH%h%
, when painted on the scene at height 2, it will have a label ofH2
. If painted at height 4, it will have a label ofH4
, etc. Likewise, a label ofH%h%+%e%
would showH3+4
if it was a height 3 terrain at an elevation of 4.
- One thing to note though is that the 'Text Label' (number 8 in the above image), which is what the area will be labelled as, allows a
- Click 'Save Changes' in the bottom right, and your new terrain type will show up in the palette.
There are some other useful buttons:
- Button 1 expands/collapses the terrain type configuration. Just helps keep the menu tidy!
- Buttons 3 and 4 on the above image are to move the terrain types up and down. This only affects their order in the palette, but you can shift your most-used terrain types to the top if you wish.
- Button 5 allows you to duplicate an existing terrain type, copying all the configuration.
- Button 6 is to delete the terrain type.
- 'Import Preset' (button 9) allows you to easily import a config preset that has been submitted by members of the community. If you would like to submit a preset, please create an issue or pull request on GitHub.
- 'Import Terrain Types' (button 10) allows you to paste JSON in to import some terrain types that have been exported previously.
- 'Export Terrain Types' (button 11) will give you a JSON that you can share with other people, or copy to other worlds and will copy all your terrain types.
Module Settings
Here is a quick reference of the settings module presents in the 'Configure Settings' button of Foundry:
All Users
Terrain Height Map Visibility Radius
- If not zero, the terrain height map will only be shown in a radius of that many grid cells around the mouse cursor. If zero, the entire map will be visible.Other User's LoS Ruler Opacity
- How opaque/transparent other user's line of sight rulers will appear to you.Token LoS: Auto-populate Primary Token
- If true, when selecting the Token Line of Sight tool, THT will attempt to populate the first token for LoS measurement. It will prioritise a selected token on the scene if you have one, or if there isn't one it'll attempt to fallback to the token that represents the actor you have configured as your character.Token LoS: Auto-populate Secondary Token
- If true, when selecting the Token Line of Sight tool, THT will attempt to populate the second token for LoS measurement. It will use the first targeted token on the scene, if there is one.
GM Only
Terrain Types
- Button to open the terrain type configuration (see above)Terrain Height Map Above Tiles
- This determines whether or not the terrain height map is shown above or below ground-level tiles. The height map is ALWAYS shown below overhead tiles. This can also be configured on a per-scene basis using the 'Terrain Height Map Layer' option on the 'Grid' tab of the scene config settings.Display Line of Sight Ruler (GM)
- If true, the GM's Line of Sight measurements will be shown to other players.Display Line of Sight Ruler (Player)
- If true, players' Line of Sight measurements will be shown to other players.
API
Terrain Height Tools exposes an API that can be used by macros, scripts or, other modules. Please see the API documentation for more.