diff --git a/objects/OfficialStandaloneChallengeScenarios.0ef5c8/ChallengeScenarios.9f6801.ttslua b/objects/OfficialStandaloneChallengeScenarios.0ef5c8/ChallengeScenarios.9f6801.ttslua index 92d26084..2d63eb65 100644 --- a/objects/OfficialStandaloneChallengeScenarios.0ef5c8/ChallengeScenarios.9f6801.ttslua +++ b/objects/OfficialStandaloneChallengeScenarios.0ef5c8/ChallengeScenarios.9f6801.ttslua @@ -26,26 +26,17 @@ end function updateMemoryWithMoves() memoryList = memoryListBackup --get the first transposed object's coordinates - local obj = getObjectFromGUID(moveGuid) + local obj = getObjectFromGUID(moveGuid or "") -- p1 is where needs to go, p2 is where it was local refObjPos = memoryList[moveGuid].pos local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil) - local movedRotation = obj.getRotation() for guid, entry in pairs(memoryList) do memoryList[guid].pos.x = entry.pos.x - deltaPos.x memoryList[guid].pos.y = entry.pos.y - deltaPos.y memoryList[guid].pos.z = entry.pos.z - deltaPos.z - -- memoryList[guid].rot.x = movedRotation.x - -- memoryList[guid].rot.y = movedRotation.y - -- memoryList[guid].rot.z = movedRotation.z end - --theList[obj.getGUID()] = { - -- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)}, - -- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)}, - -- lock=obj.getLock() - --} moveList = {} end diff --git a/objects/OfficialStandaloneChallengeScenarios.0ef5c8/StandaloneScenarios.77a5f9.ttslua b/objects/OfficialStandaloneChallengeScenarios.0ef5c8/StandaloneScenarios.77a5f9.ttslua index 92d26084..2d63eb65 100644 --- a/objects/OfficialStandaloneChallengeScenarios.0ef5c8/StandaloneScenarios.77a5f9.ttslua +++ b/objects/OfficialStandaloneChallengeScenarios.0ef5c8/StandaloneScenarios.77a5f9.ttslua @@ -26,26 +26,17 @@ end function updateMemoryWithMoves() memoryList = memoryListBackup --get the first transposed object's coordinates - local obj = getObjectFromGUID(moveGuid) + local obj = getObjectFromGUID(moveGuid or "") -- p1 is where needs to go, p2 is where it was local refObjPos = memoryList[moveGuid].pos local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil) - local movedRotation = obj.getRotation() for guid, entry in pairs(memoryList) do memoryList[guid].pos.x = entry.pos.x - deltaPos.x memoryList[guid].pos.y = entry.pos.y - deltaPos.y memoryList[guid].pos.z = entry.pos.z - deltaPos.z - -- memoryList[guid].rot.x = movedRotation.x - -- memoryList[guid].rot.y = movedRotation.y - -- memoryList[guid].rot.z = movedRotation.z end - --theList[obj.getGUID()] = { - -- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)}, - -- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)}, - -- lock=obj.getLock() - --} moveList = {} end diff --git a/objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.ttslua b/objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.ttslua index 0c9a65d3..7aaa754e 100644 --- a/objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.ttslua +++ b/objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.ttslua @@ -243,26 +243,17 @@ end function updateMemoryWithMoves() memoryList = memoryListBackup --get the first transposed object's coordinates - local obj = getObjectFromGUID(moveGuid) + local obj = getObjectFromGUID(moveGuid or "") -- p1 is where needs to go, p2 is where it was local refObjPos = memoryList[moveGuid].pos local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil) - local movedRotation = obj.getRotation() for guid, entry in pairs(memoryList) do memoryList[guid].pos.x = entry.pos.x - deltaPos.x memoryList[guid].pos.y = entry.pos.y - deltaPos.y memoryList[guid].pos.z = entry.pos.z - deltaPos.z - -- memoryList[guid].rot.x = movedRotation.x - -- memoryList[guid].rot.y = movedRotation.y - -- memoryList[guid].rot.z = movedRotation.z end - --theList[obj.getGUID()] = { - -- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)}, - -- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)}, - -- lock=obj.getLock() - --} moveList = {} end @@ -809,4 +800,3 @@ end function AllMemoryBagsInScene:getGuidList() return Global.getTable(self.NAME_OF_GLOBAL_VARIABLE) or {} end - diff --git a/src/arkhamdb/ArkhamDb.ttslua b/src/arkhamdb/ArkhamDb.ttslua index b7c9ddef..896cb03c 100644 --- a/src/arkhamdb/ArkhamDb.ttslua +++ b/src/arkhamdb/ArkhamDb.ttslua @@ -63,8 +63,11 @@ do return false, "Indexing not complete" end - local deckUri = { configuration.api_uri, - isPrivate and configuration.private_deck or configuration.public_deck, deckId } + local deckUri = { + configuration.api_uri, + isPrivate and configuration.private_deck or configuration.public_deck, + deckId + } local deck = Request.start(deckUri, function(status) if string.find(status.text, "") then @@ -408,9 +411,9 @@ do is_successful = false } - -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start and Request.deferred. - ---@param uri string - ---@param configure fun(request: Request, status: WebRequestStatus) + -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start() and Request.deferred(). + ---@param uri table + ---@param configure fun(request, status) ---@return Request function Request:new(uri, configure) local this = {} @@ -431,9 +434,8 @@ do -- Creates a new request. on_success should set the request's is_done, is_successful, and content variables. -- Deferred should be used when you don't want to set is_done immediately (such as if you want to wait for another request to finish) ---@param uri table - ---@param on_success fun(request: Request, status: WebRequestStatus, vararg: any) - ---@param on_error fun(status: WebRequestStatus)|nil - ---@vararg any[] + ---@param on_success fun(request, status, vararg) + ---@param on_error fun(status)|nil ---@return Request function Request.deferred(uri, on_success, on_error, ...) local parameters = table.pack(...) @@ -450,10 +452,10 @@ do end) end - -- Creates a new request. on_success should return weather the resultant data is as expected, and the processed content of the request. + -- Creates a new request. on_success should return whether the resultant data is as expected, and the processed content of the request. ---@param uri table - ---@param on_success fun(status: WebRequestStatus, vararg: any): boolean, any - ---@param on_error nil|fun(status: WebRequestStatus, vararg: any): string + ---@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, ...) diff --git a/src/arkhamdb/DeckImporterApi.ttslua b/src/arkhamdb/DeckImporterApi.ttslua index 37419cd6..537986c1 100644 --- a/src/arkhamdb/DeckImporterApi.ttslua +++ b/src/arkhamdb/DeckImporterApi.ttslua @@ -6,16 +6,18 @@ do return guidReferenceApi.getObjectByOwnerAndType("Mythos", "DeckImporter") end + ---@class uiStateTable + ---@field redDeck string Deck ID to load for the red player + ---@field orangeDeck string Deck ID to load for the orange player + ---@field whiteDeck string Deck ID to load for the white player + ---@field greenDeck string Deck ID to load for the green player + ---@field privateDeck boolean True to load a private deck, false to load a public deck + ---@field loadNewest boolean True if the most upgraded version of the deck should be loaded + ---@field investigators boolean True if investigator cards should be spawned + -- Returns a table with the full state of the UI, including options and deck IDs. -- This can be used to persist via onSave(), or provide values for a load operation - -- Table values: - -- redDeck: Deck ID to load for the red player - -- orangeDeck: Deck ID to load for the orange player - -- whiteDeck: Deck ID to load for the white player - -- greenDeck: Deck ID to load for the green player - -- private: True to load a private deck, false to load a public deck - -- loadNewest: True if the most upgraded version of the deck should be loaded - -- investigators: True if investigator cards should be spawned + ---@return uiStateTable uiStateTable Contains data about the current UI state DeckImporterApi.getUiState = function() local passthroughTable = {} for k,v in pairs(getDeckImporter().call("getUiState")) do @@ -25,15 +27,7 @@ do end -- Updates the state of the UI based on the provided table. Any values not provided will be left the same. - ---@param uiStateTable table Table of values to update on importer - -- Table values: - -- redDeck: Deck ID to load for the red player - -- orangeDeck: Deck ID to load for the orange player - -- whiteDeck: Deck ID to load for the white player - -- greenDeck: Deck ID to load for the green player - -- private: True to load a private deck, false to load a public deck - -- loadNewest: True if the most upgraded version of the deck should be loaded - -- investigators: True if investigator cards should be spawned + ---@return uiStateTable uiStateTable Contains data about the current UI state DeckImporterApi.setUiState = function(uiStateTable) return getDeckImporter().call("setUiState", uiStateTable) end diff --git a/src/arkhamdb/DeckImporterMain.ttslua b/src/arkhamdb/DeckImporterMain.ttslua index 69d68126..2a37be4e 100644 --- a/src/arkhamdb/DeckImporterMain.ttslua +++ b/src/arkhamdb/DeckImporterMain.ttslua @@ -59,7 +59,7 @@ function buildDeck(playerColor, deckId) arkhamDb.getDecklist( playerColor, deckId, - uiState.private, + uiState.privateDeck, uiState.loadNewest, uiState.investigators, loadCards) diff --git a/src/arkhamdb/DeckImporterUi.ttslua b/src/arkhamdb/DeckImporterUi.ttslua index 0418a9cb..5788446d 100644 --- a/src/arkhamdb/DeckImporterUi.ttslua +++ b/src/arkhamdb/DeckImporterUi.ttslua @@ -27,21 +27,14 @@ local loadInvestigators = false -- Returns a table with the full state of the UI, including options and deck IDs. -- This can be used to persist via onSave(), or provide values for a load operation --- Table values: --- redDeck: Deck ID to load for the red player --- orangeDeck: Deck ID to load for the orange player --- whiteDeck: Deck ID to load for the white player --- greenDeck: Deck ID to load for the green player --- private: True to load a private deck, false to load a public deck --- loadNewest: True if the most upgraded version of the deck should be loaded --- investigators: True if investigator cards should be spawned +---@return uiStateTable uiStateTable Contains data about the current UI state function getUiState() return { redDeck = redDeckId, orangeDeck = orangeDeckId, whiteDeck = whiteDeckId, greenDeck = greenDeckId, - private = privateDeck, + privateDeck = privateDeck, loadNewest = loadNewestDeck, investigators = loadInvestigators } @@ -49,14 +42,6 @@ end -- Updates the state of the UI based on the provided table. Any values not provided will be left the same. ---@param uiStateTable table Table of values to update on importer --- Table values: --- redDeck: Deck ID to load for the red player --- orangeDeck: Deck ID to load for the orange player --- whiteDeck: Deck ID to load for the white player --- greenDeck: Deck ID to load for the green player --- private: True to load a private deck, false to load a public deck --- loadNewest: True if the most upgraded version of the deck should be loaded --- investigators: True if investigator cards should be spawned function setUiState(uiStateTable) self.clearButtons() self.clearInputs() @@ -70,7 +55,7 @@ function initializeUi(savedUiState) orangeDeckId = savedUiState.orangeDeck whiteDeckId = savedUiState.whiteDeck greenDeckId = savedUiState.greenDeck - privateDeck = savedUiState.private + privateDeck = savedUiState.privateDeck loadNewestDeck = savedUiState.loadNewest loadInvestigators = savedUiState.investigators end diff --git a/src/chaosbag/BlessCurseManager.ttslua b/src/chaosbag/BlessCurseManager.ttslua index 8aa1bd62..e0cecbaa 100644 --- a/src/chaosbag/BlessCurseManager.ttslua +++ b/src/chaosbag/BlessCurseManager.ttslua @@ -63,7 +63,6 @@ function initializeState() -- count tokens in the bag local chaosBag = chaosBagApi.findChaosBag() - local tokens = {} for _, v in ipairs(chaosBag.getObjects()) do if v.name == "Bless" then numInPlay.Bless = numInPlay.Bless + 1 @@ -207,7 +206,7 @@ end --------------------------------------------------------- -- returns a formatted string with information about the provided token type (bless / curse) ----@param type string "Bless" or "Curse" +---@param type string Type of chaos token ("Bless" or "Curse") ---@param omitBrackets? boolean Controls whether the brackets should be omitted from the return ---@return string tokenCount function formatTokenCount(type, omitBrackets) diff --git a/src/chaosbag/BlessCurseManagerApi.ttslua b/src/chaosbag/BlessCurseManagerApi.ttslua index b4e55200..85d8c9c0 100644 --- a/src/chaosbag/BlessCurseManagerApi.ttslua +++ b/src/chaosbag/BlessCurseManagerApi.ttslua @@ -15,16 +15,22 @@ do end -- updates the internal count (called by cards that seal bless/curse tokens) + ---@param type string Type of chaos token ("Bless" or "Curse") + ---@param guid string GUID of the token BlessCurseManagerApi.sealedToken = function(type, guid) getManager().call("sealedToken", { type = type, guid = guid }) end -- updates the internal count (called by cards that seal bless/curse tokens) + ---@param type string Type of chaos token ("Bless" or "Curse") + ---@param guid string GUID of the token BlessCurseManagerApi.releasedToken = function(type, guid) getManager().call("releasedToken", { type = type, guid = guid }) end -- updates the internal count (called by cards that seal bless/curse tokens) + ---@param type string Type of chaos token ("Bless" or "Curse") + ---@param guid string GUID of the token BlessCurseManagerApi.returnedToken = function(type, guid) getManager().call("returnedToken", { type = type, guid = guid }) end diff --git a/src/chaosbag/ChaosBagApi.ttslua b/src/chaosbag/ChaosBagApi.ttslua index f9995a34..c589162a 100644 --- a/src/chaosbag/ChaosBagApi.ttslua +++ b/src/chaosbag/ChaosBagApi.ttslua @@ -29,13 +29,14 @@ do end -- returns all sealed tokens on cards to the chaos bag + ---@param playerColor string Color of the player to show the broadcast to ChaosBagApi.releaseAllSealedTokens = function(playerColor) return Global.call("releaseAllSealedTokens", playerColor) end -- returns all drawn tokens to the chaos bag - ChaosBagApi.returnChaosTokens = function(playerColor) - return Global.call("returnChaosTokens", playerColor) + ChaosBagApi.returnChaosTokens = function() + return Global.call("returnChaosTokens") end -- removes the specified chaos token from the chaos bag @@ -45,7 +46,7 @@ do end -- returns a chaos token to the bag and calls all relevant functions - ---@param token tts__GameObject Chaos Token to return + ---@param token tts__GameObject Chaos token to return ChaosBagApi.returnChaosTokenToBag = function(token) return Global.call("returnChaosTokenToBag", token) end @@ -66,6 +67,8 @@ do end -- called by playermats (by the "Draw chaos token" button) + ---@param mat tts__GameObject Playermat that triggered this + ---@param drawAdditional boolean Controls whether additional tokens should be drawn ChaosBagApi.drawChaosToken = function(mat, drawAdditional) return Global.call("drawChaosToken", {mat = mat, drawAdditional = drawAdditional}) end diff --git a/src/core/GUIDReferenceApi.ttslua b/src/core/GUIDReferenceApi.ttslua index f0c6bdca..2d7d1584 100644 --- a/src/core/GUIDReferenceApi.ttslua +++ b/src/core/GUIDReferenceApi.ttslua @@ -5,21 +5,23 @@ do return getObjectFromGUID("123456") end - -- returns all matching objects as a table with references ---@param owner string Parent object for this search ---@param type string Type of object to search for + ---@return any: Object reference to the matching object GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type) return getGuidHandler().call("getObjectByOwnerAndType", { owner = owner, type = type }) end -- returns all matching objects as a table with references ---@param type string Type of object to search for + ---@return table: List of object references to matching objects GUIDReferenceApi.getObjectsByType = function(type) return getGuidHandler().call("getObjectsByType", type) end -- returns all matching objects as a table with references ---@param owner string Parent object for this search + ---@return table: List of object references to matching objects GUIDReferenceApi.getObjectsByOwner = function(owner) return getGuidHandler().call("getObjectsByOwner", owner) end diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 06a1678f..6d3b3841 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -1291,7 +1291,7 @@ end -- handles the applying of option selections and calls the respective functions based ---@param id string ID of the option that was selected or deselected ----@param state boolean State of the option (true = enabled) +---@param state boolean|any State of the option (true = enabled) function applyOptionPanelChange(id, state) -- option: Snap tags if id == "useSnapTags" then @@ -1397,8 +1397,8 @@ end -- copies the specified tool (by name) from the option panel source bag ---@param name string Name of the object that should be copied ----@param position table Desired position of the object ----@param rotation table Desired rotation of the object (defaults to object's rotation) +---@param position tts__Vector Desired position of the object +---@param rotation? tts__Vector Desired rotation of the object (defaults to object's rotation) function spawnHelperObject(name, position, rotation) local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos","OptionPanelSource") @@ -1457,6 +1457,8 @@ end -- loads saved options function loadSettings(newOptions) + -- TO-DO: instead of overriding, keep original table and only add new data + -- this will ensure that new options aren't set to nil when importing an old state optionPanel = newOptions updateOptionPanelState() for id, state in pairs(optionPanel) do diff --git a/src/core/MythosAreaApi.ttslua b/src/core/MythosAreaApi.ttslua index 325f22a5..e8f8673f 100644 --- a/src/core/MythosAreaApi.ttslua +++ b/src/core/MythosAreaApi.ttslua @@ -6,17 +6,19 @@ do return guidReferenceApi.getObjectByOwnerAndType("Mythos", "MythosArea") end - -- returns the chaos token metadata (if provided through scenario reference card) + ---@return any: Table of chaos token metadata (if provided through scenario reference card) MythosAreaApi.returnTokenData = function() return getMythosArea().call("returnTokenData") end - -- returns an object reference to the encounter deck + ---@return any: Object reference to the encounter deck MythosAreaApi.getEncounterDeck = function() return getMythosArea().call("getEncounterDeck") end -- draw an encounter card for the requesting mat + ---@param mat tts__GameObject Playermat that triggered this + ---@param alwaysFaceUp boolean Whether the card should be drawn face-up MythosAreaApi.drawEncounterCard = function(mat, alwaysFaceUp) getMythosArea().call("drawEncounterCard", {mat = mat, alwaysFaceUp = alwaysFaceUp}) end diff --git a/src/core/NavigationOverlayApi.ttslua b/src/core/NavigationOverlayApi.ttslua index d1348b91..73b2a1a6 100644 --- a/src/core/NavigationOverlayApi.ttslua +++ b/src/core/NavigationOverlayApi.ttslua @@ -6,7 +6,7 @@ do return guidReferenceApi.getObjectByOwnerAndType("Mythos", "NavigationOverlayHandler") end - -- Copies the visibility for the Navigation overlay + -- copies the visibility for the Navigation overlay ---@param startColor string Color of the player to copy from ---@param targetColor string Color of the targeted player NavigationOverlayApi.copyVisibility = function(startColor, targetColor) @@ -14,9 +14,9 @@ do startColor = startColor, targetColor = targetColor }) - end + end - -- Changes the Navigation Overlay view ("Full View" --> "Play Areas" --> "Closed" etc.) + -- changes the Navigation Overlay view ("Full View" --> "Play Areas" --> "Closed" etc.) ---@param playerColor string Color of the player to update the visibility for NavigationOverlayApi.cycleVisibility = function(playerColor) getNOHandler().call("cycleVisibility", playerColor) diff --git a/src/core/NavigationOverlayHandler.ttslua b/src/core/NavigationOverlayHandler.ttslua index 776163da..21a09a3d 100644 --- a/src/core/NavigationOverlayHandler.ttslua +++ b/src/core/NavigationOverlayHandler.ttslua @@ -236,7 +236,7 @@ end -- handles all button clicks function buttonClicked(player, _, id) - local index = tonumber(id) + local index = tonumber(id) or "" if index == 19 then setVisibility("toggle", player.color) diff --git a/src/core/OptionPanelApi.ttslua b/src/core/OptionPanelApi.ttslua index a20d8129..acca1fb4 100644 --- a/src/core/OptionPanelApi.ttslua +++ b/src/core/OptionPanelApi.ttslua @@ -2,12 +2,12 @@ do local OptionPanelApi = {} -- loads saved options - ---@param options table New options table + ---@param options table Set a new state for the option table OptionPanelApi.loadSettings = function(options) return Global.call("loadSettings", options) end - -- returns option panel table + ---@return any: Table of option panel state OptionPanelApi.getOptions = function() return Global.getTable("optionPanel") end diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua index d004eedc..5fa7251e 100644 --- a/src/core/PlayArea.ttslua +++ b/src/core/PlayArea.ttslua @@ -125,7 +125,7 @@ function onCollisionEnter(collisionInfo) -- If this card was being dragged, clear the dragging connections. A multi-drag/drop may send -- the dropped card immediately into a deck, so this has to be done here if draggingGuids[card.getGUID()] ~= nil then - card.setVectorLines(nil) + card.setVectorLines({}) draggingGuids[card.getGUID()] = nil end @@ -197,7 +197,7 @@ function onUpdate() -- If object still exists then it's been dragged outside the area and needs to clear the -- lines attached to it if obj ~= nil then - obj.setVectorLines(nil) + obj.setVectorLines({}) end end -- Even if the last location left the play area, need one last draw to clear the lines @@ -257,11 +257,11 @@ end -- Global event handler, delegated from Global. Clears any connection lines from dragged cards -- before they are destroyed by entering a deck. Removal of the card from the dragging list will -- be handled during the next onUpdate() call. -function tryObjectEnterContainer(params) +function tryObjectEnterContainer() for draggedGuid, _ in pairs(draggingGuids) do local draggedObj = getObjectFromGUID(draggedGuid) if draggedObj ~= nil then - draggedObj.setVectorLines(nil) + draggedObj.setVectorLines({}) end end end @@ -451,13 +451,11 @@ function addOneWayVector(origin, target, vectorOwner, lines) -- Calculate card distance to be closer for horizontal positions than vertical, since cards are -- taller than they are wide local heading = Vector(originPos):sub(targetPos):heading("y") - local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 + - DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading))) + local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 + DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading))) -- Calculate the three possible arrow positions. These are offset by half the arrow length to -- make them visually balanced by keeping the arrows centered, not tracking the point - local midpoint = Vector(originPos):add(targetPos):scale(Vector(0.5, 0.5, 0.5)):moveTowards(targetPos, - ARROW_ARM_LENGTH / 2) + local midpoint = Vector(originPos):add(targetPos):scale(0.5):moveTowards(targetPos, ARROW_ARM_LENGTH / 2) local closeToOrigin = Vector(originPos):moveTowards(targetPos, distanceFromCard + ARROW_ARM_LENGTH / 2) local closeToTarget = Vector(targetPos):moveTowards(originPos, distanceFromCard - ARROW_ARM_LENGTH / 2) @@ -470,16 +468,14 @@ function addOneWayVector(origin, target, vectorOwner, lines) end -- Draws an arrowhead at the given position. ----@param arrowheadPos table Centerpoint of the arrowhead to draw (NOT the tip of the arrow) ----@param originPos table Origin point of the connection, used to position the arrow arms +---@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 vectorOwner tts__GameObject The object which these lines will be set to. Used for relative --- 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 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 arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver("y", - 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 head = vectorOwner.positionToLocal(arrowheadPos) local arm1 = vectorOwner.positionToLocal(arrowArm1) diff --git a/src/core/PlayAreaApi.ttslua b/src/core/PlayAreaApi.ttslua index 5ad74a95..7fa57c72 100644 --- a/src/core/PlayAreaApi.ttslua +++ b/src/core/PlayAreaApi.ttslua @@ -22,41 +22,41 @@ do getInvestigatorCounter().call("updateVal", count) end - -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain + -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded' ---@param playerColor string Color of the player requesting the shift for messages PlayAreaApi.shiftContentsUp = function(playerColor) - return getPlayArea().call("shiftContentsUp", playerColor) + getPlayArea().call("shiftContentsUp", playerColor) end PlayAreaApi.shiftContentsDown = function(playerColor) - return getPlayArea().call("shiftContentsDown", playerColor) + getPlayArea().call("shiftContentsDown", playerColor) end PlayAreaApi.shiftContentsLeft = function(playerColor) - return getPlayArea().call("shiftContentsLeft", playerColor) + getPlayArea().call("shiftContentsLeft", playerColor) end PlayAreaApi.shiftContentsRight = function(playerColor) - return getPlayArea().call("shiftContentsRight", playerColor) + getPlayArea().call("shiftContentsRight", playerColor) end -- Reset the play area's tracking of which cards have had tokens spawned. PlayAreaApi.resetSpawnedCards = function() - return getPlayArea().call("resetSpawnedCards") + getPlayArea().call("resetSpawnedCards") end - -- Sets whether location connections should be drawn + ---@param state boolean This controls whether location connections should be drawn PlayAreaApi.setConnectionDrawState = function(state) getPlayArea().call("setConnectionDrawState", state) end - -- Sets the connection color + ---@param color string Connection color to be used for location connections PlayAreaApi.setConnectionColor = function(color) getPlayArea().call("setConnectionColor", color) end - -- Event to be called when the current scenario has changed. + -- Event to be called when the current scenario has changed ---@param scenarioName string Name of the new scenario PlayAreaApi.onScenarioChanged = function(scenarioName) getPlayArea().call("onScenarioChanged", scenarioName) @@ -64,7 +64,7 @@ do -- Sets this playmat's snap points to limit snapping to locations or not. -- If matchTypes is false, snap points will be reset to snap all cards. - ---@param matchCardTypes boolean Whether snap points should only snap for the matching card types. + ---@param matchCardTypes boolean Whether snap points should only snap for the matching card types PlayAreaApi.setLimitSnapsByType = function(matchCardTypes) getPlayArea().call("setLimitSnapsByType", matchCardTypes) end diff --git a/src/core/SoundCubeApi.ttslua b/src/core/SoundCubeApi.ttslua index 879ac421..e078b7d3 100644 --- a/src/core/SoundCubeApi.ttslua +++ b/src/core/SoundCubeApi.ttslua @@ -9,6 +9,7 @@ do ["Dark Souls"] = 2 } + ---@param index number Index of the sound effect to play local function playTriggerEffect(index) local SoundCube = guidReferenceApi.getObjectByOwnerAndType("Mythos", "SoundCube") SoundCube.AssetBundle.playTriggerEffect(index) diff --git a/src/core/VictoryDisplayApi.ttslua b/src/core/VictoryDisplayApi.ttslua index 5ce28996..d6f7633a 100644 --- a/src/core/VictoryDisplayApi.ttslua +++ b/src/core/VictoryDisplayApi.ttslua @@ -6,7 +6,7 @@ do return guidReferenceApi.getObjectByOwnerAndType("Mythos", "VictoryDisplay") end - -- triggers an update of the Victory count + -- triggers an update of the victory count ---@param delay number Delay in seconds after which the update call is executed VictoryDisplayApi.update = function(delay) getVictoryDisplay().call("startUpdate", delay) diff --git a/src/playercards/PlayerCardPanel.ttslua b/src/playercards/PlayerCardPanel.ttslua index 311a77f7..6f3e5eeb 100644 --- a/src/playercards/PlayerCardPanel.ttslua +++ b/src/playercards/PlayerCardPanel.ttslua @@ -1,3 +1,4 @@ +---@diagnostic disable: param-type-mismatch require("playercards/PlayerCardPanelData") local allCardsBagApi = require("playercards/AllCardsBagApi") @@ -400,8 +401,7 @@ function scalePositions() startPositions = { } for key, pos in pairs(START_POSITIONS) do -- Because a scaled object means a different global size, using global distance for Z results in - -- the cards being closer or farther depending on the scale. Leave the Z values and only scale - -- X and Y + -- the cards being closer or farther depending on the scale. Leave the Z values and only scale X and Y startPositions[key] = Vector(pos) startPositions[key].x = startPositions[key].x * scale startPositions[key].y = startPositions[key].y * scale @@ -486,11 +486,11 @@ function buildInvestigatorSpawnSpec(investigatorName, investigatorData, position local sigPos = Vector(position):add(investigatorSignatureOffset) local spawns = buildCommonSpawnSpec(investigatorName, investigatorData, position) table.insert(spawns, { - name = investigatorName.."signatures", - cards = investigatorData.signatures, - globalPos = self.positionToWorld(sigPos), - rotation = FACE_UP_ROTATION, - }) + name = investigatorName.."signatures", + cards = investigatorData.signatures, + globalPos = self.positionToWorld(sigPos), + rotation = FACE_UP_ROTATION, + }) return spawns end @@ -506,18 +506,18 @@ end function buildCommonSpawnSpec(investigatorName, investigatorData, position, oneCardOnly) local cardPos = Vector(position):add(investigatorCardOffset) return { - { - name = investigatorName.."minicards", - cards = oneCardOnly and { investigatorData.minicards[1] } or investigatorData.minicards, - globalPos = self.positionToWorld(position), - rotation = FACE_UP_ROTATION, - }, - { - name = investigatorName.."cards", - cards = oneCardOnly and { investigatorData.cards[1] } or investigatorData.cards, - globalPos = self.positionToWorld(cardPos), - rotation = FACE_UP_ROTATION, - }, + { + name = investigatorName.."minicards", + cards = oneCardOnly and { investigatorData.minicards[1] } or investigatorData.minicards, + globalPos = self.positionToWorld(position), + rotation = FACE_UP_ROTATION, + }, + { + name = investigatorName.."cards", + cards = oneCardOnly and { investigatorData.cards[1] } or investigatorData.cards, + globalPos = self.positionToWorld(cardPos), + rotation = FACE_UP_ROTATION, + } } end diff --git a/src/playercards/customizable/UpgradeSheetLibrary.ttslua b/src/playercards/customizable/UpgradeSheetLibrary.ttslua index e28f04a7..07e1647a 100644 --- a/src/playercards/customizable/UpgradeSheetLibrary.ttslua +++ b/src/playercards/customizable/UpgradeSheetLibrary.ttslua @@ -219,7 +219,7 @@ function updateTextField(rowIndex) end end -function clickCheckbox(row, col, buttonIndex) +function clickCheckbox(row, col) if selectedUpgrades[row] == nil then selectedUpgrades[row] = { } selectedUpgrades[row].xp = 0