change token lighting based on changing value on actor or an Effect embedded on the actor.
I'm attempting to add a feature to my system that makes the token glow when it's lightsaber/generic laser sword is ignited. I was able to make a custom token document class that can override the light settings, but that only updates the light settings on refresh or move. is there some way to trigger a redraw or is there a better place to implement this logic? maybe i should make a custom token class.
Solution:Jump to solution
Thanks for your response. that resembles my first attempt. what ended up working is overriding the _onUpdateDescendantDocuments method on the token document, resetting the tokenDoc, then calling updateLightSource on the token itself. i think i had to override the _onUpdateDescendantDocuments on the actor as well to make sure it picked up the changes.
3 Replies
You probably want
token.renderFlags.set({redraw:true})
. But check out the other flags, because you might be able to get away with something more specific rather than a full redraw.
I doubt you need a full subclass, although you might want it for other reasons if you are designing a system. You can hook token update or preupdate to see when a token moves or will move, and change light settings in response to that.Solution
Thanks for your response. that resembles my first attempt. what ended up working is overriding the _onUpdateDescendantDocuments method on the token document, resetting the tokenDoc, then calling updateLightSource on the token itself. i think i had to override the _onUpdateDescendantDocuments on the actor as well to make sure it picked up the changes.
@StagnuDemorte gave :vote: LeaguePoints™ to @caewok (#38 • 76)