jkeller
January 6th, 2026, 16:32
There seems to be a conflict between an extension I'm developing, and another one (for which I don't have the source code).
It looks like 5E (in manager_actions.lua) only supports a single PostRollHandler (instead of a list which seems better).
Also there's no get function for it, and it's local, so I can't access it (right?).
local aPostRollHandlers = {};
function registerPostRollHandler(sActionType, callback)
ActionsManager.initAction(sActionType);
aPostRollHandlers[sActionType] = callback;
end
I think a safe/compatible approach (if all extensions used it) would be something like this:
local ActionsManager_PostRollHandler = nil;
function registerHandlers()
ActionsManager_PostRollHandler = ActionsManager.aPostRollHandlers["damage"]; -- THIS DOESN'T WORK SINCE IT'S LOCAL
ActionsManager.registerPostRollHandler("damage", myOnDamageRollDecorator);
end
function unregisterHandlers()
-- only restore the old handler if this is the one currently registered
if ActionsManager.aPostRollHandlers["damage"] == myOnDamageRollDecorator then
ActionsManager.registerPostRollHandler("damage", ActionsManager_PostRollHandler);
end
ActionsManager_PostRollHandler = nil;
ActionsManager.unregisterPostRollHandler("damage", myOnDamageRollDecorator );
end
function myOnDamageRollDecorator (rSource, rRoll)
if ActionsManager_PostRollHandler then
ActionsManager_PostRollHandler(rSource, rRoll); -- call any other handler first
end
. . .
Otherwise, what are my options? I can set a high loadorder, but that's no guarantee. I'll try to work with the other extension developer of course.
It looks like 5E (in manager_actions.lua) only supports a single PostRollHandler (instead of a list which seems better).
Also there's no get function for it, and it's local, so I can't access it (right?).
local aPostRollHandlers = {};
function registerPostRollHandler(sActionType, callback)
ActionsManager.initAction(sActionType);
aPostRollHandlers[sActionType] = callback;
end
I think a safe/compatible approach (if all extensions used it) would be something like this:
local ActionsManager_PostRollHandler = nil;
function registerHandlers()
ActionsManager_PostRollHandler = ActionsManager.aPostRollHandlers["damage"]; -- THIS DOESN'T WORK SINCE IT'S LOCAL
ActionsManager.registerPostRollHandler("damage", myOnDamageRollDecorator);
end
function unregisterHandlers()
-- only restore the old handler if this is the one currently registered
if ActionsManager.aPostRollHandlers["damage"] == myOnDamageRollDecorator then
ActionsManager.registerPostRollHandler("damage", ActionsManager_PostRollHandler);
end
ActionsManager_PostRollHandler = nil;
ActionsManager.unregisterPostRollHandler("damage", myOnDamageRollDecorator );
end
function myOnDamageRollDecorator (rSource, rRoll)
if ActionsManager_PostRollHandler then
ActionsManager_PostRollHandler(rSource, rRoll); -- call any other handler first
end
. . .
Otherwise, what are my options? I can set a high loadorder, but that's no guarantee. I'll try to work with the other extension developer of course.