updated option panel save / loading
This commit is contained in:
parent
82bf62f874
commit
0025205568
@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"activeInvestigatorClass": "Neutral",
|
"activeInvestigatorData": {
|
||||||
"activeInvestigatorId": "00000",
|
"class": "Neutral",
|
||||||
|
"id": "00000"
|
||||||
|
},
|
||||||
"isClassTextureEnabled": true,
|
"isClassTextureEnabled": true,
|
||||||
"isDrawButtonVisible": false,
|
"isDrawButtonVisible": false,
|
||||||
"optionPanelData": {
|
"optionPanelData": {
|
||||||
"slotEditing": false
|
"slotEditing": false
|
||||||
},
|
},
|
||||||
|
"optionPanelVisibility": "",
|
||||||
"playerColor": "White",
|
"playerColor": "White",
|
||||||
"slotData": [
|
"slotData": [
|
||||||
"any",
|
"any",
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"activeInvestigatorClass": "Neutral",
|
"activeInvestigatorData": {
|
||||||
"activeInvestigatorId": "00000",
|
"class": "Neutral",
|
||||||
|
"id": "00000"
|
||||||
|
},
|
||||||
"isClassTextureEnabled": true,
|
"isClassTextureEnabled": true,
|
||||||
"isDrawButtonVisible": false,
|
"isDrawButtonVisible": false,
|
||||||
"optionPanelData": {
|
"optionPanelData": {
|
||||||
"slotEditing": false
|
"slotEditing": false
|
||||||
},
|
},
|
||||||
|
"optionPanelVisibility": "",
|
||||||
"playerColor": "Orange",
|
"playerColor": "Orange",
|
||||||
"slotData": [
|
"slotData": [
|
||||||
"any",
|
"any",
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"activeInvestigatorClass": "Neutral",
|
"activeInvestigatorData": {
|
||||||
"activeInvestigatorId": "00000",
|
"class": "Neutral",
|
||||||
|
"id": "00000"
|
||||||
|
},
|
||||||
"isClassTextureEnabled": true,
|
"isClassTextureEnabled": true,
|
||||||
"isDrawButtonVisible": false,
|
"isDrawButtonVisible": false,
|
||||||
"optionPanelData": {
|
"optionPanelData": {
|
||||||
"slotEditing": false
|
"slotEditing": false
|
||||||
},
|
},
|
||||||
|
"optionPanelVisibility": "",
|
||||||
"playerColor": "Green",
|
"playerColor": "Green",
|
||||||
"slotData": [
|
"slotData": [
|
||||||
"any",
|
"any",
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"activeInvestigatorClass": "Neutral",
|
"activeInvestigatorData": {
|
||||||
"activeInvestigatorId": "00000",
|
"class": "Neutral",
|
||||||
|
"id": "00000"
|
||||||
|
},
|
||||||
"isClassTextureEnabled": true,
|
"isClassTextureEnabled": true,
|
||||||
"isDrawButtonVisible": false,
|
"isDrawButtonVisible": false,
|
||||||
"optionPanelData": {
|
"optionPanelData": {
|
||||||
"slotEditing": false
|
"slotEditing": false
|
||||||
},
|
},
|
||||||
|
"optionPanelVisibility": "",
|
||||||
"playerColor": "Red",
|
"playerColor": "Red",
|
||||||
"slotData": [
|
"slotData": [
|
||||||
"any",
|
"any",
|
||||||
|
@ -356,12 +356,6 @@ function tidyPlayerMatCoroutine()
|
|||||||
maybeTrashObject(obj, trash)
|
maybeTrashObject(obj, trash)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reset "activeInvestigatorId" and "...class"
|
|
||||||
local mat = guidReferenceApi.getObjectByOwnerAndType(color, "Playermat")
|
|
||||||
mat.setVar("activeInvestigatorId", "00000")
|
|
||||||
mat.setVar("activeInvestigatorClass", "Neutral")
|
|
||||||
mat.call("updateTexture")
|
|
||||||
|
|
||||||
coWaitFrames(5)
|
coWaitFrames(5)
|
||||||
|
|
||||||
-- maybe respawn tekelili cards
|
-- maybe respawn tekelili cards
|
||||||
@ -370,6 +364,10 @@ function tidyPlayerMatCoroutine()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- reset "activeInvestigatorId" and "...class"
|
||||||
|
playermatApi.setActiveInvestigatorData("All", {class = "Neutral", id = "00000"})
|
||||||
|
playermatApi.updateTexture("All")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- mythos area cleanup
|
-- mythos area cleanup
|
||||||
|
@ -12,19 +12,19 @@ local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
|
|||||||
local availableOptions = {
|
local availableOptions = {
|
||||||
["PERSONAL SETTINGS"] = {
|
["PERSONAL SETTINGS"] = {
|
||||||
{
|
{
|
||||||
id = "slotEditing",
|
id = "slotEditing",
|
||||||
title = "Enable Slot Edit Mode",
|
title = "Enable Slot Edit Mode",
|
||||||
type = "toggle"
|
type = "toggle"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = "textureSelect",
|
id = "textureSelect",
|
||||||
title = "Select Playermat Texture",
|
title = "Select Playermat Texture",
|
||||||
type = "button"
|
type = "button"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = "handColorSelect",
|
id = "handColorSelect",
|
||||||
title = "Select Hand Color",
|
title = "Select Hand Color",
|
||||||
type = "button"
|
type = "button"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,40 +119,42 @@ local defaultSlotData = {
|
|||||||
"any", "any", "any", "Accessory", "Arcane", "Arcane", "Body"
|
"any", "any", "any", "Accessory", "Arcane", "Arcane", "Body"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- global variables for access
|
local activeInvestigatorData = {}
|
||||||
activeInvestigatorClass = "Neutral"
|
local hasDES = false
|
||||||
activeInvestigatorId = "00000"
|
|
||||||
hasDES = false
|
|
||||||
|
|
||||||
local isClassTextureEnabled = true
|
local isClassTextureEnabled = true
|
||||||
local isDrawButtonVisible = false
|
local isDrawButtonVisible = false
|
||||||
|
local optionPanelVisibility = ""
|
||||||
|
|
||||||
-- table of type-object reference pairs of all owned objects
|
-- table of type-object reference pairs of all owned objects
|
||||||
local ownedObjects = {}
|
local ownedObjects = {}
|
||||||
local matColor = self.getMemo()
|
local matColor = self.getMemo()
|
||||||
|
|
||||||
function onSave()
|
function updateSave()
|
||||||
return JSON.encode({
|
optionPanelVisibility = self.UI.getAttribute("optionPanelMain", "visibility") or ""
|
||||||
activeInvestigatorClass = activeInvestigatorClass,
|
self.script_state = JSON.encode({
|
||||||
activeInvestigatorId = activeInvestigatorId,
|
activeInvestigatorData = activeInvestigatorData,
|
||||||
isClassTextureEnabled = isClassTextureEnabled,
|
isClassTextureEnabled = isClassTextureEnabled,
|
||||||
isDrawButtonVisible = isDrawButtonVisible,
|
isDrawButtonVisible = isDrawButtonVisible,
|
||||||
optionPanelData = optionPanelData,
|
optionPanelData = optionPanelData,
|
||||||
playerColor = playerColor,
|
optionPanelVisibility = optionPanelVisibility,
|
||||||
slotData = slotData
|
playerColor = playerColor,
|
||||||
|
slotData = slotData
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
activeInvestigatorClass = loadedData.activeInvestigatorClass
|
activeInvestigatorData = loadedData.activeInvestigatorData
|
||||||
activeInvestigatorId = loadedData.activeInvestigatorId
|
isClassTextureEnabled = loadedData.isClassTextureEnabled
|
||||||
isClassTextureEnabled = loadedData.isClassTextureEnabled
|
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
||||||
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
optionPanelData = loadedData.optionPanelData
|
||||||
optionPanelData = loadedData.optionPanelData
|
optionPanelVisibility = loadedData.optionPanelVisibility
|
||||||
playerColor = loadedData.playerColor
|
playerColor = loadedData.playerColor
|
||||||
slotData = loadedData.slotData
|
slotData = loadedData.slotData
|
||||||
|
|
||||||
|
-- make sure that edit mode starts disabled
|
||||||
|
optionPanelData.slotEditing = false
|
||||||
end
|
end
|
||||||
|
|
||||||
updateMessageColor(playerColor)
|
updateMessageColor(playerColor)
|
||||||
@ -195,7 +197,7 @@ function onLoad(savedData)
|
|||||||
buttonParameters.position.z = 0.92
|
buttonParameters.position.z = 0.92
|
||||||
self.createButton(buttonParameters)
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
showDrawButton(isDrawButtonVisible)
|
showDrawButton()
|
||||||
createXML()
|
createXML()
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
Wait.time(function() collisionEnabled = true end, 0.1)
|
Wait.time(function() collisionEnabled = true end, 0.1)
|
||||||
@ -373,7 +375,7 @@ function doUpkeep(_, clickedByColor, isRightClick)
|
|||||||
|
|
||||||
-- flip investigator mini-card and summoned servitor mini-card
|
-- flip investigator mini-card and summoned servitor mini-card
|
||||||
-- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)
|
-- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)
|
||||||
local miniId = string.match(activeInvestigatorId, ".....") .. "-m"
|
local miniId = string.match(activeInvestigatorData.id, ".....") .. "-m"
|
||||||
for _, obj in ipairs(getObjects()) do
|
for _, obj in ipairs(getObjects()) do
|
||||||
if obj.type == "Card" and obj.is_face_down then
|
if obj.type == "Card" and obj.is_face_down then
|
||||||
local notes = JSON.decode(obj.getGMNotes())
|
local notes = JSON.decode(obj.getGMNotes())
|
||||||
@ -389,7 +391,7 @@ function doUpkeep(_, clickedByColor, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- gain a resource (or two if playing Jenny Barnes)
|
-- gain a resource (or two if playing Jenny Barnes)
|
||||||
if string.match(activeInvestigatorId, "%d%d%d%d%d") == "02003" then
|
if string.match(activeInvestigatorData.id, "%d%d%d%d%d") == "02003" then
|
||||||
updateCounter({ type = "ResourceCounter", modifier = 2 })
|
updateCounter({ type = "ResourceCounter", modifier = 2 })
|
||||||
printToColor("Gaining 2 resources (Jenny)", messageColor)
|
printToColor("Gaining 2 resources (Jenny)", messageColor)
|
||||||
else
|
else
|
||||||
@ -397,7 +399,7 @@ function doUpkeep(_, clickedByColor, isRightClick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- draw a card (with handling for Patrice and Forced Learning)
|
-- draw a card (with handling for Patrice and Forced Learning)
|
||||||
if activeInvestigatorId == "06005" then
|
if activeInvestigatorData.id == "06005" then
|
||||||
if forcedLearning then
|
if forcedLearning then
|
||||||
printToColor("Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'?"
|
printToColor("Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'?"
|
||||||
.. " Choose which draw replacement effect takes priority and draw cards accordingly.", messageColor)
|
.. " Choose which draw replacement effect takes priority and draw cards accordingly.", messageColor)
|
||||||
@ -434,7 +436,7 @@ function doUpkeep(_, clickedByColor, isRightClick)
|
|||||||
elseif forcedLearning then
|
elseif forcedLearning then
|
||||||
printToColor("Drawing 2 cards, discard 1 (Forced Learning)", messageColor)
|
printToColor("Drawing 2 cards, discard 1 (Forced Learning)", messageColor)
|
||||||
drawCardsWithReshuffle(2)
|
drawCardsWithReshuffle(2)
|
||||||
elseif activeInvestigatorId == "89001" then
|
elseif activeInvestigatorData.id == "89001" then
|
||||||
printToColor("Drawing 2 cards (Subject 5U-21)", messageColor)
|
printToColor("Drawing 2 cards (Subject 5U-21)", messageColor)
|
||||||
drawCardsWithReshuffle(2)
|
drawCardsWithReshuffle(2)
|
||||||
else
|
else
|
||||||
@ -764,7 +766,8 @@ function createXML()
|
|||||||
scale = scale .. " " .. scale,
|
scale = scale .. " " .. scale,
|
||||||
width = "1000",
|
width = "1000",
|
||||||
rotation = "0 0 180",
|
rotation = "0 0 180",
|
||||||
active = "false",
|
active = optionPanelVisibility ~= "",
|
||||||
|
visibility = optionPanelVisibility,
|
||||||
color = "#000000",
|
color = "#000000",
|
||||||
outlineSize = "5 5",
|
outlineSize = "5 5",
|
||||||
outline = "grey",
|
outline = "grey",
|
||||||
@ -831,7 +834,7 @@ function createXML()
|
|||||||
totalHeight = totalHeight + rowHeight.option
|
totalHeight = totalHeight + rowHeight.option
|
||||||
local optionXML = {
|
local optionXML = {
|
||||||
tag = "Row",
|
tag = "Row",
|
||||||
attributes = { preferredHeight = rowHeight.option},
|
attributes = { preferredHeight = rowHeight.option },
|
||||||
children = {
|
children = {
|
||||||
-- option title
|
-- option title
|
||||||
{
|
{
|
||||||
@ -863,7 +866,7 @@ function createXML()
|
|||||||
tag = "Button",
|
tag = "Button",
|
||||||
attributes = {
|
attributes = {
|
||||||
id = optionData.id,
|
id = optionData.id,
|
||||||
image = optionData.data == true and "option_on" or "option_off",
|
image = optionPanelData[optionData.id] and "option_on" or "option_off",
|
||||||
onClick = "onClick_toggleOption",
|
onClick = "onClick_toggleOption",
|
||||||
rectAlignment = "MiddleRight",
|
rectAlignment = "MiddleRight",
|
||||||
offsetXY = "-30 0",
|
offsetXY = "-30 0",
|
||||||
@ -907,7 +910,7 @@ function createXML()
|
|||||||
optionPanelXML.attributes.height = totalHeight
|
optionPanelXML.attributes.height = totalHeight
|
||||||
|
|
||||||
-- set correct position to align with playermat
|
-- set correct position to align with playermat
|
||||||
optionPanelXML.attributes.position = (setAsideDirection * 270) .. " " .. (- 95 + scale * totalHeight / 2) .. " -65"
|
optionPanelXML.attributes.position = (setAsideDirection * 270) .. " " .. (-95 + scale * totalHeight / 2) .. " -65"
|
||||||
|
|
||||||
self.UI.setXmlTable(xml)
|
self.UI.setXmlTable(xml)
|
||||||
end
|
end
|
||||||
@ -950,12 +953,25 @@ function onClick_handColorSelect(player)
|
|||||||
if player.color == playerColor then
|
if player.color == playerColor then
|
||||||
navigationOverlayApi.copyVisibility(playerColor, color)
|
navigationOverlayApi.copyVisibility(playerColor, color)
|
||||||
Player[playerColor].changeColor(color)
|
Player[playerColor].changeColor(color)
|
||||||
|
|
||||||
|
-- update visibility for old and new color
|
||||||
|
Global.call("changeWindowVisibilityForColorWrapper", {
|
||||||
|
color = playerColor,
|
||||||
|
windowId = "optionPanelMain",
|
||||||
|
owner = self
|
||||||
|
})
|
||||||
|
Global.call("changeWindowVisibilityForColorWrapper", {
|
||||||
|
color = color,
|
||||||
|
windowId = "optionPanelMain",
|
||||||
|
owner = self
|
||||||
|
})
|
||||||
else
|
else
|
||||||
printToColor("Updated handcolor for this playermat to " .. playerColor .. ".", player.color)
|
printToColor("Updated handcolor for this playermat to " .. playerColor .. ".", player.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update the internal variable
|
-- update the internal variable
|
||||||
playerColor = color
|
playerColor = color
|
||||||
|
updateSave()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -969,6 +985,7 @@ end
|
|||||||
|
|
||||||
function applyOptionPanelChange(id, state, clickedByColor)
|
function applyOptionPanelChange(id, state, clickedByColor)
|
||||||
optionPanelData[id] = state
|
optionPanelData[id] = state
|
||||||
|
updateSave()
|
||||||
|
|
||||||
if id == "slotEditing" then
|
if id == "slotEditing" then
|
||||||
toggleSlotEditing(_, clickedByColor)
|
toggleSlotEditing(_, clickedByColor)
|
||||||
@ -1006,6 +1023,8 @@ function toggleSlotEditing(_, clickedByColor, isRightClick)
|
|||||||
|
|
||||||
if currentlyEditingSlots then
|
if currentlyEditingSlots then
|
||||||
broadcastToColor("Click on a slot symbol (or an empty slot) to edit it.", messageColor, "Orange")
|
broadcastToColor("Click on a slot symbol (or an empty slot) to edit it.", messageColor, "Orange")
|
||||||
|
else
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1044,6 +1063,7 @@ function resetSlotSymbols()
|
|||||||
for _, slotName in ipairs(defaultSlotData) do
|
for _, slotName in ipairs(defaultSlotData) do
|
||||||
table.insert(slotData, slotName)
|
table.insert(slotData, slotName)
|
||||||
end
|
end
|
||||||
|
updateSave()
|
||||||
updateSlotSymbols()
|
updateSlotSymbols()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1088,7 +1108,7 @@ end
|
|||||||
|
|
||||||
function spawnTokensFor(object)
|
function spawnTokensFor(object)
|
||||||
local extraUses = {}
|
local extraUses = {}
|
||||||
if activeInvestigatorId == "03004" then
|
if activeInvestigatorData.id == "03004" then
|
||||||
extraUses["Charge"] = 1
|
extraUses["Charge"] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1194,9 +1214,9 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
local extraToken
|
local extraToken
|
||||||
|
|
||||||
if notes ~= nil and notes.type == "Investigator" and notes.id ~= nil then
|
if notes ~= nil and notes.type == "Investigator" and notes.id ~= nil then
|
||||||
if notes.id == activeInvestigatorId then return end
|
if notes.id == activeInvestigatorData.id then return end
|
||||||
activeInvestigatorClass = notes.class
|
activeInvestigatorData.class = notes.class
|
||||||
activeInvestigatorId = notes.id
|
activeInvestigatorData.id = notes.id
|
||||||
extraToken = notes.extraToken
|
extraToken = notes.extraToken
|
||||||
ownedObjects.InvestigatorSkillTracker.call("updateStats", {
|
ownedObjects.InvestigatorSkillTracker.call("updateStats", {
|
||||||
notes.willpowerIcons,
|
notes.willpowerIcons,
|
||||||
@ -1205,9 +1225,9 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
notes.agilityIcons
|
notes.agilityIcons
|
||||||
})
|
})
|
||||||
updateTexture()
|
updateTexture()
|
||||||
elseif activeInvestigatorId ~= "00000" then
|
elseif activeInvestigatorData.id ~= "00000" then
|
||||||
activeInvestigatorClass = "Neutral"
|
activeInvestigatorData.class = "Neutral"
|
||||||
activeInvestigatorId = "00000"
|
activeInvestigatorData.id = "00000"
|
||||||
ownedObjects.InvestigatorSkillTracker.call("updateStats", { 1, 1, 1, 1 })
|
ownedObjects.InvestigatorSkillTracker.call("updateStats", { 1, 1, 1, 1 })
|
||||||
updateTexture()
|
updateTexture()
|
||||||
else
|
else
|
||||||
@ -1235,7 +1255,8 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
|
|
||||||
tokenManager.spawnToken(pos, "universalActionAbility", self.getRotation(),
|
tokenManager.spawnToken(pos, "universalActionAbility", self.getRotation(),
|
||||||
function(spawned)
|
function(spawned)
|
||||||
spawned.call("updateClassAndSymbol", { class = activeInvestigatorClass, symbol = activeInvestigatorClass })
|
spawned.call("updateClassAndSymbol",
|
||||||
|
{ class = activeInvestigatorData.class, symbol = activeInvestigatorData.class })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1270,7 +1291,7 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
|
|
||||||
tokenManager.spawnToken(globalSpawnPos, "universalActionAbility", self.getRotation(),
|
tokenManager.spawnToken(globalSpawnPos, "universalActionAbility", self.getRotation(),
|
||||||
function(spawned)
|
function(spawned)
|
||||||
spawned.call("updateClassAndSymbol", { class = activeInvestigatorClass, symbol = str })
|
spawned.call("updateClassAndSymbol", { class = activeInvestigatorData.class, symbol = str })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1280,11 +1301,13 @@ end
|
|||||||
-- updates the texture of the playermat
|
-- updates the texture of the playermat
|
||||||
---@param overrideName? string Force a specific texture
|
---@param overrideName? string Force a specific texture
|
||||||
function updateTexture(overrideName)
|
function updateTexture(overrideName)
|
||||||
|
updateSave()
|
||||||
|
|
||||||
local name = "Neutral"
|
local name = "Neutral"
|
||||||
|
|
||||||
-- use class specific texture if enabled
|
-- use class specific texture if enabled
|
||||||
if isClassTextureEnabled then
|
if isClassTextureEnabled then
|
||||||
name = activeInvestigatorClass
|
name = activeInvestigatorData.class
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get new texture URL
|
-- get new texture URL
|
||||||
@ -1307,7 +1330,6 @@ function updateTexture(overrideName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.script_state = onSave()
|
|
||||||
customInfo.image = newUrl
|
customInfo.image = newUrl
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
self.setCustomObject(customInfo)
|
self.setCustomObject(customInfo)
|
||||||
@ -1402,9 +1424,12 @@ function getEncounterCardDrawPosition(stack)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- creates / removes the draw 1 button
|
-- creates / removes the draw 1 button
|
||||||
---@param visible boolean Whether the draw 1 button should be visible
|
---@param visible? boolean Whether the draw 1 button should be visible
|
||||||
function showDrawButton(visible)
|
function showDrawButton(visible)
|
||||||
isDrawButtonVisible = visible
|
if visible then
|
||||||
|
isDrawButtonVisible = visible
|
||||||
|
updateSave()
|
||||||
|
end
|
||||||
|
|
||||||
if isDrawButtonVisible then
|
if isDrawButtonVisible then
|
||||||
-- Draw 1 button: modified default data
|
-- Draw 1 button: modified default data
|
||||||
@ -1543,3 +1568,9 @@ function getColoredName(playerColor)
|
|||||||
-- add bb-code
|
-- add bb-code
|
||||||
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
|
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getActiveInvestigatorData() return activeInvestigatorData end
|
||||||
|
|
||||||
|
function setActiveInvestigatorData(newData) activeInvestigatorData = newData end
|
||||||
|
|
||||||
|
function getDES() return hasDES end
|
||||||
|
@ -61,7 +61,7 @@ do
|
|||||||
---@return boolean: whether DES is present on the playermat
|
---@return boolean: whether DES is present on the playermat
|
||||||
PlayermatApi.hasDES = function(matColor)
|
PlayermatApi.hasDES = function(matColor)
|
||||||
for _, mat in pairs(getMatForColor(matColor)) do
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
return mat.getVar("hasDES")
|
return mat.call("getDES")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -171,19 +171,20 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the active investigator id
|
-- Gets data about the active investigator
|
||||||
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
|
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
|
||||||
PlayermatApi.returnInvestigatorId = function(matColor)
|
PlayermatApi.getActiveInvestigatorData = function(matColor)
|
||||||
for _, mat in pairs(getMatForColor(matColor)) do
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
return mat.getVar("activeInvestigatorId")
|
return mat.call("getActiveInvestigatorData")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the class of the active investigator
|
-- Gets data about the active investigator
|
||||||
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
|
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||||
PlayermatApi.returnInvestigatorClass = function(matColor)
|
---@param newData table New active investigator data (class and id)
|
||||||
|
PlayermatApi.setActiveInvestigatorData = function(matColor, newData)
|
||||||
for _, mat in pairs(getMatForColor(matColor)) do
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
return mat.getVar("activeInvestigatorClass")
|
mat.call("setActiveInvestigatorData",newData)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -235,6 +236,15 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- updates the texture of the playermat
|
||||||
|
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||||
|
---@param overrideName? string Force a specific texture
|
||||||
|
PlayermatApi.updateTexture = function(matColor, overrideName)
|
||||||
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
|
mat.call("updateTexture", overrideName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat
|
-- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat
|
||||||
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||||
PlayermatApi.removeClues = function(matColor)
|
PlayermatApi.removeClues = function(matColor)
|
||||||
|
Loading…
Reference in New Issue
Block a user