oOve / lasers

FoundryVTT module for lasers, or lightbeams that can be colored, or reflected using mirrors.
MIT License
0 stars 1 forks source link

Lasers - Light-beams and Mirrors

FoundryVTT module for lasers, or light-beams that can be reflected using mirrors. This version implements mirrrors, light sources, prisms and sensors that interact with each other. All these "tools" are tokens, that can be rotated and moved as usual.

Laser tools

All the tools above are available in the compendium named Laser Tools.

Creating Tools from scratch:

image

image

The players does not need to have permissions to any of the tokens. If you install "pushable" tokens your players can push the mirrors or light-sources around.

The light tokens will create multiple extra light tokens that act as each reflection. It can happen that the light looses them instead of deleting them automatically. If they do, you can manually select and delete them. The image for the reflecting light token is 💢. If you wish to change this default image, you'l find it in the module's folder under media.

All tokens have a field next to the sensor checkbox that enables you to enter the name of a macro. This macro will be called every time the number of lights change on this sensor. Below is a example macro that prints out some information.

console.warn(token);
let activelights = token.document.getFlag('lasers', 'active_lights');
console.log(activelights);
if (activelights.length>0){
  // Do something exciting
  console.log("Exciting things here!");
}

Monks Active Tiles

The sensor can also trigger Monks Active tiles. The sensor will trigger all Active Tiles that contains it. Below is a simple trigger that only shows a dialog after three lights shines on it. The "current tokens" in the triggered tile will point to the lasers that currently shine on the sensor.

Both the light source and the mirrors create a small wall behind them. This wall will be rotated and moved along with the token (and deleted when the token is deleted). It may happen that these walls are left behind, in that case, manually delete them.

Macro's

To turn on/off lamps, use the following:

for (let lamp of canvas.tokens.controlled){
  let on = lamp.document.getFlag('lasers', 'is_lamp');
  lamp.document.setFlag('lasers', 'is_lamp', !on);
}

This macro will toggle on/off the laser on the currently selected tokens.

TODO:

Do you like this module?; then please support me at Patreon.

Would you like to show off your creations or ask questions about the module feel free to drop in at my discord channel