mythos area bugfix
This commit is contained in:
parent
34fa7ea7e8
commit
edc2cc6fab
@ -12,8 +12,8 @@ local tokenManager = require("core/token/TokenManager")
|
||||
-- general setup
|
||||
---------------------------------------------------------
|
||||
|
||||
ENCOUNTER_DECK_POS = {-3.93, 1, 5.76}
|
||||
ENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}
|
||||
ENCOUNTER_DECK_POS = { -3.93, 1, 5.76 }
|
||||
ENCOUNTER_DECK_DISCARD_POSITION = { -3.85, 1, 10.38 }
|
||||
|
||||
-- GUIDs that will not be interactable (e.g. parts of the table)
|
||||
local NOT_INTERACTABLE = {
|
||||
@ -36,7 +36,7 @@ chaosTokens = {}
|
||||
local chaosTokensLastMat = nil
|
||||
|
||||
local bagSearchers = {}
|
||||
local MAT_COLORS = {"White", "Orange", "Green", "Red"}
|
||||
local MAT_COLORS = { "White", "Orange", "Green", "Red" }
|
||||
local hideTitleSplashWaitFunctionId = nil
|
||||
|
||||
-- online functionality related variables
|
||||
@ -113,7 +113,12 @@ local tokenDrawingStats = {
|
||||
---------------------------------------------------------
|
||||
|
||||
-- saving state of optionPanel to restore later
|
||||
function onSave() return JSON.encode({ optionPanel = optionPanel, acknowledgedUpgradeVersions = acknowledgedUpgradeVersions }) end
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
optionPanel = optionPanel,
|
||||
acknowledgedUpgradeVersions = acknowledgedUpgradeVersions
|
||||
})
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData then
|
||||
@ -329,7 +334,7 @@ function handleStatTrackerClick(_, _, isRightClick)
|
||||
-- detect if any player drew tokens
|
||||
if foundAnyStats then
|
||||
printToAll("------------------------------")
|
||||
printToAll(squidKing .. " is an auto-fail magnet.", {255, 0, 0})
|
||||
printToAll(squidKing .. " is an auto-fail magnet.", { 255, 0, 0 })
|
||||
else
|
||||
printToAll("No tokens have been drawn yet.", "Yellow")
|
||||
end
|
||||
@ -358,11 +363,11 @@ function createSetupButtons(args)
|
||||
if data ~= nil then
|
||||
local buttonParameters = {}
|
||||
buttonParameters.function_owner = args.object
|
||||
buttonParameters.position = {0, 0.1, -0.15}
|
||||
buttonParameters.scale = {0.47, 1, 0.47}
|
||||
buttonParameters.position = { 0, 0.1, -0.15 }
|
||||
buttonParameters.scale = { 0.47, 1, 0.47 }
|
||||
buttonParameters.height = 200
|
||||
buttonParameters.width = 1150
|
||||
buttonParameters.color = {0.87, 0.8, 0.7}
|
||||
buttonParameters.color = { 0.87, 0.8, 0.7 }
|
||||
|
||||
if data.easy ~= nil then
|
||||
buttonParameters.label = "Easy"
|
||||
@ -490,7 +495,6 @@ function getChaosBagState()
|
||||
end
|
||||
|
||||
return tokens
|
||||
|
||||
end
|
||||
|
||||
-- respawns the chaos bag with a new state of tokens
|
||||
@ -519,7 +523,7 @@ function setChaosBagState(tokenList)
|
||||
-- overwrite chaos bag content and respawn it
|
||||
chaosbagData.ContainedObjects = containedObjects
|
||||
chaosbag.destruct()
|
||||
spawnObjectData({data = chaosbagData})
|
||||
spawnObjectData({ data = chaosbagData })
|
||||
|
||||
-- remove tokens that are still in play
|
||||
for _, token in pairs(chaosTokens) do
|
||||
@ -548,7 +552,7 @@ function spawnChaosToken(id)
|
||||
type = 'Custom_Tile',
|
||||
position = { 0.49, 3, 0 },
|
||||
scale = { 0.81, 1.0, 0.81 },
|
||||
rotation = {0, 270, 0},
|
||||
rotation = { 0, 270, 0 },
|
||||
callback_function = function(obj)
|
||||
obj.setName(ID_URL_MAP[id].name)
|
||||
chaosbag.putObject(obj)
|
||||
@ -598,7 +602,7 @@ function emptyChaosBag()
|
||||
|
||||
local chaosbag = findChaosBag()
|
||||
for _, object in ipairs(chaosbag.getObjects()) do
|
||||
chaosbag.takeObject({callback_function = function(item) item.destruct() end})
|
||||
chaosbag.takeObject({ callback_function = function(item) item.destruct() end })
|
||||
end
|
||||
end
|
||||
|
||||
@ -623,7 +627,7 @@ end
|
||||
function onClick_select(player, params)
|
||||
params = JSON.decode(urldecode(params))
|
||||
local url = SOURCE_REPO .. '/' .. params.url
|
||||
local request = WebRequest.get(url, function (request) complete_obj_download(request, params) end )
|
||||
local request = WebRequest.get(url, function(request) complete_obj_download(request, params) end)
|
||||
requestObj = request
|
||||
startLuaCoroutine(Global, 'downloadCoroutine')
|
||||
end
|
||||
@ -675,7 +679,8 @@ function update_list(objects)
|
||||
for _, v in ipairs(objects) do
|
||||
local s = JSON.encode(v);
|
||||
table.insert(update_children.children,
|
||||
{ tag = 'Text',
|
||||
{
|
||||
tag = 'Text',
|
||||
value = v.name,
|
||||
attributes = { onClick = 'onClick_select(' .. urlencode(JSON.encode(v)) .. ')', alignment = 'MiddleLeft' }
|
||||
})
|
||||
@ -721,10 +726,10 @@ function complete_obj_download(request, params)
|
||||
local rot = replaced_object.getRotation()
|
||||
destroyObject(replaced_object)
|
||||
Wait.frames(function()
|
||||
spawnObjectJSON({json = json, position = pos, rotation = rot})
|
||||
spawnObjectJSON({ json = json, position = pos, rotation = rot })
|
||||
end, 1)
|
||||
else
|
||||
spawnObjectJSON({json = json})
|
||||
spawnObjectJSON({ json = json })
|
||||
end
|
||||
end) then
|
||||
print('Object loaded.')
|
||||
@ -749,7 +754,7 @@ function completed_list_update(request)
|
||||
print('error: ' .. request.error)
|
||||
else
|
||||
local json_response = nil
|
||||
if pcall(function () json_response = JSON.decode(request.text) end) then
|
||||
if pcall(function() json_response = JSON.decode(request.text) end) then
|
||||
library = json_response
|
||||
update_window_content(UI.getValue('title'))
|
||||
else
|
||||
@ -774,13 +779,13 @@ end
|
||||
|
||||
function urlencode(str)
|
||||
local str = string.gsub(str, "([^A-Za-z0-9-_.~])",
|
||||
function (c) return string.format("%%%02X", string.byte(c)) end)
|
||||
function(c) return string.format("%%%02X", string.byte(c)) end)
|
||||
return str
|
||||
end
|
||||
|
||||
function urldecode(str)
|
||||
local str = string.gsub(str, "%%(%x%x)",
|
||||
function (h) return string.char(tonumber(h, 16)) end)
|
||||
function(h) return string.char(tonumber(h, 16)) end)
|
||||
return str
|
||||
end
|
||||
|
||||
@ -950,7 +955,7 @@ function spawnHelperObject(name, position, rotation)
|
||||
return
|
||||
end
|
||||
|
||||
local spawnTable = {position = position}
|
||||
local spawnTable = { position = position }
|
||||
|
||||
-- only overrride rotation if there is one provided (object's rotation used instead)
|
||||
if rotation then
|
||||
@ -1043,7 +1048,6 @@ end
|
||||
-- splash scenario title on setup
|
||||
function titleSplash(scenarioName)
|
||||
if optionPanel['showTitleSplash'] then
|
||||
|
||||
-- if there's any ongoing title being displayed, hide it and cancel the waiting function
|
||||
if hideTitleSplashWaitFunctionId then
|
||||
Wait.stop(hideTitleSplashWaitFunctionId)
|
||||
@ -1109,10 +1113,10 @@ function updateNotificationLoading()
|
||||
end
|
||||
|
||||
-- update the XML UI
|
||||
UI.setValue("notificationHeader", "New version available: ".. modMeta["latestVersion"])
|
||||
UI.setValue("notificationHeader", "New version available: " .. modMeta["latestVersion"])
|
||||
UI.setValue("releaseHighlightText", highlightText)
|
||||
UI.setAttribute("highlightRow", "preferredHeight", 20*#highlights)
|
||||
UI.setAttribute("updateNotification", "height", 20*#highlights + 125)
|
||||
UI.setAttribute("highlightRow", "preferredHeight", 20 * #highlights)
|
||||
UI.setAttribute("updateNotification", "height", 20 * #highlights + 125)
|
||||
end
|
||||
|
||||
-- triggered by clicking on the Finn Icon
|
||||
|
@ -8,7 +8,7 @@ do
|
||||
|
||||
-- returns the chaos token metadata (if provided through scenario reference card)
|
||||
MythosAreaApi.returnTokenData = function()
|
||||
getMythosArea().call("returnTokenData")
|
||||
return getMythosArea().call("returnTokenData")
|
||||
end
|
||||
|
||||
-- draw an encounter card to the requested position/rotation
|
||||
|
Loading…
Reference in New Issue
Block a user