From abd4fc5f26732b50a31d9d93247da91285945a58 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 14 Dec 2023 09:51:33 +0100 Subject: [PATCH] some bugfixes --- src/accessories/CleanUpHelper.ttslua | 2 +- src/core/GameKeyHandler.ttslua | 22 ++++++++-------------- src/playermat/Playmat.ttslua | 1 - src/util/SearchLib.ttslua | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/accessories/CleanUpHelper.ttslua b/src/accessories/CleanUpHelper.ttslua index 0371aa31..9c146992 100644 --- a/src/accessories/CleanUpHelper.ttslua +++ b/src/accessories/CleanUpHelper.ttslua @@ -285,7 +285,7 @@ function tidyPlayerMatCoroutine() if i < 5 then objList = playmatApi.searchAroundPlaymat(COLORS[i]) else - objList = searchLib.inArea({ -2, 2, 10 }, _, { 55, 1, 13.5 }) + objList = searchLib.inArea({ -2, 2, 10 }, { 0, 270, 0 }, { 55, 1, 13.5 }) end for _, obj in ipairs(objList) do diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 8645172a..6766a828 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -209,18 +209,13 @@ function takeClueFromLocation(playerColor, hoveredObject) return elseif hoveredObject.type == "Card" then cardName = hoveredObject.getName() + local searchResult = searchLib.onObject(hoveredObject, "isClue") - for _, v in ipairs(searchLib.onObject(hoveredObject)) do - local obj = v.hit_object - if obj.memo == "clueDoom" and obj.is_face_down == false then - clue = obj - break - end - end - - if clue == nil then + if #searchResult == 0 then broadcastToColor("This card does not have any clues on it.", playerColor, "Yellow") return + else + clue = searchResult[1] end elseif hoveredObject.memo == "clueDoom" then if hoveredObject.is_face_down then @@ -228,11 +223,10 @@ function takeClueFromLocation(playerColor, hoveredObject) return end - for _, obj in ipairs(searchLib.belowPosition(hoveredObject.getPosition(), "isCard")) do - if obj.type == "Card" then - cardName = obj.getName() - break - end + local searchResult = searchLib.belowPosition(hoveredObject.getPosition(), "isCard") + + if #searchResult ~= 0 then + cardName = searchResult[1].getName() end else broadcastToColor("Hover a clue or card with clues and try again.", playerColor, "Yellow") diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 8b06d695..0d41779f 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -298,7 +298,6 @@ function doUpkeepFromHotkey(color) end function doUpkeep(_, clickedByColor, isRightClick) - -- right-click allow color changing if isRightClick then changeColor(clickedByColor) return diff --git a/src/util/SearchLib.ttslua b/src/util/SearchLib.ttslua index 444c463e..13550179 100644 --- a/src/util/SearchLib.ttslua +++ b/src/util/SearchLib.ttslua @@ -45,7 +45,7 @@ do -- searches the area on an object SearchLib.onObject = function(obj, filter) pos = obj.getPosition() - size = obj.getBounds().size + size = obj.getBounds().size:setAt("y", 1) return returnSearchResult(pos, _, size, filter) end