Module using "Session.isHost" gets nil?
I've a very simple extension that lets the DM, on demand, get the "manual roll" menu popup. However I've noticed that "Session.isHost" within this extension doesn't work on CoreRPG and 5e? I tried this with the Live and Test channels. Both give me "nil"
Code:
Runtime Notice: s'manager_action_attack_onDemandManualDice.lua' | s'adnd_roll' | nil | bTRUE
Here is the specific code section. I do the same "Session.isHost" in my ruleset and it works.
Code:
function onInit()
-- replace default roll with adnd_roll to allow
-- control-dice click to prompt for manual roll
Debug.console("manager_action_attack_onDemandManualDice.lua","onInit","Initializing");
ActionsManager.roll = adnd_roll;
--
end
-- replace default roll with adnd_roll to allow
-- control-dice click to prompt for manual roll
function adnd_roll(rSource, vTargets, rRoll, bMultiTarget)
-- Debug.console("manager_action_attack_onDemandManualDice.lua","adnd_roll",rSource,vTargets,rRoll,bMultiTarget);
if #(rRoll.aDice) > 0 then
Debug.console("manager_action_attack_onDemandManualDice.lua","adnd_roll",Session.isHost,Input.isControlPressed());
if not rRoll.bTower and (OptionsManager.isOption("MANUALROLL", "on") or (Session.isHost and Input.isControlPressed())) then
local wManualRoll = Interface.openWindow("manualrolls", "");
wManualRoll.addRoll(rRoll, rSource, vTargets);
else
local rThrow = ActionsManager.buildThrow(rSource, vTargets, rRoll, bMultiTarget);
Comm.throwDice(rThrow);
end
else
if bMultiTarget then
ActionsManager.handleResolution(rRoll, rSource, vTargets);
else
ActionsManager.handleResolution(rRoll, rSource, { vTargets });
end
end
end
See the same behavior in FGU and FGC. (Yes, I tested w/o BetterMenus also :")
https://i.imgur.com/LUKXHti.png