PDA

View Full Version : The Source of an effect, question why it's based on CT Actor and not the origin



celestian
January 21st, 2019, 05:28
Is there a reason why the "sSource" of an effect is set to the object in the CombatTracker with current initiative instead of the actor first determined in manager_power.lua performAction()?

I'm using EffectManager.setCustomOnEffectAddStart(adndOnEffe ctAddStart); to grab the effect and search for [$NAME] within the effect string and replace it with the name of the creature placing the effect. Only problem is it seems the default method is to use the source (rEffect.sSource) from CombatTracker current initiative and not the one where the effect is drag/dropped/used from.

I'm pretty sure it's because of this code snippet:


if User.isHost() then
nodeTempCT = CombatManager.getActiveCT();
else


From CoreRPG, manager_action_effect.lua in function onEffect(rSource, rTarget, rRoll)

Moon Wizard
January 23rd, 2019, 00:46
Not sure where the original logic was built; but probably evolved over time. Based on a little testing, it seems that if rSource exists, then that should be used as effect source (even if not PC).

I'll queue it for a future patch.

Basically, changing:


if ActorManager.getType(rSource) == "pc" then
sSourceCT = ActorManager.getCTNodeName(rSource);
end

to:


if rSource then
sSourceCT = ActorManager.getCTNodeName(rSource);
end


Cheers,
JPG

celestian
January 23rd, 2019, 04:26
Okay, was just curious. I couldn't see a reason but was thinking there might be one I couldn't see.

Thanks, I'll patch it locally for now.