Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed cards modifying default value for tokens #925

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/Global.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ function TokenManager.spawnToken(params)
end

TokenManager.initTokenTemplates()
local tokenTemplate = tokenTemplates[loadTokenType]
local tokenTemplate = deepCopy(tokenTemplates[loadTokenType])
if tokenTemplate == nil then
error("Unknown token type '" .. loadTokenType .. "'")
return
Expand Down
6 changes: 4 additions & 2 deletions src/core/token/TokenManagerApi.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ do
-- x and z will use the default rotation from the source bag
---@param callbackName? string Name of the callback function (in Global)
---@param callbackParams? any Parameters for the callback function
function TokenManagerApi.spawnToken(position, tokenType, rotation, callbackName, callbackParams)
---@param scriptstate? any Scriptstate for the token
function TokenManagerApi.spawnToken(position, tokenType, rotation, callbackName, callbackParams, scriptstate)
Global.call("callTable", {
{ "TokenManager", "spawnToken" },
{
position = position,
rotation = rotation,
tokenType = tokenType,
callbackName = callbackName,
callbackParams = callbackParams
callbackParams = callbackParams,
scriptstate = scriptstate
}
})
end
Expand Down
2 changes: 2 additions & 0 deletions src/util/TokenSpawnTool.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function onScriptingButtonDown(index, playerColor)
local rotation = Vector(0, Player[playerColor].getPointerRotation(), 0)
callbackName = nil
callbackParams = nil
scriptstate = nil

-- check for subtype of resource based on card below
if tokenType == "resource" then
Expand Down Expand Up @@ -59,6 +60,7 @@ function onScriptingButtonDown(index, playerColor)
hoverObj.call("modifyValue", 1)
return
end
scriptstate = 1

-- check for nearest investigator card and change action token state to its class
elseif tokenType == "universalActionAbility" then
Expand Down
Loading