Merge branch 'main' into 3.8.0-update

This commit is contained in:
Finn 2024-05-11 15:58:02 -05:00
commit b5180e0761
9 changed files with 54 additions and 38 deletions

View File

@ -1,3 +1,3 @@
# Finn considered to be code owner of all files
# until Finn gets added as a github user, argonui will serve as code owner
* @argonui @Chr1Z93 @Tikatoy @BootleggerFinn @Entrox-Licher
* @argonui @Chr1Z93 @Tikatoy @BootleggerFinn @Entrox-Licher @dscarpac

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093238162/ACF3BBD93CB517B0BD0952E9BB78A2D35A62F377/",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2467486908540932616/8370C75D2789E1332836D8C2A31D32542153DE85/",
"WidthScale": 0
},
"Description": "Press a numpad key to spawn the indicated token.",

View File

@ -1,6 +1,7 @@
local deckLib = require("util/DeckLib")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local searchLib = require("util/SearchLib")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenChecker = require("core/token/TokenChecker")
@ -14,7 +15,6 @@ local ENCOUNTER_DISCARD_AREA = {
upperLeft = { x = 1.62, z = 0.42 },
lowerRight = { x = 1.58, z = 0.38 }
}
local DRAWN_ENCOUNTER_CARD_OFFSET = { 1.365, 0.5, -0.625 }
-- global position of encounter deck and discard pile
local ENCOUNTER_DECK_POS = { x = -3.93, y = 1, z = 5.76 }
@ -186,26 +186,8 @@ function actualEncounterCardDraw(card, params)
faceUpRotation = 180
end
-- get position and rotation for the specific playmat
local pos = params.mat.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)
local rot = { 0, params.mat.getRotation().y, faceUpRotation }
-- maybe override position with first empty slot in threat area (right to left)
if not params.stack then
local searchPos = Vector(-0.91, 0.5, -0.625)
for i = 1, 5 do
local globalSearchPos = params.mat.positionToWorld(searchPos)
local searchResult = searchLib.atPosition(globalSearchPos, "isCardOrDeck")
if #searchResult == 0 then
pos = globalSearchPos
break
else
searchPos.x = searchPos.x + 0.455
end
end
end
deckLib.placeOrMergeIntoDeck(card, pos, rot)
local rot = playmatApi.returnRotation(params.matColor):setAt("z", faceUpRotation)
deckLib.placeOrMergeIntoDeck(card, params.position, rot)
end
function reshuffleEncounterDeck()

View File

@ -17,10 +17,10 @@ do
end
-- draw an encounter card for the requesting mat to the first empty spot from the right
---@param mat tts__Object Playermat that triggered this
---@param stack boolean Whether the card should instead be placed right next to the button (and even stack with other cards)
MythosAreaApi.drawEncounterCard = function(mat, stack)
getMythosArea().call("drawEncounterCard", { mat = mat, stack = stack })
---@param matColor string Playermat that triggered this
---@param position tts__Vector Position for the encounter card
MythosAreaApi.drawEncounterCard = function(matColor, position)
getMythosArea().call("drawEncounterCard", { matColor = matColor, position = position })
end
-- reshuffle the encounter deck

View File

@ -2,6 +2,7 @@ VALID_TOKENS = {
["Bless"] = true
}
SHOW_SINGLE_RELEASE = true
SHOW_MULTI_RELEASE = 3
SHOW_MULTI_RETURN = 3

View File

@ -2,6 +2,7 @@ VALID_TOKENS = {
["Bless"] = true
}
KEEP_OPEN = true
SHOW_SINGLE_RELEASE = true
require("playercards/CardsThatSealTokens")

View File

@ -2,7 +2,7 @@ VALID_TOKENS = {
["Bless"] = true
}
SHOW_SINGLE_RELEASE = true
KEEP_OPEN = true
SHOW_SINGLE_RELEASE = true
require("playercards/CardsThatSealTokens")

View File

