From 14bf7c8dd592079d48491b1d6987b62c09bfd62d Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 21 Nov 2024 22:28:17 +0100 Subject: [PATCH 1/6] Fixed search lib --- config.json | 2 +- objects/PatchNotes.f47225.luascriptstate | 4 ++-- src/core/Constants.ttslua | 2 +- src/core/Global.ttslua | 10 ++++++---- src/mythos/VictoryDisplay.ttslua | 2 +- src/playermat/Playermat.ttslua | 2 +- src/util/SearchLib.ttslua | 3 ++- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config.json b/config.json index 34a4e973..cba85d5a 100644 --- a/config.json +++ b/config.json @@ -245,7 +245,7 @@ 0, 0 ], - "SaveName": "Arkham SCE - 4.0.2", + "SaveName": "Arkham SCE - 4.0.3", "Sky": "Sky_Museum", "SkyURL": "https://i.imgur.com/GkQqaOF.jpg", "SnapPoints_path": "SnapPoints.json", diff --git a/objects/PatchNotes.f47225.luascriptstate b/objects/PatchNotes.f47225.luascriptstate index c954022c..8fd6b615 100644 --- a/objects/PatchNotes.f47225.luascriptstate +++ b/objects/PatchNotes.f47225.luascriptstate @@ -85,7 +85,7 @@ }, "tooltip": "None", "value": [ - "Arkham Horror LCG SCE 4.0.2 - 11/21/2024" + "Arkham Horror LCG SCE 4.0.3 - 11/21/2024" ] }, { @@ -124,7 +124,7 @@ }, "tooltip": "None", "value": [ - "Changes from 4.0.2\n- added ability for 'number typing' to the chaos token draw button\n- added \"0 uses\" metadata for Charles Ross\n- added \"imprinting\" to Charisma / Relic Hunter (drop them on a playermat!)\n- turned \"randomize\" feature of action / ability tokens into a context menu entry\n- turned upgradesheets into XML and their boxes into crosses\n- fixed Clean Up Helper toggling the \"subtract doom\" feature\n- fixed DES scripting\n- fixed error with Navigation Overlay\n- fixed error with investigator placing on playermats\n- fixed error with Kohaku feedback messages\n- fixed issues with Campaign Importer / Exporter\n- fixed handling for cards with attachments (Deck Importer)\n\nHighlights from 4.0.0\n\nNew Stuff\n- added Parallel Mateo\n- added a global UI for the Bless / Curse manager\n- added a \"shuffle discard into deck\" button to playermats (for example for the mulligan)\n- added XML helper for \"Stella Clark\", \"The Red Clock\" and \"Elle Rubash\"\n- added \"clickability\" to damage / horror tokens and updated the font / image\n- added investigator specific things spawning when placing (e.g. Bounty tokens for Tony)\n- added a right-click function to the left-most \"Discard\" button on playermats\n- added ability for the \"doom in play\" counter to subtract from the total (e.g. Longest Night)\n\nBugfixes\n- fixed hotkey for multi-handed Upkeep\n- fixed wrong visibility of playermat option panels after loading\n- fixed issues with token redrawing\n- fixed issues with scenario reference card detection\n- updated Navigation Overlay to not break with removed playermats\n- Clean Up Helper: 'nil' handling for scenario, mini card detection and action token resetting\n\nThe campaigns were also updated with improved helpers and upgraded campaign logs!\nPreviewed / spoiled cards for the upcoming cycle \"The Drowned City\" can be accessed\nvia the download menu (bottom right corner of your screen).\n" + "Changes from 4.0.3\n- added ability for 'number typing' to the chaos token draw button\n- added \"0 uses\" metadata for Charles Ross\n- added \"imprinting\" to Charisma / Relic Hunter (drop them on a playermat!)\n- turned \"randomize\" feature of action / ability tokens into a context menu entry\n- turned upgradesheets into XML and their boxes into crosses\n- fixed Clean Up Helper toggling the \"subtract doom\" feature\n- fixed DES scripting\n- fixed error with Navigation Overlay\n- fixed error with investigator placing on playermats\n- fixed error with Kohaku feedback messages\n- fixed issues with Campaign Importer / Exporter\n- fixed handling for cards with attachments (Deck Importer)\n\nHighlights from 4.0.0\n\nNew Stuff\n- added Parallel Mateo\n- added a global UI for the Bless / Curse manager\n- added a \"shuffle discard into deck\" button to playermats (for example for the mulligan)\n- added XML helper for \"Stella Clark\", \"The Red Clock\" and \"Elle Rubash\"\n- added \"clickability\" to damage / horror tokens and updated the font / image\n- added investigator specific things spawning when placing (e.g. Bounty tokens for Tony)\n- added a right-click function to the left-most \"Discard\" button on playermats\n- added ability for the \"doom in play\" counter to subtract from the total (e.g. Longest Night)\n\nBugfixes\n- fixed hotkey for multi-handed Upkeep\n- fixed wrong visibility of playermat option panels after loading\n- fixed issues with token redrawing\n- fixed issues with scenario reference card detection\n- updated Navigation Overlay to not break with removed playermats\n- Clean Up Helper: 'nil' handling for scenario, mini card detection and action token resetting\n\nThe campaigns were also updated with improved helpers and upgraded campaign logs!\nPreviewed / spoiled cards for the upcoming cycle \"The Drowned City\" can be accessed\nvia the download menu (bottom right corner of your screen).\n" ] } ], diff --git a/src/core/Constants.ttslua b/src/core/Constants.ttslua index 2e0f6b4a..19accae4 100644 --- a/src/core/Constants.ttslua +++ b/src/core/Constants.ttslua @@ -34,6 +34,6 @@ ENCOUNTER_DECK_POS = Vector(-3.93, 1.5, 5.76) ENCOUNTER_DISCARD_POSITION = Vector(-3.85, 1.5, 10.38) -- online functionality related variables -MOD_VERSION = "4.0.2" +MOD_VERSION = "4.0.3" SOURCE_REPO = "https://github.com/Chr1Z93/SCED-downloads/releases/latest/download/" --SOURCE_REPO = "https://github.com/Chr1Z93/SCED-downloads/releases/download/v1.0.1/" diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 141c0ebb..de9f17e3 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -221,7 +221,8 @@ function onObjectEnterZone(zone, object) not tokenChecker.isChaosToken(object) and object.type == "Tile" and object.getMemo() and - not object.getLock() then + not object.getLock() and + object.interactable == true then local matcolor = playermatApi.getMatColorByPosition(object.getPosition()) local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash") trash.putObject(object) @@ -1590,8 +1591,8 @@ end -- first hit is the table surface, additional hits means something is there ---@return boolean: True if empty function checkPositionForContentSpawn(checkPos) - local searchResult = searchLib.atPosition(checkPos) - return #searchResult == 1 + local searchResult = searchLib.atPosition(checkPos, "isInteractable") + return #searchResult == 0 end -- downloading of the library file @@ -2948,7 +2949,8 @@ function removeTokensFromObject(params) elseif obj.getGUID() ~= "4ee1f2" and -- table obj ~= self and obj.memo ~= nil and - obj.getLock() == false then + obj.getLock() == false and + obj.interactable == true then trash.putObject(obj) end end diff --git a/src/mythos/VictoryDisplay.ttslua b/src/mythos/VictoryDisplay.ttslua index d5ebe31b..2dda5d6e 100644 --- a/src/mythos/VictoryDisplay.ttslua +++ b/src/mythos/VictoryDisplay.ttslua @@ -303,7 +303,7 @@ function placeCard(card) -- put chaos tokens back into bag local chaosBag = chaosBagApi.findChaosBag() chaosBag.putObject(obj) - elseif obj.memo ~= nil and obj.getLock() == false then + elseif obj.memo ~= nil and obj.getLock() == false and obj.interactable == true then trash.putObject(obj) end end diff --git a/src/playermat/Playermat.ttslua b/src/playermat/Playermat.ttslua index 76f04bae..fb3450fd 100644 --- a/src/playermat/Playermat.ttslua +++ b/src/playermat/Playermat.ttslua @@ -297,7 +297,7 @@ function discardListOfObjects(objList) elseif tokenChecker.isChaosToken(obj) then -- put chaos tokens back into bag (e.g. Unrelenting) chaosBagApi.returnChaosTokenToBag(obj, false) - elseif not obj.getLock() and not obj.hasTag("DontDiscard") then + elseif not obj.getLock() and not obj.hasTag("DontDiscard") and obj.interactable == true then -- don't touch locked objects (like the table etc.) or specific objects (like key tokens) ownedObjects.Trash.putObject(obj) end diff --git a/src/util/SearchLib.ttslua b/src/util/SearchLib.ttslua index 0e37a870..f5606901 100644 --- a/src/util/SearchLib.ttslua +++ b/src/util/SearchLib.ttslua @@ -6,6 +6,7 @@ do isCardOrDeck = function(x) return x.type == "Card" or x.type == "Deck" end, isClue = function(x) return x.memo == "clueDoom" and x.is_face_down == false end, isDoom = function(x) return x.memo == "clueDoom" and x.is_face_down == true end, + isInteractable = function(x) return x.interactable end, isTileOrToken = function(x) return x.type == "Tile" or x.type == "Generic" end, isUniversalToken = function(x) return x.getMemo() == "universalActionAbility" end, } @@ -31,7 +32,7 @@ do -- filter the result for matching objects local objList = {} for _, v in ipairs(searchResult) do - if (not filter or filterFunc(v.hit_object)) and v.hit_object.interactable then + if (not filter or filterFunc(v.hit_object)) then table.insert(objList, v.hit_object) end end From 67ff395b11b575d6cbf34292f9b51e6c91adbb11 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 22 Nov 2024 01:13:23 +0100 Subject: [PATCH 2/6] smooth moving interrupt handling --- src/core/Global.ttslua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index de9f17e3..9628a6ed 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -304,6 +304,10 @@ function onPlayerAction(player, action, targets) end end +function onObjectPickUp(_, object) + stopTokenTransformUpdating(object) +end + --------------------------------------------------------- -- chaos token drawing --------------------------------------------------------- @@ -2913,7 +2917,9 @@ function stopTokenTransformUpdating(card) end end cardTokens[card] = nil - card.use_hands = true + if card ~= nil then + card.use_hands = true + end end -- removes tokens from the provided card/deck From 0444c4c639404a447c61fb215f547db5106d8c94 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 22 Nov 2024 01:24:21 +0100 Subject: [PATCH 3/6] always re-get token transform --- src/core/Global.ttslua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 9628a6ed..6018449f 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2851,9 +2851,7 @@ function moveCardWithTokens(params) local position = params.position local rotation = params.rotation - if not cardTokens[card] then - storeTokenTransform(card) - end + storeTokenTransform(card) if rotation then card.setRotation(rotation) From dc8e9ba05fb8432e5c16dd31e18dac9c844b48ab Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 22 Nov 2024 01:27:52 +0100 Subject: [PATCH 4/6] stop first --- src/core/Global.ttslua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 6018449f..8bb6ac04 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2851,6 +2851,7 @@ function moveCardWithTokens(params) local position = params.position local rotation = params.rotation + stopTokenTransformUpdating(card) storeTokenTransform(card) if rotation then From 24545fc389202ab700246290054c50e2d1b37b24 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 22 Nov 2024 01:40:50 +0100 Subject: [PATCH 5/6] added rounding --- src/core/Global.ttslua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 8bb6ac04..8d9fe461 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2856,6 +2856,9 @@ function moveCardWithTokens(params) if rotation then card.setRotation(rotation) + else + local rot = card.getRotation() + card.setRotation(rot:setAt("y", roundToMultiple(rot.y, 45))) end if position then @@ -2961,3 +2964,7 @@ function removeTokensFromObject(params) end end end + +function roundToMultiple(num, mult) + return math.floor((num + mult / 2) / mult) * mult +end From c3cdd2f050828aba97b9321f450e9f4d23ac53d4 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 22 Nov 2024 01:43:14 +0100 Subject: [PATCH 6/6] rotation fixed --- src/core/GameKeyHandler.ttslua | 2 +- src/core/Global.ttslua | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 5a1ff71d..bfa5d381 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -85,7 +85,7 @@ function takeCardIntoThreatArea(playerColor, hoveredObject) -- work out the new rotation local matRotation = playermatApi.returnRotation(matColor) - local newCardRot = cardRot:setAt("y", matRotation.y + cardRot.y - ownerRotation.y) + local newCardRot = cardRot:setAt("y", roundToMultiple(matRotation.y + cardRot.y - ownerRotation.y, 45)) -- move the main card to threat area GlobalApi.moveCardWithTokens(hoveredObject, threatAreaPos, newCardRot) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 8d9fe461..8bb6ac04 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2856,9 +2856,6 @@ function moveCardWithTokens(params) if rotation then card.setRotation(rotation) - else - local rot = card.getRotation() - card.setRotation(rot:setAt("y", roundToMultiple(rot.y, 45))) end if position then @@ -2964,7 +2961,3 @@ function removeTokensFromObject(params) end end end - -function roundToMultiple(num, mult) - return math.floor((num + mult / 2) / mult) * mult -end