Shared Vision

Shared Vision is a module that provides an easy way to share vision between multiple tokens.
By default, you can do this in Foundry by giving every player observer permissions, but in that case tokens will only share vision if the player has no tokens selected.
Shared Vision allows you to configure actors so they will always share their vision, or only when you press a control button, or when it's triggered by Trigger Happy or Hey, Wait!

Besides sharing the vision of all players tokens with all players, you could specify with what player the actor should share its vision. This could be useful if a player controls multiple tokens, such as familiars.

A control button allows you to easily toggle vision sharing for all players for specified actors (Global Shared Vision). The reasoning behind this is that, when dungeon delving, the player in the back of the marching order will miss out on all the awesome stuff that's happening at the front. The GM might have prepared an awesome cut-scene, with vivid descriptions, but the wizard at the back isn't in the same room yet as the fighter in the front, so the wizard's player is missing out on all the action!
Shared Vision allows the GM to press a button, and the vision between specified tokens will be shared with all players, so everyone gets to enjoy the cool stuff at the front.

Instructions

Module Settings

Besides the help button that got you to this screen, you can enable always-on (also if you've not selected the token or if the token is invisible) vision sharing for each actor permission level. Simply check the box for the permission level you want.
For example, if you always want to share vision with all tokens with permission level 'Observer', just check the box next to 'Actor Permission: Observer'.

Vision Config

To configure which tokens should share their vision, you must go to the 'Vision Config' for the actor of that token.
You can find this screen by selecting the 'Actors Directory' in the sidebar, right-clicking the actor, and pressing 'Shared Vision'. The 'Vision Config' screen will now open.

The 'Global Shared Vision' checkbox determines if this actor should share its vision if the 'Global Shared Vision' control button is enabled.

Ticking the 'Share Hidden' checkbox will result in the actor sharing its vision even if the actor's tokens are hidden/invisible.
You could, for example, add invisible tokens to a spot where you want everyone to be able to see.

Below that you'll find a checkbox next to each (non GM) user's name, checking these boxes will always share that actors vision with the specific users, regardless of whether 'Global Shared Vision' is enabled.

Players do not need to have any permissions in order for the tokens to share their view. This will also work if the token is an NPC.

Control Button

You can enable or disable 'Global Shared Vision' using a control button in the 'Basic Controls'. This only shares the vision for actors where you've checked 'Global Shared Vision' in the actor's 'Permission Configuration' screen.
The control button has an eye icon, and is toggleable.

Trigger Happy

Trigger Happy can add triggers to Foundry, for example when a token moves onto another token, or when it is clicked. Global Shared Vision can be triggered through Trigger Happy on a 'click' or 'move' trigger.
You set this up like you would any other trigger, and you add 'shareVision=true', 'shareVision=false' or 'shareVision=toggle' to the '@Trigger' pseudo link.

Example:
To enable Global Shared Vision when a token moves unto another token called 'test', you use:
'@Token[test] @Trigger[move shareVision=true]'

For more info on how to use Trigger Happy, please read the documentation.

Hey, Wait!

Hey, Wait! allows you to place a tile on the scene, and when a token moves onto that tile, the game pauses and the scene shifts to the player's token.
You can set Shared Vision up to enable Global Shared Vision when Hey, Wait! is triggered.

Follow the Hey, Wait! instructions to create a 'Hey, Wait! tile'.
Selecting and then right-clicking this tile will open the HUD which will show the eye icon. Pressing this icon will enable Global Shared Vision on the Hey, Wait! trigger.

Triggering using hooks

If you want to enable or disable the Global Shared Vision using macros or a different module, you can call the following hooks:

Enable: Hooks.call("setShareVision",{enable:true})
Disable: Hooks.call("setShareVision",{enable:false})
Toggle: Hooks.call("setShareVision",{enable:'toggle'})

Module Compatibility

Shared Vision overrides the default 'Token.prototype._isVisionSource' method while vision sharing is enabled. This could cause conflicts with other modules.
For this reason, libWrapper was implemented.

Midi QOL has the 'Players control owned hidden tokens' setting that could cause issues. By default it should work fine, but if you have libWrapper installed and Midi QOL is set to a higher priority than Shared Vision, Shared Vision will no longer work.

Feedback

If you have any suggestions or bugs to report, feel free to submit an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.

Credits

Author: Cristian Deenen (Cris#6864 on Discord)

Special thanks to Calego#0914 and Cole#9640 for helping me out!

If you enjoy using my modules, please consider supporting me on Patreon.