@ -37,9 +37,10 @@ local DECK_DISCARD_AREA = {
size = { x = 0.4, y = 3, z = 1.1 }
}
-- local position of draw and discard pile
-- local positions
local DRAW_DECK_POSITION = { x = -1.82, y = 0.1, z = 0 }
local DISCARD_PILE_POSITION = { x = -1.82, y = 0.1, z = 0.61 }
local DRAWN_ENCOUNTER_POSITION = { x = 1.365, y = 0.5, z = -0.625 }
-- global position of encounter discard pile
local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38 }
@ -951,7 +952,8 @@ function drawChaosTokenButton(_, _, isRightClick)
end
function drawEncounterCard(_, _, isRightClick)
mythosAreaApi.drawEncounterCard(self, isRightClick)
local drawPos = getEncounterCardDrawPosition(not isRightClick)
mythosAreaApi.drawEncounterCard(matColor, drawPos)
end
function returnGlobalDiscardPosition()
@ -962,6 +964,29 @@ function returnGlobalDrawPosition()
return self.positionToWorld(DRAW_DECK_POSITION)
end
-- returns the position for encounter card drawing
---@param stack boolean If true, returns the leftmost position instead of the first empty from the right
function getEncounterCardDrawPosition(stack)
local drawPos = self.positionToWorld(DRAWN_ENCOUNTER_POSITION)
-- maybe override position with first empty slot in threat area (right to left)
if not stack then
local searchPos = Vector(-0.91, 0.5, -0.625)
for i = 1, 5 do
local globalSearchPos = self.positionToWorld(searchPos)
local searchResult = searchLib.atPosition(globalSearchPos, "isCardOrDeck")
if #searchResult == 0 then
drawPos = globalSearchPos
break
else
searchPos.x = searchPos.x + 0.455
end
end
end
return drawPos
end
-- creates / removes the draw 1 button
---@param visible boolean Whether the draw 1 button should be visible
function showDrawButton(visible)

View File

@ -150,6 +150,15 @@ do
end
end
-- Returns the position for encounter card drawing
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
---@param stack boolean If true, returns the leftmost position instead of the first empty from the right
PlaymatApi.getEncounterCardDrawPosition = function(matColor, stack)
for _, mat in pairs(getMatForColor(matColor)) do
return Vector(mat.call("getEncounterCardDrawPosition", stack))
end
end
-- Sets the requested playmat's snap points to limit snapping to matching card types or not. If
-- matchTypes is true, the main card slot snap points will only snap assets, while the
-- investigator area point will only snap Investigators. If matchTypes is false, snap points will
@ -198,7 +207,7 @@ do
return count
end
-- updates the specified owned counter
-- Updates the specified owned counter
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
---@param type string Counter to target
---@param newValue number Value to set the counter to
@ -209,7 +218,7 @@ do
end
end
-- triggers the draw function for the specified playmat
-- Triggers the draw function for the specified playmat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
---@param number number Amount of cards to draw
PlaymatApi.drawCardsWithReshuffle = function(matColor, number)
@ -218,7 +227,7 @@ do
end
end
-- returns the resource counter amount
-- Returns the resource counter amount
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
---@param type string Counter to target
PlaymatApi.getCounterValue = function(matColor, type)
@ -227,15 +236,13 @@ do
end
end
-- returns a list of mat colors that have an investigator placed
-- Returns a list of mat colors that have an investigator placed
PlaymatApi.getUsedMatColors = function()
local localInvestigatorPosition = { x = -1.17, y = 1, z = -0.01 }
local usedColors = {}
for matColor, mat in pairs(getMatForColor("All")) do
local searchPos = mat.positionToWorld(localInvestigatorPosition)
local searchResult = searchLib.atPosition(searchPos, "isCardOrDeck")
if #searchResult > 0 then
table.insert(usedColors, matColor)
end
@ -243,7 +250,7 @@ do
return usedColors
end
-- resets the specified skill tracker to "1, 1, 1, 1"
-- Resets the specified skill tracker to "1, 1, 1, 1"
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.resetSkillTracker = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
@ -251,7 +258,7 @@ do
end
end
-- finds all objects on the playmat and associated set aside zone and returns a table
-- Finds all objects on the playmat and associated set aside zone and returns a table
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
---@param filter string Name of the filte function (see util/SearchLib)
PlaymatApi.searchAroundPlaymat = function(matColor, filter)