diff --git a/src/accessories/SearchAssistant.ttslua b/src/accessories/SearchAssistant.ttslua index 8a742ebf..c71059fe 100644 --- a/src/accessories/SearchAssistant.ttslua +++ b/src/accessories/SearchAssistant.ttslua @@ -160,7 +160,7 @@ function endSearch(_, _, isRightClick) end -- draw set aside cards (from the ground!) - for _, obj in ipairs(searchLib.atPosition(setAsidePosition), "isCardOrDeck") do + for _, obj in ipairs(searchLib.atPosition(setAsidePosition, "isCardOrDeck")) do if obj.type == "Deck" then Wait.time(function() obj.deal(#obj.getObjects(), handColor) end, 1) elseif obj.type == "Card" then diff --git a/src/accessories/TokenArrangerApi.ttslua b/src/accessories/TokenArrangerApi.ttslua index 75d44839..fa33b4f7 100644 --- a/src/accessories/TokenArrangerApi.ttslua +++ b/src/accessories/TokenArrangerApi.ttslua @@ -13,7 +13,7 @@ do end -- updates the token modifiers with the provided data - ---@param tokenData Table Contains the chaos token metadata + ---@param fullData Table Contains the chaos token metadata TokenArrangerApi.onTokenDataChanged = function(fullData) callIfExistent("onTokenDataChanged", fullData) end diff --git a/src/accessories/UnderworldMarketHelper.ttslua b/src/accessories/UnderworldMarketHelper.ttslua index 53af7d07..0f851682 100644 --- a/src/accessories/UnderworldMarketHelper.ttslua +++ b/src/accessories/UnderworldMarketHelper.ttslua @@ -1,6 +1,6 @@ local searchLib = require("util/SearchLib") -function onload(saved_data) +function onload(savedData) revealCardPositions = { Vector(3.5, 0.25, 0), Vector(-3.5, 0.25, 0) @@ -30,8 +30,8 @@ function onload(saved_data) self.addContextMenuItem('Reset helper', resetHelper) - if saved_data != '' then - local loaded_data = JSON.decode(saved_data) + if savedData ~= '' then + local loaded_data = JSON.decode(savedData) hiddenCards = loaded_data.saved_hiddenCards isSetup = true diff --git a/src/arkhamdb/DeckImporterMain.ttslua b/src/arkhamdb/DeckImporterMain.ttslua index 13f009cb..1c77edaa 100644 --- a/src/arkhamdb/DeckImporterMain.ttslua +++ b/src/arkhamdb/DeckImporterMain.ttslua @@ -83,7 +83,6 @@ end ---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo") function loadCards(slots, investigatorId, bondedList, customizations, playerColor, loadAltInvestigator) function coinside() - local yPos = {} local cardsToSpawn = {} -- reset the startsInPlayCount @@ -218,7 +217,7 @@ function getCardName(cardId) end -- Split a single list of cards into a separate table of lists, keyed by the zone ----@param cards: Table of {cardData, cardMetadata, zone} +---@param cards Table Table of {cardData, cardMetadata, zone} ---@return: Table of {zoneName=card list} function buildZoneLists(cards) local zoneList = {} @@ -389,7 +388,7 @@ end -- For any customization upgrade cards in the card list, process the metadata from the deck to -- set the save state to show the correct checkboxes/text field values ---@param cardList Table Deck list being created ----@param customizations Table Deck's meta table, extracted from ArkhamDB's deck structure +---@param customizations String ArkhamDB data for customizations on customizable cards function handleCustomizableUpgrades(cardList, customizations) for _, card in ipairs(cardList) do if card.metadata.type == "UpgradeSheet" then diff --git a/src/chaosbag/BlessCurseManagerApi.ttslua b/src/chaosbag/BlessCurseManagerApi.ttslua index be609d59..74b42440 100644 --- a/src/chaosbag/BlessCurseManagerApi.ttslua +++ b/src/chaosbag/BlessCurseManagerApi.ttslua @@ -42,7 +42,8 @@ do end -- adds bless / curse sealing to the hovered card - ---@param color String Color of the player to show the broadcast to + ---@param playerColor String Color of the player to show the broadcast to + ---@param hoveredObject TTSObject Hovered object BlessCurseManagerApi.addBlurseSealingMenu = function(playerColor, hoveredObject) getManager().call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject }) end diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 0c135ffd..bd560844 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -416,8 +416,9 @@ end --------------------------------------------------------- -- called for button creation on the difficulty selectors ----@param object object Usually "self" ----@param key string Name of the scenario +---@param args Table Parameters for this function: +-- object TTSObject Usually "self" +-- key String Name of the scenario function createSetupButtons(args) local data = getDataValue('modeData', args.key) if data ~= nil then @@ -466,9 +467,10 @@ function createSetupButtons(args) end -- called for adding chaos tokens ----@param object object Usually "self" ----@param key string Name of the scenario ----@param mode string difficulty (e.g. "hard" or "expert") +---@param args Table Parameters for this function: +-- object object Usually "self" +-- key string Name of the scenario +-- mode string difficulty (e.g. "hard" or "expert") function fillContainer(args) local data = getDataValue('modeData', args.key) if data == nil then return end @@ -745,7 +747,7 @@ function onClick_download(player) end -- the download button on the placeholder objects calls this to directly initiate a download ----@param param Table contains url and guid of replacement object +---@param params Table contains url and guid of replacement object function placeholder_download(params) local url = SOURCE_REPO .. '/' .. params.url requestObj = WebRequest.get(url, function (request) contentDownloadCallback(request, params) end) diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua index dbd5781e..89390bc0 100644 --- a/src/core/PlayArea.ttslua +++ b/src/core/PlayArea.ttslua @@ -299,7 +299,7 @@ function rebuildConnectionList() end -- Extracts the card's icon string into a list of individual location icons ----@param cardID String GUID of the card to pull the icon data from +---@param cardId String GUID of the card to pull the icon data from ---@param iconCardList Table A table of icon->GUID list. Mutable, will be updated by this method ---@param locData Table A table containing the metadata for the card (for the correct side) function buildLocListByIcon(cardId, iconCardList, locData) @@ -357,10 +357,10 @@ function drawBaseConnections() -- Objects should reliably exist at this point, but since this can be called during onUpdate the -- object checks are conservative just to make sure. local origin = getObjectFromGUID(originGuid) - if draggingGuids[originGuid] == nil and origin != nil then + if draggingGuids[originGuid] == nil and origin ~= nil then for targetGuid, direction in pairs(targetGuids) do local target = getObjectFromGUID(targetGuid) - if draggingGuids[targetGuid] == nil and target != nil then + if draggingGuids[targetGuid] == nil and target ~= nil then -- Since we process the full list, we're guaranteed to hit any ONE_WAY connections later -- so we can ignore INCOMING_ONE_WAY if direction == BIDIRECTIONAL then @@ -392,7 +392,7 @@ function drawDraggingConnections() ownedVectors[originGuid] = {} for targetGuid, direction in pairs(targetGuids) do local target = getObjectFromGUID(targetGuid) - if target != nil then + if target ~= nil then if direction == BIDIRECTIONAL then addBidirectionalVector(origin, target, origin, ownedVectors[originGuid]) elseif direction == ONE_WAY then @@ -470,7 +470,7 @@ function addOneWayVector(origin, target, vectorOwner, lines) end -- Draws an arrowhead at the given position. ----@param arrowheadPosition Table Centerpoint of the arrowhead to draw (NOT the tip of the arrow) +---@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 vectorOwner 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 diff --git a/src/core/PlayAreaApi.ttslua b/src/core/PlayAreaApi.ttslua index aa983829..9f0fdac3 100644 --- a/src/core/PlayAreaApi.ttslua +++ b/src/core/PlayAreaApi.ttslua @@ -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 matchTypes 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/VictoryDisplay.ttslua b/src/core/VictoryDisplay.ttslua index fdf8e582..13c56694 100644 --- a/src/core/VictoryDisplay.ttslua +++ b/src/core/VictoryDisplay.ttslua @@ -136,7 +136,7 @@ function updateCount() victoryPoints.playArea = playAreaApi.countVP() -- count cards in victory display - for _, obj in ipairs(searchLib.onObject(self), "isCardOrDeck") do + for _, obj in ipairs(searchLib.onObject(self, "isCardOrDeck")) do -- check metadata for VP if obj.type == "Card" then local VP = getCardVP(obj, JSON.decode(obj.getGMNotes())) diff --git a/src/core/token/TokenManager.ttslua b/src/core/token/TokenManager.ttslua index e70ce8d7..b216a8bd 100644 --- a/src/core/token/TokenManager.ttslua +++ b/src/core/token/TokenManager.ttslua @@ -157,7 +157,7 @@ do ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the -- spawned state object rather than spawning multiple tokens ---@param shiftDown Number An offset for the z-value of this group of tokens - ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens + ---@param subType String Subtype of token to spawn. This will only differ from the tokenName for resource tokens TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType) local optionPanel = optionPanelApi.getOptions() @@ -199,7 +199,7 @@ do -- Other types should use spawnCounterToken() ---@param tokenCount Number How many tokens to spawn ---@param shiftDown Number An offset for the z-value of this group of tokens - ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens + ---@param subType String Subtype of token to spawn. This will only differ from the tokenName for resource tokens TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType) -- not checking the max at this point since clue offsets are calculated dynamically if tokenCount < 1 then return end @@ -408,7 +408,7 @@ do -- Spawn tokens for a location using data retrieved from the Data Helper. ---@param card Object Card to maybe spawn tokens for - ---@param playerData Table Location data structure retrieved from the DataHelper. Should be + ---@param locationData Table Location data structure retrieved from the DataHelper. Should be -- the right data for this card. internal.spawnLocationTokensFromDataHelper = function(card, locationData) local clueCount = internal.getClueCountFromData(card, locationData) @@ -491,7 +491,7 @@ do local clickableResourceCounter = nil local foundTokens = 0 - for _, obj in ipairs(searchLib.onObject(card), "isTileOrToken") do + for _, obj in ipairs(searchLib.onObject(card, "isTileOrToken")) do local memo = obj.getMemo() if (stateTable[memo] or 0) > 0 then diff --git a/src/playercards/PlayerCardPanel.ttslua b/src/playercards/PlayerCardPanel.ttslua index 39ddc1a5..0b4e2c96 100644 --- a/src/playercards/PlayerCardPanel.ttslua +++ b/src/playercards/PlayerCardPanel.ttslua @@ -450,8 +450,7 @@ function spawnInvestigators(groupName) local position = getInvestigatorRowStartPos(investigatorCount, row) for i, investigatorName in ipairs(INVESTIGATOR_GROUPS[groupName]) do - for _, spawnSpec in ipairs(buildInvestigatorSpawnSpec( - investigatorName, INVESTIGATORS[investigatorName], position, false)) do + for _, spawnSpec in ipairs(buildInvestigatorSpawnSpec(investigatorName, INVESTIGATORS[investigatorName], position)) do spawnBag.spawn(spawnSpec) end position:add(investigatorPositionShiftCol) diff --git a/src/playercards/PlayerCardSpawner.ttslua b/src/playercards/PlayerCardSpawner.ttslua index 8ed82318..d6c23ecf 100644 --- a/src/playercards/PlayerCardSpawner.ttslua +++ b/src/playercards/PlayerCardSpawner.ttslua @@ -131,7 +131,7 @@ end -- "CustomDeck" field is a list of all CustomDecks used by cards within the -- deck, keyed by the DeckID and referencing the custom deck table ---@param deck: TTS deck data structure to add to ----@param card: Data for the card to be inserted +---@param cardData: Data for the card to be inserted Spawner.addCardToDeck = function(deck, cardData) for customDeckId, customDeckData in pairs(cardData.CustomDeck) do if (deck.CustomDeck[customDeckId] == nil) then diff --git a/src/playercards/SpawnBag.ttslua b/src/playercards/SpawnBag.ttslua index 06ef1e28..3db65eae 100644 --- a/src/playercards/SpawnBag.ttslua +++ b/src/playercards/SpawnBag.ttslua @@ -104,7 +104,7 @@ do else -- TTS decks come out in reverse order of the cards, reverse the list so the input order stays -- This only applies for decks; spreads are spawned by us in the order given - if spawnSpec.rotation.z != 180 then + if spawnSpec.rotation.z ~= 180 then cardsToSpawn = internal.reverseList(cardsToSpawn) end Spawner.spawnCards(cardsToSpawn, spawnSpec.globalPos, spawnSpec.rotation, false, internal.recordPlacedObject) diff --git a/src/playercards/cards/FamilyInheritance.ttslua b/src/playercards/cards/FamilyInheritance.ttslua index e66b4b8e..b3222057 100644 --- a/src/playercards/cards/FamilyInheritance.ttslua +++ b/src/playercards/cards/FamilyInheritance.ttslua @@ -15,7 +15,7 @@ function searchSelf() clickableResourceCounter = nil foundTokens = 0 - for _, obj in ipairs(searchLib.onObject(self), "isTileOrToken") do + for _, obj in ipairs(searchLib.onObject(self, "isTileOrToken")) do local image = obj.getCustomObject().image if image == "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/" then foundTokens = foundTokens + math.abs(obj.getQuantity()) diff --git a/src/playermat/Zones.ttslua b/src/playermat/Zones.ttslua index f989cd54..2de52cf2 100644 --- a/src/playermat/Zones.ttslua +++ b/src/playermat/Zones.ttslua @@ -129,15 +129,15 @@ do return playmatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor) end - -- Return the global rotation for a card on the given player mat, based on its metadata. + -- Return the global rotation for a card on the given player mat, based on its zone. ---@param playerColor: Color name of the player mat to get the rotation for (e.g. "Red") - ---@param cardMetadata: Table of card metadata. Metadata fields type and permanent are required; all others are optional. + ---@param zoneName: Name of the zone. See Zones object documentation for a list of valid zones. ---@return: Global rotation vector for the given card. This will include the -- Y rotation to orient the card on the given player mat as well as a -- Z rotation to place the card face up or face down. - Zones.getDefaultCardRotation = function(playerColor, zone) + Zones.getDefaultCardRotation = function(playerColor, zoneName) local cardRotation = playmatApi.returnRotation(playerColor) - if zone == "Deck" then + if zoneName == "Deck" then cardRotation = cardRotation + Vector(0, 0, 180) end return cardRotation diff --git a/src/util/TokenSpawnTool.ttslua b/src/util/TokenSpawnTool.ttslua index 57f5dc12..65b0f6d1 100644 --- a/src/util/TokenSpawnTool.ttslua +++ b/src/util/TokenSpawnTool.ttslua @@ -32,7 +32,7 @@ function onScriptingButtonDown(index, playerColor) -- check for subtype of resource based on card below if tokenType == "resource" then - for _, obj in ipairs(searchLib.belowPosition(position), "isCard") do + for _, obj in ipairs(searchLib.belowPosition(position, "isCard")) do if not obj.is_face_down then local metadata = JSON.decode(obj.getGMNotes()) or {} local uses = metadata.uses or {}