checkLightLevel v0.5.0
GitHub repo
This script requires Path Math (available from the one-click library)
Description:
A simple script to check the current light level of the selected token (originally from Craig M's thread). The script will process all relevant light emitters on the map, determine their light level if in range, and whether or not the light is blocked.
v0.5.0 update:
- Script is better at dealing with the edge of light sources, and will report on tokens that are partially lit and partially in darkness.
- Added apiMeta data
- Submitted to one-click
Usage:
Select a token and type:
!checkLight
Example output:
Limitations:
- The blocking check for walls is currently a simple center-to-center check. If the center of a token has unblocked LOS to the center of a light-emitting token, it is considered to be lit by that emitter.
- Tokens which are partially lit and partially in darkness will be reported as 'partially lit by...'. There are all kinds of edge cases where this could deliver odd results, like a massive token being partially lit by multiple sources being reported as being in 100% light despite the center of the token being in darkness.
External Usage:
The total illumination on a target can be called from Plugger, part of the Meta Toolbox. Details in the v0.4.1 post.
checkLightLevel can also be called from other scripts:
checkLightLevel.isLitBy(tokenOrTokenId)
Example return:
{
bright: false,
dim: [<token>, <token>],
daylight: 0.3,
total: 0.75,
partial: false,
}
This would indicate a token lit by 2 dim sources, with a map daylight setting of 30%, with a total illumination of 75%. At least one of the sources is illuminating the entire token.
Changes:
v0.3.0:
- Added support for one way walls
- Added public method to call the script from other scripts
v0.4.1:
- dim light falloff calculations
- additive light sources
- minor metamancy
- tokens on gmLayer no longer included in light calcs
- see post for details
v0.5.0:
- implemented 'partially lit' check for tokens on the edge of a light source