From 407775039e502349e06c87c64168a9dac5a9593e Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 22 Oct 2023 00:12:11 +0200 Subject: [PATCH 1/8] added hotkey to trigger discard function --- src/core/GameKeyHandler.ttslua | 17 +++++++++++++-- src/playermat/Playmat.ttslua | 38 +++++++++++++++------------------ src/playermat/PlaymatApi.ttslua | 8 +++++++ 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 5fb80afd..586e45e5 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -7,6 +7,7 @@ local victoryDisplayApi = require("core/VictoryDisplayApi") function onLoad() addHotkey("Add Doom to Agenda", addDoomToAgenda) addHotkey("Bless/Curse Status", showBlessCurseStatus) + addHotkey("Discard Object", discardObject) addHotkey("Move card to Victory Display", moveCardToVictoryDisplay) addHotkey("Take clue from location", takeClueFromLocation) addHotkey("Upkeep", triggerUpkeep) @@ -46,6 +47,18 @@ function addDoomToAgenda() doomCounter.call("addVal", 1) end +-- trigger the discard function at the pointer position (either to discard pile or trash) +function discardObject(playerColor, hoveredObject) + local discardPos = Player[playerColor].getPointerPosition() + + if hoveredObject and (hoveredObject.type == "Card" or hoveredObject.type == "Deck") then + discardPos = hoveredObject.getPosition() + end + + local matColor = playmatApi.getMatColorByPosition(discardPos) + playmatApi.discardObjectsAtPosition(matColor, discardPos) +end + -- moves the hovered card to the victory display function moveCardToVictoryDisplay(_, hoveredObject) victoryDisplayApi.placeCard(hoveredObject) @@ -58,7 +71,7 @@ function takeClueFromLocation(playerColor, hoveredObject) if hoveredObject == nil then broadcastToColor("Hover a clue or card with clues and try again.", playerColor, "Yellow") return - elseif hoveredObject.tag == "Card" then + elseif hoveredObject.type == "Card" then cardName = hoveredObject.getName() for _, v in ipairs(searchOnObj(hoveredObject)) do @@ -91,7 +104,7 @@ function takeClueFromLocation(playerColor, hoveredObject) for _, v in ipairs(search) do local obj = v.hit_object - if obj.tag == "Card" then + if obj.type == "Card" then cardName = obj.getName() break end diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 5465a9cf..c9ba6cb2 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -226,26 +226,23 @@ end -- Discard buttons --------------------------------------------------------- --- builds a function that discards things in searchPosition --- stuff on the card/deck will be put into the local trashcan -function makeDiscardHandlerFor(searchPosition) - return function () - local origin = self.positionToWorld(searchPosition) - for _, obj in ipairs(searchArea(origin, {2, 1, 3.2})) do - if isCardOrDeck(obj) then - if obj.hasTag("PlayerCard") then - placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation()) - else - placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0}) - end - -- put chaos tokens back into bag (e.g. Unrelenting) - elseif tokenChecker.isChaosToken(obj) then - local chaosBag = chaosBagApi.findChaosBag() - chaosBag.putObject(obj) - -- don't touch the table or this playmat itself - elseif obj.guid ~= "4ee1f2" and obj ~= self then - ownedObjects.Trash.putObject(obj) +-- performs a search in the provided position and discard objects +---@param searchPosition Table Global position for the search +function discardObjectsAtPosition(searchPosition) + for _, obj in ipairs(searchArea(searchPosition, {2, 1, 3.2})) do + if isCardOrDeck(obj) then + if obj.hasTag("PlayerCard") then + placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation()) + else + placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0}) end + -- put chaos tokens back into bag (e.g. Unrelenting) + elseif tokenChecker.isChaosToken(obj) then + local chaosBag = chaosBagApi.findChaosBag() + chaosBag.putObject(obj) + -- don't touch locked objects (like the table etc.) + elseif not obj.getLock() then + ownedObjects.Trash.putObject(obj) end end end @@ -294,9 +291,8 @@ end function makeDiscardButton(xValue, number) local position = { xValue, 0.1, -0.94} local searchPosition = {-position[1], position[2], position[3] + 0.32} - local handler = makeDiscardHandlerFor(searchPosition) local handlerName = 'handler' .. number - self.setVar(handlerName, handler) + self.setVar(handlerName, function() return discardObjectsAtPosition(self.positionToWorld(searchPosition)) end) self.createButton({ label = "Discard", click_function = handlerName, diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index a051cfe6..2ceba990 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -97,6 +97,14 @@ do end end + -- Triggers the Upkeep for the requested playmat + ---@param matColor String Color of the playmat - White, Orange, Green, Red or All + PlaymatApi.discardObjectsAtPosition = function(matColor, searchPosition) + for _, mat in pairs(getMatForColor(matColor)) do + mat.call("discardObjectsAtPosition", searchPosition) + end + end + -- Returns the active investigator id ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support "All") PlaymatApi.returnInvestigatorId = function(matColor) From 6e6ab65d6159b8e2e082d0b542817043bfb74a5e Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 22 Oct 2023 00:15:08 +0200 Subject: [PATCH 2/8] updated documentation --- src/playermat/PlaymatApi.ttslua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index 2ceba990..a4f0b570 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -97,8 +97,9 @@ do end end - -- Triggers the Upkeep for the requested playmat + -- Triggers the discard function of the requested playmat at the position ---@param matColor String Color of the playmat - White, Orange, Green, Red or All + ---@param searchPosition Table Global position for the discard PlaymatApi.discardObjectsAtPosition = function(matColor, searchPosition) for _, mat in pairs(getMatForColor(matColor)) do mat.call("discardObjectsAtPosition", searchPosition) From 6687f52f6abe8fddf0a0a3b7ac05669a756809cd Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Mon, 23 Oct 2023 11:25:17 +0200 Subject: [PATCH 3/8] updated discard handling --- src/core/GameKeyHandler.ttslua | 51 ++++++++++++++++++++++++++++----- src/playermat/Playmat.ttslua | 15 ++++++---- src/playermat/PlaymatApi.ttslua | 10 +++---- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 586e45e5..4bb5ddaf 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -47,16 +47,53 @@ function addDoomToAgenda() doomCounter.call("addVal", 1) end --- trigger the discard function at the pointer position (either to discard pile or trash) +-- discard the hovered object to the respective trashcan and discard tokens on it if it was a card function discardObject(playerColor, hoveredObject) - local discardPos = Player[playerColor].getPointerPosition() - - if hoveredObject and (hoveredObject.type == "Card" or hoveredObject.type == "Deck") then - discardPos = hoveredObject.getPosition() + if hoveredObject == nil then + broadcastToColor("Hover a token/tile or a card/deck and try again.", playerColor, "Yellow") + return end - local matColor = playmatApi.getMatColorByPosition(discardPos) - playmatApi.discardObjectsAtPosition(matColor, discardPos) + -- check if in playareazone + local playAreaZone = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone") + local isInPlayAreaZone = false + for _, zone in ipairs(hoveredObject.getZones()) do + if zone == playAreaZone then + isInPlayAreaZone = true + break + end + end + + if hoveredObject.type == "Card" or hoveredObject.type == "Deck" then + if hoveredObject.hasTag("Location") then + broadcastToAll("Watch out: A location was discarded.", "Yellow") + end + + -- discard tokens / tiles on it + local discardTheseObjects = { hoveredObject } + for _, v in ipairs(searchOnObj(hoveredObject)) do + if v.hit_object.type == "Tile" then + table.insert(discardTheseObjects, v.hit_object) + end + end + + local matColor + if isInPlayAreaZone then + matColor = playmatApi.getMatColor(playerColor) + else + matColor = playmatApi.getMatColorByPosition(hoveredObject.getPosition()) + end + playmatApi.discardListOfObjects(matColor, discardTheseObjects) + elseif hoveredObject.type == "Tile" and not hoveredObject.locked then + local owner + if isInPlayAreaZone then + owner = "Mythos" + else + owner = playmatApi.getMatColorByPosition(hoveredObject.getPosition()) + end + local trash = guidReferenceApi.getObjectByOwnerAndType(owner, "Trash") + trash.putObject(hoveredObject) + end end -- moves the hovered card to the victory display diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index c9ba6cb2..325ba59b 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -226,10 +226,10 @@ end -- Discard buttons --------------------------------------------------------- --- performs a search in the provided position and discard objects ----@param searchPosition Table Global position for the search -function discardObjectsAtPosition(searchPosition) - for _, obj in ipairs(searchArea(searchPosition, {2, 1, 3.2})) do +-- handles discarding for a list of objects +---@param objList Table List of objects to discard +function discardListOfObjects(objList) + for _, obj in ipairs(objList) do if isCardOrDeck(obj) then if obj.hasTag("PlayerCard") then placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation()) @@ -292,7 +292,12 @@ function makeDiscardButton(xValue, number) local position = { xValue, 0.1, -0.94} local searchPosition = {-position[1], position[2], position[3] + 0.32} local handlerName = 'handler' .. number - self.setVar(handlerName, function() return discardObjectsAtPosition(self.positionToWorld(searchPosition)) end) + self.setVar(handlerName, function() + local cardSizeSearch = {2, 1, 3.2} + local globalSearchPosition = self.positionToWorld(searchPosition) + local searchResult = searchArea(globalSearchPosition, cardSizeSearch) + return discardListOfObjects(searchResult) + end) self.createButton({ label = "Discard", click_function = handlerName, diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index a4f0b570..5105a241 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -97,12 +97,12 @@ do end end - -- Triggers the discard function of the requested playmat at the position - ---@param matColor String Color of the playmat - White, Orange, Green, Red or All - ---@param searchPosition Table Global position for the discard - PlaymatApi.discardObjectsAtPosition = function(matColor, searchPosition) + -- Handles discarding for the requested playmat for the provided list of objects + ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support "All") + ---@param objList Table List of objects to discard + PlaymatApi.discardListOfObjects = function(matColor, objList) for _, mat in pairs(getMatForColor(matColor)) do - mat.call("discardObjectsAtPosition", searchPosition) + mat.call("discardListOfObjects", objList) end end From ffe8a642d3f89fa4425585f405bee27ddcdb43e9 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 28 Oct 2023 16:02:42 +0200 Subject: [PATCH 4/8] bugfix to avoid duplicating objects --- src/playermat/Playmat.ttslua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 325ba59b..e2061512 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -279,7 +279,7 @@ function placeOrMergeIntoDeck(obj, pos, rot) function() obj.use_hands = true -- this avoids a TTS bug that merges unrelated cards that are not resting - if #searchResult == 1 then + if #searchResult == 1 and searchResult[1] ~= obj then -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put) pcall(function() searchResult[1].putObject(obj) end) end From cccc1007398cba17b8b463d5dfb8e90f30779bce Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 4 Nov 2023 12:25:12 +0100 Subject: [PATCH 5/8] reworked logic for color detection --- src/core/GameKeyHandler.ttslua | 79 ++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 4bb5ddaf..05734143 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -49,51 +49,56 @@ end -- discard the hovered object to the respective trashcan and discard tokens on it if it was a card function discardObject(playerColor, hoveredObject) - if hoveredObject == nil then + -- only continue if an unlocked card, deck or tile was hovered + if hoveredObject == nil + or hoveredObject.type ~= "Card" + and hoveredObject.type ~= "Deck" + and hoveredObject.type ~= "Tile" + and not hoveredObject.locked then broadcastToColor("Hover a token/tile or a card/deck and try again.", playerColor, "Yellow") return end - -- check if in playareazone - local playAreaZone = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone") - local isInPlayAreaZone = false - for _, zone in ipairs(hoveredObject.getZones()) do - if zone == playAreaZone then - isInPlayAreaZone = true - break - end + -- warning for locations since these are usually not meant to be discarded + if hoveredObject.hasTag("Location") then + broadcastToAll("Watch out: A location was discarded.", "Yellow") end - if hoveredObject.type == "Card" or hoveredObject.type == "Deck" then - if hoveredObject.hasTag("Location") then - broadcastToAll("Watch out: A location was discarded.", "Yellow") - end + -- initialize list of objects to discard + local discardTheseObjects = { hoveredObject } - -- discard tokens / tiles on it - local discardTheseObjects = { hoveredObject } + -- discard tokens / tiles on cards / decks + if hoveredObject.type ~= "Tile" then for _, v in ipairs(searchOnObj(hoveredObject)) do if v.hit_object.type == "Tile" then table.insert(discardTheseObjects, v.hit_object) end end - - local matColor - if isInPlayAreaZone then - matColor = playmatApi.getMatColor(playerColor) - else - matColor = playmatApi.getMatColorByPosition(hoveredObject.getPosition()) - end - playmatApi.discardListOfObjects(matColor, discardTheseObjects) - elseif hoveredObject.type == "Tile" and not hoveredObject.locked then - local owner - if isInPlayAreaZone then - owner = "Mythos" - else - owner = playmatApi.getMatColorByPosition(hoveredObject.getPosition()) - end - local trash = guidReferenceApi.getObjectByOwnerAndType(owner, "Trash") - trash.putObject(hoveredObject) end + + local pos = hoveredObject.getPosition() + local closestMatColor = playmatApi.getMatColorByPosition(pos) + + -- check if actually on the closest playmat + local closestMat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat") + local bounds = closestMat.getBounds() + + -- define the area "near" the playmat + local bufferAroundPlaymat = 2 + local areaNearPlaymat = {} + areaNearPlaymat.minX = bounds.center.x - bounds.size.x / 2 - bufferAroundPlaymat + areaNearPlaymat.maxX = bounds.center.x + bounds.size.x / 2 + bufferAroundPlaymat + areaNearPlaymat.minZ = bounds.center.z - bounds.size.z / 2 - bufferAroundPlaymat + areaNearPlaymat.maxZ = bounds.center.z + bounds.size.z / 2 + bufferAroundPlaymat + + -- discard to closest mat if near it, use triggering playmat if not + local discardForMatColor + if inArea(pos, areaNearPlaymat) then + discardForMatColor = closestMatColor + else + discardForMatColor = playmatApi.getMatColor(playerColor) + end + playmatApi.discardListOfObjects(discardForMatColor, discardTheseObjects) end -- moves the hovered card to the victory display @@ -202,3 +207,13 @@ function searchOnObj(obj) origin = obj.getPosition() }) end + +-- Simple method to check if the given point is in a specified area +---@param point Vector Point to check, only x and z values are relevant +---@param bounds Table Defined area to see if the point is within +function inArea(point, bounds) + return (point.x > bounds.minX + and point.x < bounds.maxX + and point.z > bounds.minZ + and point.z < bounds.maxZ) +end \ No newline at end of file From 93e26b6b73371dc0fa5f9747df4f731dd00d449e Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 5 Nov 2023 10:38:31 +0100 Subject: [PATCH 6/8] added remove a use hotkey --- src/core/GameKeyHandler.ttslua | 85 +++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 7 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 05734143..4ddab8e4 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -9,6 +9,7 @@ function onLoad() addHotkey("Bless/Curse Status", showBlessCurseStatus) addHotkey("Discard Object", discardObject) addHotkey("Move card to Victory Display", moveCardToVictoryDisplay) + addHotkey("Remove a use", removeOneUse) addHotkey("Take clue from location", takeClueFromLocation) addHotkey("Upkeep", triggerUpkeep) addHotkey("Upkeep (Multi-handed)", triggerUpkeepMultihanded) @@ -51,10 +52,8 @@ end function discardObject(playerColor, hoveredObject) -- only continue if an unlocked card, deck or tile was hovered if hoveredObject == nil - or hoveredObject.type ~= "Card" - and hoveredObject.type ~= "Deck" - and hoveredObject.type ~= "Tile" - and not hoveredObject.locked then + or (hoveredObject.type ~= "Card" and hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Tile") + or hoveredObject.locked then broadcastToColor("Hover a token/tile or a card/deck and try again.", playerColor, "Yellow") return end @@ -76,6 +75,12 @@ function discardObject(playerColor, hoveredObject) end end + local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor) + playmatApi.discardListOfObjects(discardForMatColor, discardTheseObjects) +end + +-- helper function to get the player to trigger the discard function for +function getColorToDiscardFor(hoveredObject, playerColor) local pos = hoveredObject.getPosition() local closestMatColor = playmatApi.getMatColorByPosition(pos) @@ -94,11 +99,10 @@ function discardObject(playerColor, hoveredObject) -- discard to closest mat if near it, use triggering playmat if not local discardForMatColor if inArea(pos, areaNearPlaymat) then - discardForMatColor = closestMatColor + return closestMatColor else - discardForMatColor = playmatApi.getMatColor(playerColor) + return playmatApi.getMatColor(playerColor) end - playmatApi.discardListOfObjects(discardForMatColor, discardTheseObjects) end -- moves the hovered card to the victory display @@ -106,6 +110,66 @@ function moveCardToVictoryDisplay(_, hoveredObject) victoryDisplayApi.placeCard(hoveredObject) end +-- removes a use from a card (or a token if hovered) +function removeOneUse(playerColor, hoveredObject) + -- only continue if an unlocked card or tile was hovered + if hoveredObject == nil + or (hoveredObject.type ~= "Card" and hoveredObject.type ~= "Tile") + or hoveredObject.locked then + broadcastToColor("Hover a token/tile or a card and try again.", playerColor, "Yellow") + return + end + + local targetObject = nil + + -- discard hovered token / tile + if hoveredObject.type == "Tile" then + targetObject = hoveredObject + elseif hoveredObject.type == "Card" then + -- grab the first use type from the metadata (or nil) + local notes = JSON.decode(hoveredObject.getGMNotes()) or {} + local usesData = notes.uses or {} + local useInfo = usesData[1] or {} + local searchForType = useInfo.type + if searchForType then searchForType = searchForType:lower() end + + for _, v in ipairs(searchOnObj(hoveredObject)) do + local obj = v.hit_object + if obj.type == "Tile" and not obj.locked then + -- check for matching object, otherwise use the first hit + if obj.memo == searchForType then + targetObject = obj + break + elseif not targetObject then + targetObject = obj + end + end + end + end + + -- error handling + if not targetObject then + broadcastToColor("No tokens found!", playerColor, "Yellow") + return + end + + -- feedback message + local tokenName = targetObject.getName() + if tokenName == "" then + if targetObject.memo ~= "" then + tokenName = titleCase(targetObject.memo) + else + tokenName = "Unknown" + end + end + + local playerName = Player[playerColor].steam_name + broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor) + + local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor) + playmatApi.discardListOfObjects(discardForMatColor, { targetObject }) +end + -- takes a clue from a location, player needs to hover the clue directly or the location function takeClueFromLocation(playerColor, hoveredObject) local cardName, clue @@ -216,4 +280,11 @@ function inArea(point, bounds) and point.x < bounds.maxX and point.z > bounds.minZ and point.z < bounds.maxZ) +end + +-- capitalizes the first letter +function titleCase(str) + local first = str:sub(1, 1) + local rest = str:sub(2) + return first:upper() .. rest:lower() end \ No newline at end of file From 8b04ee02452d0a670a4507083d514773fb6cbe6b Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 5 Nov 2023 17:17:28 +0100 Subject: [PATCH 7/8] clue/doom handling --- src/core/GameKeyHandler.ttslua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 4ddab8e4..aa178ef3 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -153,11 +153,25 @@ function removeOneUse(playerColor, hoveredObject) return end + -- handling for stacked tokens + if targetObject.getQuantity() > 1 then + targetObject = targetObject.takeObject() + end + -- feedback message local tokenName = targetObject.getName() if tokenName == "" then if targetObject.memo ~= "" then - tokenName = titleCase(targetObject.memo) + -- name handling for clue / doom + if targetObject.memo == "clueDoom" then + if targetObject.is_face_down then + tokenName = "Doom" + else + tokenName = "Clue" + end + else + tokenName = titleCase(targetObject.memo) + end else tokenName = "Unknown" end From 291465ca13e95f162dd0a263e6562467976294bd Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 5 Nov 2023 18:03:21 +0100 Subject: [PATCH 8/8] excluded resource counters --- src/core/GameKeyHandler.ttslua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index aa178ef3..a5a8d1f4 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -135,7 +135,7 @@ function removeOneUse(playerColor, hoveredObject) for _, v in ipairs(searchOnObj(hoveredObject)) do local obj = v.hit_object - if obj.type == "Tile" and not obj.locked then + if obj.type == "Tile" and not obj.locked and obj.memo ~= "resourceCounter" then -- check for matching object, otherwise use the first hit if obj.memo == searchForType then targetObject = obj