adding MythosAreaAPI
This commit is contained in:
parent
ceef316adf
commit
d7f098fcc5
@ -1,3 +1,5 @@
|
|||||||
|
local mythosAreaApi = require("core/MythosAreaApi")
|
||||||
|
|
||||||
-- common parameters
|
-- common parameters
|
||||||
local buttonParameters = {}
|
local buttonParameters = {}
|
||||||
buttonParameters.function_owner = self
|
buttonParameters.function_owner = self
|
||||||
@ -89,10 +91,7 @@ function onLoad(saveState)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- grab token metadata from mythos area
|
-- grab token metadata from mythos area
|
||||||
local mythosArea = getObjectFromGUID("9f334f")
|
Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.5)
|
||||||
Wait.time(function() mythosArea.call("fireTokenDataChangedEvent") end, 0.5)
|
|
||||||
|
|
||||||
Wait.time(layout, 2)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- delete temporary tokens when destroyed
|
-- delete temporary tokens when destroyed
|
||||||
@ -263,10 +262,10 @@ end
|
|||||||
function onTokenDataChanged(parameters)
|
function onTokenDataChanged(parameters)
|
||||||
local tokenData = parameters.tokenData or {}
|
local tokenData = parameters.tokenData or {}
|
||||||
local currentScenario = parameters.currentScenario or ""
|
local currentScenario = parameters.currentScenario or ""
|
||||||
local useFrontData = parameters.useFrontData or "true"
|
local useFrontData = parameters.useFrontData or true
|
||||||
|
|
||||||
-- only update if this data is new
|
-- only update if this data is new
|
||||||
local info = currentScenario .. useFrontData
|
local info = currentScenario .. tostring(useFrontData)
|
||||||
if latestLoad == info then return end
|
if latestLoad == info then return end
|
||||||
latestLoad = info
|
latestLoad = info
|
||||||
|
|
||||||
|
@ -13,12 +13,8 @@ do
|
|||||||
|
|
||||||
-- updates the token modifiers with the provided data
|
-- updates the token modifiers with the provided data
|
||||||
---@param tokenData Table Contains the chaos token metadata
|
---@param tokenData Table Contains the chaos token metadata
|
||||||
TokenArrangerApi.onTokenDataChanged = function(tokenData, currentScenario, useFrontData)
|
TokenArrangerApi.onTokenDataChanged = function(fullData)
|
||||||
callIfExistent("onTokenDataChanged", {
|
callIfExistent("onTokenDataChanged", fullData)
|
||||||
tokenData = tokenData,
|
|
||||||
currentScenario = currentScenario,
|
|
||||||
useFrontData = useFrontData
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- deletes already laid out tokens
|
-- deletes already laid out tokens
|
||||||
|
@ -91,7 +91,17 @@ end
|
|||||||
|
|
||||||
-- fires if the scenario title or the difficulty changes
|
-- fires if the scenario title or the difficulty changes
|
||||||
function fireTokenDataChangedEvent()
|
function fireTokenDataChangedEvent()
|
||||||
tokenArrangerApi.onTokenDataChanged(tokenData, currentScenario, tostring(useFrontData))
|
local fullData = returnTokenData()
|
||||||
|
tokenArrangerApi.onTokenDataChanged(fullData)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- returns the chaos token metadata (if provided)
|
||||||
|
function returnTokenData()
|
||||||
|
return {
|
||||||
|
tokenData = tokenData,
|
||||||
|
currentScenario = currentScenario,
|
||||||
|
useFrontData = useFrontData
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple method to check if the given point is in a specified area. Local use only,
|
-- Simple method to check if the given point is in a specified area. Local use only,
|
||||||
|
11
src/core/MythosAreaApi.ttslua
Normal file
11
src/core/MythosAreaApi.ttslua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
do
|
||||||
|
local MythosAreaApi = {}
|
||||||
|
local MYTHOS_AREA_GUID = "9f334f"
|
||||||
|
|
||||||
|
-- returns the chaos token metadata (if provided through scenario reference card)
|
||||||
|
MythosAreaApi.returnTokenData = function()
|
||||||
|
return getObjectFromGUID("9f334f").call("returnTokenData")
|
||||||
|
end
|
||||||
|
|
||||||
|
return MythosAreaApi
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user