2021-06-29 05:27:27 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
|
|
|
|
|
|
SPDX-License-Identifier: MIT
|
|
|
|
-->
|
|
|
|
|
|
|
|
# Darkness Dependent Vision
|
|
|
|
|
2021-06-29 21:07:13 +02:00
|
|
|
A module for [Foundry Virtual Tabletop] that provides functionality to make the
|
2021-06-29 05:27:27 +02:00
|
|
|
dim and bright vision of tokens depend on the scene's darkness level.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
To install and use the Darkness Dependent Vision module for Foundry Virtual
|
|
|
|
Tabletop, simply paste the following URL into the **Install Module** dialog on
|
|
|
|
the Setup menu of the application.
|
|
|
|
|
|
|
|
https://git.f3l.de/ghost/darkness-dependent-vision/-/raw/latest/src/module.json?inline=false
|
|
|
|
|
2021-06-29 22:08:36 +02:00
|
|
|
### libWrapper
|
|
|
|
|
|
|
|
This module uses the [libWrapper] library for wrapping core methods. It is only
|
2021-11-05 20:53:25 +01:00
|
|
|
a soft dependency (a shim is provided) but it is highly recommended installing
|
2021-06-29 22:08:36 +02:00
|
|
|
libWrapper as a module for the best experience and compatibility with other
|
|
|
|
modules.
|
|
|
|
|
2021-06-29 21:51:18 +02:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
In order to configure the darkness range in which a token has dim and bright
|
|
|
|
vision, a dialog is provided that can be accessed from a header button in the
|
|
|
|
Token Configuration:
|
|
|
|
|
|
|
|
[![Usage 1](img/usage_1.png)](img/usage_1.png)
|
2021-06-29 21:52:50 +02:00
|
|
|
|
2021-06-29 21:51:18 +02:00
|
|
|
[![Usage 2](img/usage_2.png)](img/usage_2.png)
|
|
|
|
|
|
|
|
In the next image, you can see an example of the module in action: The token is
|
2021-11-05 20:53:25 +01:00
|
|
|
configured to only have bright vision at a darkness level between 0 and 0.5, but
|
2021-06-29 21:51:18 +02:00
|
|
|
the scene's darkness level is set to 0.6, so the token has no bright vision. On
|
|
|
|
the other hand, the token is also configured to have dim vision at a darkness
|
|
|
|
level between 0 and 0.7, so it _does_ have dim vision.
|
|
|
|
|
|
|
|
[![Usage 3](img/usage_3.png)](img/usage_3.png)
|
|
|
|
|
2021-06-29 05:27:27 +02:00
|
|
|
## Development
|
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
|
|
|
In order to build this module, recent versions of `node` and `yarn` are
|
|
|
|
required. Most likely using `npm` also works but only `yarn` is officially
|
2021-11-05 20:53:25 +01:00
|
|
|
supported. We recommend using the latest lts version of `node`. If you use `nvm`
|
|
|
|
to manage your `node` versions, you can simply run
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
nvm install
|
|
|
|
```
|
|
|
|
|
|
|
|
in the project's root directory.
|
|
|
|
|
2021-11-05 20:53:25 +01:00
|
|
|
You also need to install the project's dependencies. To do so, run
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
yarn install
|
|
|
|
```
|
|
|
|
|
|
|
|
### Building
|
|
|
|
|
|
|
|
You can build the project by running
|
|
|
|
|
|
|
|
```
|
|
|
|
yarn build
|
|
|
|
```
|
|
|
|
|
|
|
|
Alternatively, you can run
|
|
|
|
|
|
|
|
```
|
|
|
|
yarn build:watch
|
|
|
|
```
|
|
|
|
|
|
|
|
to watch for changes and automatically build as necessary.
|
|
|
|
|
|
|
|
### Linking the built project to Foundry VTT
|
|
|
|
|
|
|
|
In order to provide a fluent development experience, it is recommended to link
|
|
|
|
the built module to your local Foundry VTT installation's data folder. In
|
|
|
|
order to do so, first add a file called `foundryconfig.json` to the project root
|
|
|
|
with the following content:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"dataPath": "/absolute/path/to/your/FoundryVTT/Data"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
(if you are using Windows, make sure to use `\` as a path separator instead of
|
|
|
|
`/`)
|
|
|
|
|
|
|
|
Then run
|
|
|
|
|
|
|
|
```
|
|
|
|
yarn link-project
|
|
|
|
```
|
|
|
|
|
2021-11-05 20:53:25 +01:00
|
|
|
On Windows, creating symlinks requires administrator privileges, so
|
|
|
|
unfortunately you need to run the above command in an administrator terminal for
|
|
|
|
it to work.
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
## Licensing
|
|
|
|
|
|
|
|
This project is being developed under the terms of the
|
|
|
|
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT] for Foundry Virtual Tabletop.
|
|
|
|
|
2021-06-29 21:51:18 +02:00
|
|
|
The project itself is licensed under multiple licenses. It is difficult to keep
|
|
|
|
this section up to date, so here is a brief summary as of June 2021:
|
|
|
|
* The images in [img] are licensed under [CC BY 4.0].
|
|
|
|
* The files in [.yarn] by the [Yarn] Contributors are licensed under
|
|
|
|
[BSD-2-Clause].
|
2021-06-29 22:12:03 +02:00
|
|
|
* Other files are licensed under [MIT].
|
2021-06-29 21:51:18 +02:00
|
|
|
|
|
|
|
For more accurate information, check the individual files.
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
[Foundry Virtual Tabletop]: http://foundryvtt.com
|
2021-06-29 22:08:36 +02:00
|
|
|
[libWrapper]: https://github.com/ruipin/fvtt-lib-wrapper
|
2021-06-29 21:51:18 +02:00
|
|
|
[Yarn]: https://github.com/yarnpkg/berry
|
|
|
|
|
|
|
|
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT]: https://foundryvtt.com/article/license/
|
|
|
|
[CC BY 4.0]: LICENSES/CC-BY-4.0.txt
|
2021-06-29 05:27:27 +02:00
|
|
|
[MIT]: LICENSES/MIT.txt
|
2021-06-29 21:51:18 +02:00
|
|
|
[BSD-2-Clause]: LICENSES/BSD-2-Clause.txt
|
|
|
|
|
|
|
|
[img]: img
|
|
|
|
[.yarn]: .yarn
|