bugfixes
This commit is contained in:
parent
1b02c61fed
commit
a66ad8c630
@ -189,15 +189,26 @@ function tryObjectEnterContainer(container, object)
|
||||
end
|
||||
|
||||
-- TTS event for objects that enter zones
|
||||
-- used to detect the "token discard zones" beneath the hand zones
|
||||
function onObjectEnterZone(zone, enteringObj)
|
||||
if zone.getName() ~= "TokenDiscardZone" then return end
|
||||
if tokenChecker.isChaosToken(enteringObj) then return end
|
||||
|
||||
if enteringObj.type == "Tile" and enteringObj.getMemo() and enteringObj.getLock() == false then
|
||||
local matcolor = playmatApi.getMatColorByPosition(enteringObj.getPosition())
|
||||
function onObjectEnterZone(zone, object)
|
||||
-- detect the "token discard zones" beneath the hand zones
|
||||
if zone.getName() == "TokenDiscardZone" and
|
||||
not tokenChecker.isChaosToken(object) and
|
||||
object.type == "Tile" and
|
||||
object.getMemo() and
|
||||
not object.getLock() then
|
||||
local matcolor = playmatApi.getMatColorByPosition(object.getPosition())
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash")
|
||||
trash.putObject(enteringObj)
|
||||
trash.putObject(object)
|
||||
elseif zone.type == "Hand" and object.hasTag("CardWithHelper") then
|
||||
object.clearContextMenu()
|
||||
object.call("shutOff")
|
||||
end
|
||||
end
|
||||
|
||||
-- TTS event for objects that leave zones
|
||||
function onObjectLeaveZone(zone, object)
|
||||
if zone.type == "Hand" and object.hasTag("CardWithHelper") then
|
||||
object.call("updateDisplay")
|
||||
end
|
||||
end
|
||||
|
||||
@ -1335,7 +1346,8 @@ function contentDownloadCallback(request, params)
|
||||
if pos then
|
||||
spawnTable.position = pos
|
||||
else
|
||||
broadcastToAll("Please make space in the area below the tentacle stand in the upper middle of the table and try again.", "Red")
|
||||
broadcastToAll(
|
||||
"Please make space in the area below the tentacle stand in the upper middle of the table and try again.", "Red")
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -1558,7 +1570,6 @@ function applyOptionPanelChange(id, state)
|
||||
-- update master clue counter
|
||||
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
|
||||
counter.setVar("useClickableCounters", state)
|
||||
|
||||
elseif id == "enableCardHelpers" then
|
||||
toggleCardHelpers(state)
|
||||
|
||||
|
@ -4,13 +4,9 @@ local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
|
||||
local isHelperEnabled = false
|
||||
local loopId
|
||||
|
||||
function updateSave()
|
||||
self.script_state = JSON.encode({
|
||||
isHelperEnabled = isHelperEnabled,
|
||||
loopId = loopId
|
||||
})
|
||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
@ -18,7 +14,6 @@ function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
isHelperEnabled = loadedData.isHelperEnabled
|
||||
loopId = loadedData.loopId
|
||||
end
|
||||
checkOptionPanel()
|
||||
updateDisplay()
|
||||
@ -27,15 +22,15 @@ end
|
||||
-- hide buttons and stop monitoring
|
||||
function shutOff()
|
||||
self.UI.hide("Helper")
|
||||
if loopId then Wait.stop(loopId) end
|
||||
loopId = nil
|
||||
Wait.stopAll()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
-- show buttons and begin monitoring chaos bag for curse and bless tokens
|
||||
function initialize()
|
||||
self.UI.show("Helper")
|
||||
loopId = Wait.time(maybeUpdateButtonState, 1, -1)
|
||||
maybeUpdateButtonState()
|
||||
Wait.time(maybeUpdateButtonState, 1, -1)
|
||||
updateSave()
|
||||
end
|
||||
|
||||
@ -72,10 +67,8 @@ function getBlessCurseInBag()
|
||||
local chaosBag = chaosBagApi.findChaosBag()
|
||||
|
||||
for _, v in ipairs(chaosBag.getObjects()) do
|
||||
if v.name == "Bless" then
|
||||
numInBag.Bless = numInBag.Bless + 1
|
||||
elseif v.name == "Curse" then
|
||||
numInBag.Curse = numInBag.Curse + 1
|
||||
if v.name == "Bless" or v.name == "Curse" then
|
||||
numInBag[v.name] = numInBag[v.name] + 1
|
||||
end
|
||||
end
|
||||
|
||||
@ -83,22 +76,14 @@ function getBlessCurseInBag()
|
||||
end
|
||||
|
||||
function setUiState(params)
|
||||
-- set bless state
|
||||
if params.Bless then
|
||||
self.UI.show("Bless")
|
||||
self.UI.hide("inactiveBless")
|
||||
else
|
||||
self.UI.show("inactiveBless")
|
||||
self.UI.hide("Bless")
|
||||
end
|
||||
|
||||
-- set curse state
|
||||
if params.Curse then
|
||||
self.UI.show("Curse")
|
||||
self.UI.hide("inactiveCurse")
|
||||
else
|
||||
self.UI.show("inactiveCurse")
|
||||
self.UI.hide("Curse")
|
||||
for _, tokenName in ipairs({ "Bless", "Curse" }) do
|
||||
if params[tokenName] then
|
||||
self.UI.show(tokenName)
|
||||
self.UI.hide("inactive" .. tokenName)
|
||||
else
|
||||
self.UI.show("inactive" .. tokenName)
|
||||
self.UI.hide(tokenName)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,9 +59,6 @@ end
|
||||
|
||||
function shutOff()
|
||||
self.clearButtons()
|
||||
|
||||
-- reset the z position
|
||||
buttonParameters.position.z = initialButtonPosition
|
||||
end
|
||||
|
||||
-- marks a button as active
|
||||
@ -80,6 +77,8 @@ end
|
||||
|
||||
-- Create buttons based on the button parameters
|
||||
function createButtons()
|
||||
self.clearButtons()
|
||||
|
||||
-- reset the list in case of addition of checkboxes or Refine
|
||||
hypothesisList = { 'Succeed by 3 or more', 'Fail by 2 or more' }
|
||||
|
||||
@ -96,6 +95,10 @@ function createButtons()
|
||||
end
|
||||
end
|
||||
|
||||
-- reset the z position
|
||||
buttonParameters.position.z = initialButtonPosition
|
||||
|
||||
-- actual button creation
|
||||
for i, label in ipairs(hypothesisList) do
|
||||
buttonParameters.label = label
|
||||
buttonParameters.click_function = "selectButton" .. i
|
||||
|
@ -10,13 +10,10 @@ local buttonParameters = {
|
||||
height = 175
|
||||
}
|
||||
|
||||
local modValue, loopId
|
||||
local modValue
|
||||
|
||||
function updateSave()
|
||||
self.script_state = JSON.encode({
|
||||
isHelperEnabled = isHelperEnabled,
|
||||
loopId = loopId
|
||||
})
|
||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
@ -31,24 +28,21 @@ function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
isHelperEnabled = loadedData.isHelperEnabled
|
||||
loopId = loadedData.loopId
|
||||
end
|
||||
checkOptionPanel()
|
||||
updateDisplay()
|
||||
end
|
||||
|
||||
function initialize()
|
||||
self.clearButtons()
|
||||
self.createButton(buttonParameters)
|
||||
updateButton()
|
||||
loopId = Wait.time(updateButton, 2, -1)
|
||||
Wait.time(updateButton, 2, -1)
|
||||
end
|
||||
|
||||
function shutOff()
|
||||
if loopId then
|
||||
Wait.stop(loopId)
|
||||
loopId = nil
|
||||
end
|
||||
self.clearButtons()
|
||||
Wait.stopAll()
|
||||
end
|
||||
|
||||
function updateButton()
|
||||
|
Loading…
Reference in New Issue
Block a user