From 1213771ef93d0728f53d176c86b80fe624ea6298 Mon Sep 17 00:00:00 2001 From: Entrox-Licher Date: Tue, 8 Aug 2023 16:32:58 -0400 Subject: [PATCH] Fixed Take Clue GameKey with Clickable Clues --- src/core/GameKeyHandler.ttslua | 17 +++++++++++------ src/playermat/PlaymatApi.ttslua | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index f43ddbea..58452e60 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -1,6 +1,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") local playmatApi = require("playermat/PlaymatApi") local victoryDisplayApi = require("core/VictoryDisplayApi") +local optionPanelApi = require("core/OptionPanelApi") function onLoad() addHotkey("Add Doom to Agenda", addDoomToAgenda) @@ -98,14 +99,18 @@ function takeClueFromLocation(playerColor, hoveredObject) return end + local clickableClues = optionPanelApi.getOptions()["useClueClickers"] local playerName = Player[playerColor].steam_name - local matColor = playmatApi.getMatColor(playerColor) - local pos = playmatApi.transformLocalPosition({x = -1.12, y = 0.05, z = 0.7}, matColor) - local rot = playmatApi.returnRotation(matColor) - - if cardName == "" or cardName == nil then - cardName = "nameless card" + local matColor = playmatApi.getMatColor(playerColor) + local pos = nil + if clickableClues then + pos = {x = 0.49, y = 2.66, z = 0.00} + playmatApi.updateClueClicker(playerColor, playmatApi.getClueCount(clickableClues, playerColor) + 1) + else + pos = playmatApi.transformLocalPosition({x = -1.12, y = 0.05, z = 0.7}, matColor) end + + local rot = playmatApi.returnRotation(matColor) -- check if found clue is a stack or single token if clue.getQuantity() > 1 then diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index 39c51f86..84a1ffd0 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -191,6 +191,10 @@ do end end + PlaymatApi.updateClueClicker = function(playerColor, val) + return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call("updateVal", val) + end + -- Convenience function to look up a mat's object by color, or get all mats. ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also -- accepts "All" as a special value which will return all four mats.