initial commit
This commit is contained in:
parent
11165fe7a3
commit
1d8d91e3ef
@ -19,6 +19,31 @@
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2038486957000850722/37F0D4848BA08788F79DB2D3FB6D11429CB1F861/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Guardian-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638881117/169F4520A94FB186B54E0F2BF4BAC809844C923E/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Mystic-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880413/B59966123EA41649EDCBD614167E590C8C105582/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Rogue-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Seeker-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Survivor-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880687/EEDF8F8BC3266069FECB09775845BE2501310C17/"
|
||||
},
|
||||
{
|
||||
"Name": "NavigationOverlayIcon",
|
||||
"Type": 0,
|
||||
|
@ -1 +1 @@
|
||||
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":false,"showSearchAssistant":false,"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}
|
||||
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":false,"showSearchAssistant":false,"showTitleSplash":true,"useClassTexture":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}
|
||||
|
@ -1 +1 @@
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"White","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isClassTextureEnabled":true,"isDrawButtonVisible":false,"playerColor":"White","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
|
@ -1 +1 @@
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Orange","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isClassTextureEnabled":true,"isDrawButtonVisible":false,"playerColor":"Orange","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
|
@ -1 +1 @@
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Green","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isClassTextureEnabled":true,"isDrawButtonVisible":false,"playerColor":"Green","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
|
@ -1 +1 @@
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Red","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
{"activeInvestigatorClass":"Neutral","activeInvestigatorId":"00000","isClassTextureEnabled":true,"isDrawButtonVisible":false,"playerColor":"Red","slotData":["any","any","any","Tarot","Hand (left)","Hand (right)","Ally","any","any","any","Accessory","Arcane","Arcane","Body"]}
|
||||
|
@ -482,7 +482,6 @@ do
|
||||
---@param uri table
|
||||
---@param on_success fun(status, vararg): boolean, any
|
||||
---@param on_error nil|fun(status, vararg): string
|
||||
---@vararg any
|
||||
---@return Request
|
||||
function Request.start(uri, on_success, on_error, ...)
|
||||
local parameters = table.pack(...)
|
||||
@ -497,7 +496,6 @@ do
|
||||
---@param requests Request[]
|
||||
---@param on_success fun(content: any, vararg: any)
|
||||
---@param on_error fun(requests: Request, vararg: any)|nil
|
||||
---@vararg any
|
||||
function Request.with_all(requests, on_success, on_error, ...)
|
||||
local parameters = table.pack(...)
|
||||
|
||||
|
@ -1437,6 +1437,10 @@ function applyOptionPanelChange(id, state)
|
||||
elseif id == "showDrawButton" then
|
||||
playermatApi.showDrawButton(state, "All")
|
||||
|
||||
-- option: Use class texture
|
||||
elseif id == "useClassTexture" then
|
||||
playermatApi.useClassTexture(state, "All")
|
||||
|
||||
-- option: Clickable clue counters
|
||||
elseif id == "useClueClickers" then
|
||||
playermatApi.clickableClues(state, "All")
|
||||
@ -1580,6 +1584,7 @@ function onClick_defaultSettings()
|
||||
showHandHelper = false,
|
||||
showSearchAssistant = false,
|
||||
showTitleSplash = true,
|
||||
useClassTexture = true,
|
||||
useClueClickers = false,
|
||||
useResourceCounters = "disabled",
|
||||
useSnapTags = true
|
||||
|
@ -462,7 +462,7 @@ function addArrowLines(arrowheadPos, originPos, vectorOwner, lines)
|
||||
})
|
||||
end
|
||||
|
||||
-- count victory points on locations in play area
|
||||
-- Count victory points from locations in play area
|
||||
---@param highlightOff boolean True if highlighting should be enabled
|
||||
---@return. Returns the total amount of VP found in the play area
|
||||
function countVP(highlightOff)
|
||||
@ -488,14 +488,15 @@ function countVP(highlightOff)
|
||||
return totalVP
|
||||
end
|
||||
|
||||
-- checks if a card has clues on it, returns true if clues are on it
|
||||
-- Checks if a card has clues on it
|
||||
---@param card tts__Object Card to check for clues
|
||||
---@return boolean hasClues True if card has clues on it
|
||||
function cardHasClues(card)
|
||||
local searchResult = searchLib.onObject(card, "isClue")
|
||||
return #searchResult > 0
|
||||
end
|
||||
|
||||
-- highlights all locations in the play area without metadata
|
||||
-- Highlights all locations in the play area without metadata
|
||||
---@param state boolean True if highlighting should be enabled
|
||||
function highlightMissingData(state)
|
||||
for i, obj in pairs(missingData) do
|
||||
@ -549,7 +550,7 @@ function shiftContents(playerColor, direction)
|
||||
Wait.time(drawBaseConnections, 0.1)
|
||||
end
|
||||
|
||||
-- sets the image of the playarea
|
||||
-- Sets the image of the playarea
|
||||
---@param newURL string URL for the new surface image
|
||||
function updateSurface(newURL)
|
||||
local customInfo = self.getCustomObject()
|
||||
@ -569,6 +570,7 @@ function updateSurface(newURL)
|
||||
guid = customDataHelper.getGUID()
|
||||
end
|
||||
|
||||
self.script_state = onSave()
|
||||
self.reload()
|
||||
|
||||
if guid ~= nil then
|
||||
@ -646,7 +648,7 @@ function round(num, numDecimalPlaces)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
-- rebuilds local snap points (could be useful in the future again)
|
||||
-- Rebuilds local snap points (could be useful in the future again)
|
||||
function buildSnaps()
|
||||
local upperleft = { x = 1.53, z = -1.09 }
|
||||
local lowerright = { x = -1.53, z = 1.55 }
|
||||
|
@ -60,6 +60,16 @@ local buttonParameters = {
|
||||
font_size = 180
|
||||
}
|
||||
|
||||
-- table of texture URLs
|
||||
local nameToTexture = {
|
||||
Guardian = "http://cloud-3.steamusercontent.com/ugc/2444972799638881117/169F4520A94FB186B54E0F2BF4BAC809844C923E/",
|
||||
Mystic = "http://cloud-3.steamusercontent.com/ugc/2444972799638880413/B59966123EA41649EDCBD614167E590C8C105582/",
|
||||
Neutral = "http://cloud-3.steamusercontent.com/ugc/2462982115659543571/5D778EA4BC682DAE97E8F59A991BCF8CB3979B04/",
|
||||
Rogue = "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/",
|
||||
Seeker = "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/",
|
||||
Survivor = "http://cloud-3.steamusercontent.com/ugc/2444972799638880687/EEDF8F8BC3266069FECB09775845BE2501310C17/"
|
||||
}
|
||||
|
||||
-- translation table for slot names to characters for special font
|
||||
local slotNameToChar = {
|
||||
["any"] = "",
|
||||
@ -86,12 +96,11 @@ local defaultSlotData = {
|
||||
-- global variables for access
|
||||
activeInvestigatorClass = "Neutral"
|
||||
activeInvestigatorId = "00000"
|
||||
|
||||
local isDrawButtonVisible = false
|
||||
|
||||
-- global variable to report "Dream-Enhancing Serum" status
|
||||
hasDES = false
|
||||
|
||||
local isClassTextureEnabled = true
|
||||
local isDrawButtonVisible = false
|
||||
|
||||
-- table of type-object reference pairs of all owned objects
|
||||
local ownedObjects = {}
|
||||
local matColor = self.getMemo()
|
||||
@ -100,6 +109,7 @@ function onSave()
|
||||
return JSON.encode({
|
||||
activeInvestigatorClass = activeInvestigatorClass,
|
||||
activeInvestigatorId = activeInvestigatorId,
|
||||
isClassTextureEnabled = isClassTextureEnabled,
|
||||
isDrawButtonVisible = isDrawButtonVisible,
|
||||
playerColor = playerColor,
|
||||
slotData = slotData
|
||||
@ -111,6 +121,7 @@ function onLoad(savedData)
|
||||
local loadedData = JSON.decode(savedData)
|
||||
activeInvestigatorClass = loadedData.activeInvestigatorClass
|
||||
activeInvestigatorId = loadedData.activeInvestigatorId
|
||||
isClassTextureEnabled = loadedData.isClassTextureEnabled
|
||||
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
||||
playerColor = loadedData.playerColor
|
||||
slotData = loadedData.slotData
|
||||
@ -879,10 +890,12 @@ function maybeUpdateActiveInvestigator(card)
|
||||
notes.combatIcons,
|
||||
notes.agilityIcons
|
||||
})
|
||||
updateTexture()
|
||||
elseif activeInvestigatorId ~= "00000" then
|
||||
activeInvestigatorClass = "Neutral"
|
||||
activeInvestigatorId = "00000"
|
||||
ownedObjects.InvestigatorSkillTracker.call("updateStats", { 1, 1, 1, 1 })
|
||||
updateTexture()
|
||||
else
|
||||
return
|
||||
end
|
||||
@ -936,7 +949,7 @@ function maybeUpdateActiveInvestigator(card)
|
||||
|
||||
count[type] = count[type] + 1
|
||||
if count[type] > 2 then
|
||||
print("More than two extra tokens of the same type are not supported.")
|
||||
printToColor("More than two extra tokens of the same type are not supported.", playerColor)
|
||||
else
|
||||
local localSpawnPos = tokenSpawnPos[type][count[type]]
|
||||
local globalSpawnPos = self.positionToWorld(localSpawnPos):add(Vector(0, 0.2, 0))
|
||||
@ -950,6 +963,34 @@ function maybeUpdateActiveInvestigator(card)
|
||||
end
|
||||
end
|
||||
|
||||
-- updates the texture of the playermat
|
||||
---@param overrideName? string Force a specific texture
|
||||
function updateTexture(overrideName)
|
||||
local name = "Neutral"
|
||||
|
||||
-- use class specific texture if enabled
|
||||
if isClassTextureEnabled then
|
||||
name = activeInvestigatorClass
|
||||
end
|
||||
|
||||
-- get new texture URL
|
||||
local newUrl = nameToTexture[name]
|
||||
|
||||
-- override name if valid
|
||||
if nameToTexture[overrideName] then
|
||||
newUrl = nameToTexture[overrideName]
|
||||
end
|
||||
|
||||
-- apply texture
|
||||
local customInfo = self.getCustomObject()
|
||||
if customInfo.image ~= newUrl then
|
||||
self.script_state = onSave()
|
||||
customInfo.image = newUrl
|
||||
self.setCustomObject(customInfo)
|
||||
self.reload()
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- manipulation of owned objects
|
||||
---------------------------------------------------------
|
||||
@ -1083,6 +1124,14 @@ function clickableClues(showCounter)
|
||||
end
|
||||
end
|
||||
|
||||
-- Toggles the use of class textures
|
||||
---@param state boolean Whether the class texture should be used or not
|
||||
function useClassTexture(state)
|
||||
if state == isClassTextureEnabled then return end
|
||||
isClassTextureEnabled = state
|
||||
updateTexture()
|
||||
end
|
||||
|
||||
-- removes all clues (moving tokens to the trash and setting counters to 0)
|
||||
function removeClues()
|
||||
ownedObjects.ClueCounter.call("removeAllClues", ownedObjects.Trash)
|
||||
|
@ -225,6 +225,15 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- Toggles the use of class textures for the requested playermat
|
||||
---@param state boolean Whether the class texture should be used or not
|
||||
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||
PlayermatApi.useClassTexture = function(state, matColor)
|
||||
for _, mat in pairs(getMatForColor(matColor)) do
|
||||
mat.call("useClassTexture", state)
|
||||
end
|
||||
end
|
||||
|
||||
-- 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
|
||||
PlayermatApi.removeClues = function(matColor)
|
||||
|
@ -273,6 +273,21 @@
|
||||
</Cell>
|
||||
</Row>
|
||||
|
||||
<!-- Option: use class-specific texture -->
|
||||
<Row class="option-text"
|
||||
tooltip="Controls whether a class-specific playermat texture should be automatically loaded.">
|
||||
<Cell class="option-text">
|
||||
<Panel class="singleColumn-wrapper">
|
||||
<Text class="option-header">Use class-specific texture</Text>
|
||||
</Panel>
|
||||
</Cell>
|
||||
<Cell class="option-button">
|
||||
<Button class="optionToggle"
|
||||
id="useClassTexture"
|
||||
onClick="onClick_toggleOption"/>
|
||||
</Cell>
|
||||
</Row>
|
||||
|
||||
<!-- Option: use clickable clue-counters -->
|
||||
<Row class="option-text"
|
||||
tooltip="Instead of automatically counting clues in the respective area on your playermat,
this displays a clickable counter for clues.">
|
||||
|
Loading…
Reference in New Issue
Block a user