initial commit
This commit is contained in:
parent
11165fe7a3
commit
1d8d91e3ef
@ -19,6 +19,31 @@
|
|||||||
"Type": 0,
|
"Type": 0,
|
||||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2038486957000850722/37F0D4848BA08788F79DB2D3FB6D11429CB1F861/"
|
"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",
|
"Name": "NavigationOverlayIcon",
|
||||||
"Type": 0,
|
"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 uri table
|
||||||
---@param on_success fun(status, vararg): boolean, any
|
---@param on_success fun(status, vararg): boolean, any
|
||||||
---@param on_error nil|fun(status, vararg): string
|
---@param on_error nil|fun(status, vararg): string
|
||||||
---@vararg any
|
|
||||||
---@return Request
|
---@return Request
|
||||||
function Request.start(uri, on_success, on_error, ...)
|
function Request.start(uri, on_success, on_error, ...)
|
||||||
local parameters = table.pack(...)
|
local parameters = table.pack(...)
|
||||||
@ -497,7 +496,6 @@ do
|
|||||||
---@param requests Request[]
|
---@param requests Request[]
|
||||||
---@param on_success fun(content: any, vararg: any)
|
---@param on_success fun(content: any, vararg: any)
|
||||||
---@param on_error fun(requests: Request, vararg: any)|nil
|
---@param on_error fun(requests: Request, vararg: any)|nil
|
||||||
---@vararg any
|
|
||||||
function Request.with_all(requests, on_success, on_error, ...)
|
function Request.with_all(requests, on_success, on_error, ...)
|
||||||
local parameters = table.pack(...)
|
local parameters = table.pack(...)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
|
|
||||||
local ZONE, TRASH
|
local ZONE, TRASH
|
||||||
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
|
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
|
||||||
local IGNORE_TAG = "DoomCounter_ignore"
|
local IGNORE_TAG = "DoomCounter_ignore"
|
||||||
local TOTAL_PLAY_AREA = {
|
local TOTAL_PLAY_AREA = {
|
||||||
upperLeft = {
|
upperLeft = {
|
||||||
x = -9,
|
x = -9,
|
||||||
z = -35
|
z = -35
|
||||||
@ -67,14 +67,14 @@ end
|
|||||||
function removeDoom(options)
|
function removeDoom(options)
|
||||||
if options.Playermats then
|
if options.Playermats then
|
||||||
local count = removeDoomFromList(playermatApi.searchAroundPlayermat("All"))
|
local count = removeDoomFromList(playermatApi.searchAroundPlayermat("All"))
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
broadcastToAll(count .. " doom removed from playermats.", "White")
|
broadcastToAll(count .. " doom removed from playermats.", "White")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.Playarea then
|
if options.Playarea then
|
||||||
local count = removeDoomFromList(ZONE.getObjects())
|
local count = removeDoomFromList(ZONE.getObjects())
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
broadcastToAll(count .. " doom removed from play area.", "White")
|
broadcastToAll(count .. " doom removed from play area.", "White")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -96,7 +96,7 @@ end
|
|||||||
-- helper function to check if a position is inside an area
|
-- helper function to check if a position is inside an area
|
||||||
function inArea(point, bounds)
|
function inArea(point, bounds)
|
||||||
return (point.x < bounds.upperLeft.x
|
return (point.x < bounds.upperLeft.x
|
||||||
and point.x > bounds.lowerRight.x
|
and point.x > bounds.lowerRight.x
|
||||||
and point.z > bounds.upperLeft.z
|
and point.z > bounds.upperLeft.z
|
||||||
and point.z < bounds.lowerRight.z)
|
and point.z < bounds.lowerRight.z)
|
||||||
end
|
end
|
||||||
|
@ -18,14 +18,14 @@ function onLoad()
|
|||||||
if string.match(notes, "................") == "campaigns/return" then
|
if string.match(notes, "................") == "campaigns/return" then
|
||||||
buttonParameters.position.z = 2
|
buttonParameters.position.z = 2
|
||||||
|
|
||||||
-- official campaign boxes
|
-- official campaign boxes
|
||||||
elseif string.match(notes, ".........") == "campaigns" or self.hasTag("LargeBox") then
|
elseif string.match(notes, ".........") == "campaigns" or self.hasTag("LargeBox") then
|
||||||
buttonParameters.position.z = 6
|
buttonParameters.position.z = 6
|
||||||
buttonParameters.height = 500
|
buttonParameters.height = 500
|
||||||
buttonParameters.width = 1700
|
buttonParameters.width = 1700
|
||||||
buttonParameters.font_size = 350
|
buttonParameters.font_size = 350
|
||||||
|
|
||||||
-- investigator boxes
|
-- investigator boxes
|
||||||
elseif string.match(notes, ".............") == "investigators" then
|
elseif string.match(notes, ".............") == "investigators" then
|
||||||
buttonParameters.position.z = 7
|
buttonParameters.position.z = 7
|
||||||
buttonParameters.height = 850
|
buttonParameters.height = 850
|
||||||
|
@ -1433,11 +1433,15 @@ function applyOptionPanelChange(id, state)
|
|||||||
if id == "useSnapTags" then
|
if id == "useSnapTags" then
|
||||||
playermatApi.setLimitSnapsByType(state, "All")
|
playermatApi.setLimitSnapsByType(state, "All")
|
||||||
|
|
||||||
-- option: Draw 1 button
|
-- option: Draw 1 button
|
||||||
elseif id == "showDrawButton" then
|
elseif id == "showDrawButton" then
|
||||||
playermatApi.showDrawButton(state, "All")
|
playermatApi.showDrawButton(state, "All")
|
||||||
|
|
||||||
-- option: Clickable clue counters
|
-- option: Use class texture
|
||||||
|
elseif id == "useClassTexture" then
|
||||||
|
playermatApi.useClassTexture(state, "All")
|
||||||
|
|
||||||
|
-- option: Clickable clue counters
|
||||||
elseif id == "useClueClickers" then
|
elseif id == "useClueClickers" then
|
||||||
playermatApi.clickableClues(state, "All")
|
playermatApi.clickableClues(state, "All")
|
||||||
|
|
||||||
@ -1445,40 +1449,40 @@ function applyOptionPanelChange(id, state)
|
|||||||
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
|
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
|
||||||
counter.setVar("useClickableCounters", state)
|
counter.setVar("useClickableCounters", state)
|
||||||
|
|
||||||
-- option: Play area connection drawing
|
-- option: Play area connection drawing
|
||||||
elseif id == "playAreaConnections" then
|
elseif id == "playAreaConnections" then
|
||||||
playAreaApi.setConnectionDrawState(state)
|
playAreaApi.setConnectionDrawState(state)
|
||||||
|
|
||||||
-- option: Play area connection color
|
-- option: Play area connection color
|
||||||
elseif id == "playAreaConnectionColor" then
|
elseif id == "playAreaConnectionColor" then
|
||||||
playAreaApi.setConnectionColor(state)
|
playAreaApi.setConnectionColor(state)
|
||||||
UI.setAttribute(id, "color", "#" .. Color.new(state):toHex())
|
UI.setAttribute(id, "color", "#" .. Color.new(state):toHex())
|
||||||
|
|
||||||
-- option: Play area snap tags
|
-- option: Play area snap tags
|
||||||
elseif id == "playAreaSnapTags" then
|
elseif id == "playAreaSnapTags" then
|
||||||
playAreaApi.setLimitSnapsByType(state)
|
playAreaApi.setLimitSnapsByType(state)
|
||||||
|
|
||||||
-- option: Show clean up helper
|
-- option: Show clean up helper
|
||||||
elseif id == "showCleanUpHelper" then
|
elseif id == "showCleanUpHelper" then
|
||||||
spawnOrRemoveHelper(state, "Clean Up Helper", { -66, 1.53, 46 })
|
spawnOrRemoveHelper(state, "Clean Up Helper", { -66, 1.53, 46 })
|
||||||
|
|
||||||
-- option: Show hand helper for each player
|
-- option: Show hand helper for each player
|
||||||
elseif id == "showHandHelper" then
|
elseif id == "showHandHelper" then
|
||||||
spawnOrRemoveHelperForPlayermats("Hand Helper", state)
|
spawnOrRemoveHelperForPlayermats("Hand Helper", state)
|
||||||
|
|
||||||
-- option: Show search assistant for each player
|
-- option: Show search assistant for each player
|
||||||
elseif id == "showSearchAssistant" then
|
elseif id == "showSearchAssistant" then
|
||||||
spawnOrRemoveHelperForPlayermats("Search Assistant", state)
|
spawnOrRemoveHelperForPlayermats("Search Assistant", state)
|
||||||
|
|
||||||
-- option: Show attachment helper
|
-- option: Show attachment helper
|
||||||
elseif id == "showAttachmentHelper" then
|
elseif id == "showAttachmentHelper" then
|
||||||
spawnOrRemoveHelper(state, "Attachment Helper", { -62, 1.4, 0 })
|
spawnOrRemoveHelper(state, "Attachment Helper", { -62, 1.4, 0 })
|
||||||
|
|
||||||
-- option: Show CYOA campaign guides
|
-- option: Show CYOA campaign guides
|
||||||
elseif id == "showCYOA" then
|
elseif id == "showCYOA" then
|
||||||
spawnOrRemoveHelper(state, "CYOA Campaign Guides", { 39, 1.3, -20 })
|
spawnOrRemoveHelper(state, "CYOA Campaign Guides", { 39, 1.3, -20 })
|
||||||
|
|
||||||
-- option: Show displacement tool
|
-- option: Show displacement tool
|
||||||
elseif id == "showDisplacementTool" then
|
elseif id == "showDisplacementTool" then
|
||||||
spawnOrRemoveHelper(state, "Displacement Tool", { -57, 1.53, 46 })
|
spawnOrRemoveHelper(state, "Displacement Tool", { -57, 1.53, 46 })
|
||||||
end
|
end
|
||||||
@ -1580,6 +1584,7 @@ function onClick_defaultSettings()
|
|||||||
showHandHelper = false,
|
showHandHelper = false,
|
||||||
showSearchAssistant = false,
|
showSearchAssistant = false,
|
||||||
showTitleSplash = true,
|
showTitleSplash = true,
|
||||||
|
useClassTexture = true,
|
||||||
useClueClickers = false,
|
useClueClickers = false,
|
||||||
useResourceCounters = "disabled",
|
useResourceCounters = "disabled",
|
||||||
useSnapTags = true
|
useSnapTags = true
|
||||||
|
@ -133,7 +133,7 @@ function onObjectPickUp(_, object)
|
|||||||
local metadata = JSON.decode(object.getGMNotes()) or {}
|
local metadata = JSON.decode(object.getGMNotes()) or {}
|
||||||
if metadata.type == "Location" then
|
if metadata.type == "Location" then
|
||||||
-- onCollisionExit sometimes comes 1 frame after onObjectPickUp (rather than before it or in
|
-- onCollisionExit sometimes comes 1 frame after onObjectPickUp (rather than before it or in
|
||||||
-- the same frame). This causes a mismatch in the data between dragging the on-table, and
|
-- the same frame). This causes a mismatch in the data between dragging the on-table, and
|
||||||
-- that one frame draws connectors on the card which then show up as shadows for snap points.
|
-- that one frame draws connectors on the card which then show up as shadows for snap points.
|
||||||
-- Waiting ensures we always do thing in the expected Exit->PickUp order
|
-- Waiting ensures we always do thing in the expected Exit->PickUp order
|
||||||
Wait.frames(function()
|
Wait.frames(function()
|
||||||
@ -240,7 +240,7 @@ end
|
|||||||
---@param card tts__Object Card to (maybe) stop tracking
|
---@param card tts__Object Card to (maybe) stop tracking
|
||||||
function maybeUntrackLocation(card)
|
function maybeUntrackLocation(card)
|
||||||
-- Locked objects no longer collide (hence triggering an exit event) but are still in the play
|
-- Locked objects no longer collide (hence triggering an exit event) but are still in the play
|
||||||
-- area. If the object is now locked, don't remove it.
|
-- area. If the object is now locked, don't remove it.
|
||||||
if locations[card.getGUID()] ~= nil and not card.locked then
|
if locations[card.getGUID()] ~= nil and not card.locked then
|
||||||
locations[card.getGUID()] = nil
|
locations[card.getGUID()] = nil
|
||||||
rebuildConnectionList()
|
rebuildConnectionList()
|
||||||
@ -415,7 +415,7 @@ end
|
|||||||
---@param target tts__Object Target card object to connect
|
---@param target tts__Object Target card object to connect
|
||||||
---@param vectorOwner tts__Object The object which these lines will be set to. Used for relative
|
---@param vectorOwner tts__Object The object which these lines will be set to. Used for relative
|
||||||
--- positioning and scaling, as well as highlighting connections during a drag operation
|
--- positioning and scaling, as well as highlighting connections during a drag operation
|
||||||
---@param lines table List of vector line elements. Mutable, will be updated to add this connector
|
---@param lines table List of vector line elements. Mutable, will be updated to add this connector
|
||||||
function addOneWayVector(origin, target, vectorOwner, lines)
|
function addOneWayVector(origin, target, vectorOwner, lines)
|
||||||
-- Start with the BiDi then add the arrow lines to it
|
-- Start with the BiDi then add the arrow lines to it
|
||||||
addBidirectionalVector(origin, target, vectorOwner, lines)
|
addBidirectionalVector(origin, target, vectorOwner, lines)
|
||||||
@ -445,9 +445,9 @@ end
|
|||||||
-- Draws an arrowhead at the given position.
|
-- Draws an arrowhead at the given position.
|
||||||
---@param arrowheadPos tts__Vector Centerpoint of the arrowhead to draw (NOT the tip of the arrow)
|
---@param arrowheadPos tts__Vector Centerpoint of the arrowhead to draw (NOT the tip of the arrow)
|
||||||
---@param originPos tts__Vector Origin point of the connection, used to position the arrow arms
|
---@param originPos tts__Vector Origin point of the connection, used to position the arrow arms
|
||||||
---@param vectorOwner tts__Object The object which these lines will be set to. Used for relative
|
---@param vectorOwner tts__Object The object which these lines will be set to. Used for relative
|
||||||
--- positioning and scaling, as well as highlighting connections during a drag operation
|
--- positioning and scaling, as well as highlighting connections during a drag operation
|
||||||
---@param lines table List of vector line elements. Mutable, will be updated to add this arrow
|
---@param lines table List of vector line elements. Mutable, will be updated to add this arrow
|
||||||
function addArrowLines(arrowheadPos, originPos, vectorOwner, lines)
|
function addArrowLines(arrowheadPos, originPos, vectorOwner, lines)
|
||||||
local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", -1 * ARROW_ANGLE):add(arrowheadPos)
|
local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", -1 * ARROW_ANGLE):add(arrowheadPos)
|
||||||
local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", ARROW_ANGLE):add(arrowheadPos)
|
local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", ARROW_ANGLE):add(arrowheadPos)
|
||||||
@ -462,7 +462,7 @@ function addArrowLines(arrowheadPos, originPos, vectorOwner, lines)
|
|||||||
})
|
})
|
||||||
end
|
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
|
---@param highlightOff boolean True if highlighting should be enabled
|
||||||
---@return. Returns the total amount of VP found in the play area
|
---@return. Returns the total amount of VP found in the play area
|
||||||
function countVP(highlightOff)
|
function countVP(highlightOff)
|
||||||
@ -488,14 +488,15 @@ function countVP(highlightOff)
|
|||||||
return totalVP
|
return totalVP
|
||||||
end
|
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
|
---@param card tts__Object Card to check for clues
|
||||||
|
---@return boolean hasClues True if card has clues on it
|
||||||
function cardHasClues(card)
|
function cardHasClues(card)
|
||||||
local searchResult = searchLib.onObject(card, "isClue")
|
local searchResult = searchLib.onObject(card, "isClue")
|
||||||
return #searchResult > 0
|
return #searchResult > 0
|
||||||
end
|
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
|
---@param state boolean True if highlighting should be enabled
|
||||||
function highlightMissingData(state)
|
function highlightMissingData(state)
|
||||||
for i, obj in pairs(missingData) do
|
for i, obj in pairs(missingData) do
|
||||||
@ -549,7 +550,7 @@ function shiftContents(playerColor, direction)
|
|||||||
Wait.time(drawBaseConnections, 0.1)
|
Wait.time(drawBaseConnections, 0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- sets the image of the playarea
|
-- Sets the image of the playarea
|
||||||
---@param newURL string URL for the new surface image
|
---@param newURL string URL for the new surface image
|
||||||
function updateSurface(newURL)
|
function updateSurface(newURL)
|
||||||
local customInfo = self.getCustomObject()
|
local customInfo = self.getCustomObject()
|
||||||
@ -569,6 +570,7 @@ function updateSurface(newURL)
|
|||||||
guid = customDataHelper.getGUID()
|
guid = customDataHelper.getGUID()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.script_state = onSave()
|
||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
if guid ~= nil then
|
if guid ~= nil then
|
||||||
@ -646,7 +648,7 @@ function round(num, numDecimalPlaces)
|
|||||||
return math.floor(num * mult + 0.5) / mult
|
return math.floor(num * mult + 0.5) / mult
|
||||||
end
|
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()
|
function buildSnaps()
|
||||||
local upperleft = { x = 1.53, z = -1.09 }
|
local upperleft = { x = 1.53, z = -1.09 }
|
||||||
local lowerright = { x = -1.53, z = 1.55 }
|
local lowerright = { x = -1.53, z = 1.55 }
|
||||||
|
@ -192,7 +192,7 @@ end
|
|||||||
function getPlainName(str)
|
function getPlainName(str)
|
||||||
-- remove prefix type 1
|
-- remove prefix type 1
|
||||||
str = str:gsub("%w+%-%w%s%-%s", "") -- matches "II-B - Thousand Shapes of Horror 1"
|
str = str:gsub("%w+%-%w%s%-%s", "") -- matches "II-B - Thousand Shapes of Horror 1"
|
||||||
|
|
||||||
-- remove prefix type 2
|
-- remove prefix type 2
|
||||||
str = str:gsub("%w+%-%w%s", "") -- matches "59-Z Congress of Keys 1"
|
str = str:gsub("%w+%-%w%s", "") -- matches "59-Z Congress of Keys 1"
|
||||||
|
|
||||||
|
@ -60,6 +60,16 @@ local buttonParameters = {
|
|||||||
font_size = 180
|
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
|
-- translation table for slot names to characters for special font
|
||||||
local slotNameToChar = {
|
local slotNameToChar = {
|
||||||
["any"] = "",
|
["any"] = "",
|
||||||
@ -86,12 +96,11 @@ local defaultSlotData = {
|
|||||||
-- global variables for access
|
-- global variables for access
|
||||||
activeInvestigatorClass = "Neutral"
|
activeInvestigatorClass = "Neutral"
|
||||||
activeInvestigatorId = "00000"
|
activeInvestigatorId = "00000"
|
||||||
|
|
||||||
local isDrawButtonVisible = false
|
|
||||||
|
|
||||||
-- global variable to report "Dream-Enhancing Serum" status
|
|
||||||
hasDES = false
|
hasDES = false
|
||||||
|
|
||||||
|
local isClassTextureEnabled = true
|
||||||
|
local isDrawButtonVisible = false
|
||||||
|
|
||||||
-- 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()
|
||||||
@ -100,6 +109,7 @@ function onSave()
|
|||||||
return JSON.encode({
|
return JSON.encode({
|
||||||
activeInvestigatorClass = activeInvestigatorClass,
|
activeInvestigatorClass = activeInvestigatorClass,
|
||||||
activeInvestigatorId = activeInvestigatorId,
|
activeInvestigatorId = activeInvestigatorId,
|
||||||
|
isClassTextureEnabled = isClassTextureEnabled,
|
||||||
isDrawButtonVisible = isDrawButtonVisible,
|
isDrawButtonVisible = isDrawButtonVisible,
|
||||||
playerColor = playerColor,
|
playerColor = playerColor,
|
||||||
slotData = slotData
|
slotData = slotData
|
||||||
@ -111,6 +121,7 @@ function onLoad(savedData)
|
|||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
activeInvestigatorClass = loadedData.activeInvestigatorClass
|
activeInvestigatorClass = loadedData.activeInvestigatorClass
|
||||||
activeInvestigatorId = loadedData.activeInvestigatorId
|
activeInvestigatorId = loadedData.activeInvestigatorId
|
||||||
|
isClassTextureEnabled = loadedData.isClassTextureEnabled
|
||||||
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
||||||
playerColor = loadedData.playerColor
|
playerColor = loadedData.playerColor
|
||||||
slotData = loadedData.slotData
|
slotData = loadedData.slotData
|
||||||
@ -879,10 +890,12 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
notes.combatIcons,
|
notes.combatIcons,
|
||||||
notes.agilityIcons
|
notes.agilityIcons
|
||||||
})
|
})
|
||||||
|
updateTexture()
|
||||||
elseif activeInvestigatorId ~= "00000" then
|
elseif activeInvestigatorId ~= "00000" then
|
||||||
activeInvestigatorClass = "Neutral"
|
activeInvestigatorClass = "Neutral"
|
||||||
activeInvestigatorId = "00000"
|
activeInvestigatorId = "00000"
|
||||||
ownedObjects.InvestigatorSkillTracker.call("updateStats", { 1, 1, 1, 1 })
|
ownedObjects.InvestigatorSkillTracker.call("updateStats", { 1, 1, 1, 1 })
|
||||||
|
updateTexture()
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -936,7 +949,7 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
|
|
||||||
count[type] = count[type] + 1
|
count[type] = count[type] + 1
|
||||||
if count[type] > 2 then
|
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
|
else
|
||||||
local localSpawnPos = tokenSpawnPos[type][count[type]]
|
local localSpawnPos = tokenSpawnPos[type][count[type]]
|
||||||
local globalSpawnPos = self.positionToWorld(localSpawnPos):add(Vector(0, 0.2, 0))
|
local globalSpawnPos = self.positionToWorld(localSpawnPos):add(Vector(0, 0.2, 0))
|
||||||
@ -950,6 +963,34 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
end
|
end
|
||||||
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
|
-- manipulation of owned objects
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -1083,6 +1124,14 @@ function clickableClues(showCounter)
|
|||||||
end
|
end
|
||||||
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)
|
-- removes all clues (moving tokens to the trash and setting counters to 0)
|
||||||
function removeClues()
|
function removeClues()
|
||||||
ownedObjects.ClueCounter.call("removeAllClues", ownedObjects.Trash)
|
ownedObjects.ClueCounter.call("removeAllClues", ownedObjects.Trash)
|
||||||
|
@ -225,6 +225,15 @@ do
|
|||||||
end
|
end
|
||||||
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
|
-- 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)
|
||||||
|
@ -273,6 +273,21 @@
|
|||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</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 -->
|
<!-- Option: use clickable clue-counters -->
|
||||||
<Row class="option-text"
|
<Row class="option-text"
|
||||||
tooltip="Instead of automatically counting clues in the respective area on your playermat,
this displays a clickable counter for clues.">
|
tooltip="Instead of automatically counting clues in the respective area on your playermat,
this displays a clickable counter for clues.">
|
||||||
@ -308,7 +323,7 @@
|
|||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<!-- Option: remove a player mat -->
|
<!-- Option: remove a playermat -->
|
||||||
<Row class="option-text"
|
<Row class="option-text"
|
||||||
tooltip="Remove an unused playermat for more table space.
Displayed are the default colors.">
|
tooltip="Remove an unused playermat for more table space.
Displayed are the default colors.">
|
||||||
<Cell class="option-singleColumn">
|
<Cell class="option-singleColumn">
|
||||||
|
Loading…
Reference in New Issue
Block a user