FG-Unofficial-Developers-Guild / FG-Aura-Effect

This extension accommodates auras and AoE buffs/debuffs by adding/removing effects to other characters based on proximity.
https://www.fantasygrounds.com/forums/showthread.php?57417-5E-Aura-Effects
Other
13 stars 2 forks source link

Check distance and friend-ness once #5

Closed SoxMax closed 3 years ago

SoxMax commented 3 years ago

Based on a conversation we had on the Fantasy Grounds forms I realized we were calling Token.getDistanceBetween for every aura a character had. With this change we now store the distance & friend-ness of 2 tokens reducing the number of calls when there is more than 1 aura between them. I'm able to do this because tables in lua are passed by reference, so value of local nodeInfo persists between invocations of checkAuraApplicationAndAddOrRemove

In total with this change we should only call Token.getDistanceBetween and query the friend-ness once per combatant in the combat tracker.