PDA

View Full Version : Finding spells in modules different between FGC and FGU?



darrenan
November 23rd, 2020, 00:07
My PF2CreatureParser extension uses the following function to find modules containing spells:



function InitSpellNodes()
addToParseLog("InitSpellNodes starting...");

-- Find any modules with spells available.
aSpellNodes = {};
for _,v in pairs(Module.getModules()) do
local aModule = Module.getModuleInfo(v);
addToParseLog("Checking " .. aModule.name);
if aModule.loaded and aModule.hasdata then
local nodeRoot = DB.getRoot(aModule.name);
local nodeSpells = DB.findNode("reference.spells@" .. aModule.name);
if nodeSpells then
addToParseLog("Loaded spells from " .. aModule.name);
table.insert(aSpellNodes, nodeSpells);
end
end
end

addToParseLog("InitSpellNodes complete.");
end


When I have the PF2 Core Rulebook module loaded this code works correctly in FGC (i.e. it outputs the 'Loaded spells...' message to the parselog), but not in FGU. Is this a known issue? Is there a more compatible way of doing what I'm trying to do?

Moon Wizard
November 23rd, 2020, 00:35
The hasdata and hastokens has been deprecated in FGU; since they are not needed. If you remove the aModule.hasdata check; then it should still work in both.

Regards,
JPG

darrenan
November 23rd, 2020, 00:42
Roger that, thanks.