diff --git a/config.json b/config.json
index 810bf746..e1e364ce 100644
--- a/config.json
+++ b/config.json
@@ -127,7 +127,6 @@
"DataHelper.708279",
"BlessCurseManager.5933fb",
"Notecard.d8d357",
- "ArkhamDeckCutter.445115",
"ScriptingTrigger.a2f932",
"EdgeoftheEarth.895eaa",
"TheDream-Eaters.a16a1a",
diff --git a/objects/ArkhamDeckCutter.445115.json b/objects/ArkhamDeckCutter.445115.json
deleted file mode 100644
index a34b4112..00000000
--- a/objects/ArkhamDeckCutter.445115.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "AltLookAngle": {
- "x": 0,
- "y": 0,
- "z": 0
- },
- "Autoraise": true,
- "ColorDiffuse": {
- "b": 0,
- "g": 0,
- "r": 0
- },
- "Description": "",
- "DragSelectable": true,
- "GMNotes": "",
- "GUID": "445115",
- "Grid": true,
- "GridProjection": false,
- "Hands": false,
- "HideWhenFaceDown": false,
- "IgnoreFoW": false,
- "LayoutGroupSortIndex": 0,
- "Locked": true,
- "LuaScript": "require(\"util/DeckCutter\")",
- "LuaScriptState": "",
- "MeasureMovement": false,
- "Name": "Checker_black",
- "Nickname": "Arkham Deck Cutter",
- "Snap": true,
- "Sticky": true,
- "Tooltip": true,
- "Transform": {
- "posX": 78,
- "posY": 1.208,
- "posZ": 6.315,
- "rotX": 0,
- "rotY": 270,
- "rotZ": 180,
- "scaleX": 0.25,
- "scaleY": 0.25,
- "scaleZ": 0.25
- },
- "Value": 0,
- "XmlUI": ""
-}
diff --git a/objects/Clues.3f22e5.json b/objects/Clues.3f22e5.json
index 17a50489..9a2ea3da 100644
--- a/objects/Clues.3f22e5.json
+++ b/objects/Clues.3f22e5.json
@@ -46,7 +46,7 @@
"Tooltip": false,
"Transform": {
"posX": -59.426,
- "posY": 1.3,
+ "posY": 1,
"posZ": -22.721,
"rotX": 0,
"rotY": 280,
diff --git a/objects/Clues.4111de.json b/objects/Clues.4111de.json
index 97c69558..c15f70b4 100644
--- a/objects/Clues.4111de.json
+++ b/objects/Clues.4111de.json
@@ -46,7 +46,7 @@
"Tooltip": false,
"Transform": {
"posX": -23.89,
- "posY": 1.3,
+ "posY": 1,
"posZ": -30.977,
"rotX": 0,
"rotY": 190,
diff --git a/objects/Clues.891403.json b/objects/Clues.891403.json
index 32174201..f27dbd1a 100644
--- a/objects/Clues.891403.json
+++ b/objects/Clues.891403.json
@@ -46,7 +46,7 @@
"Tooltip": false,
"Transform": {
"posX": -36.87,
- "posY": 1.3,
+ "posY": 1,
"posZ": 30.977,
"rotX": 0,
"rotY": 10,
diff --git a/objects/Clues.db85d6.json b/objects/Clues.db85d6.json
index 902a38f5..8c146fb7 100644
--- a/objects/Clues.db85d6.json
+++ b/objects/Clues.db85d6.json
@@ -46,7 +46,7 @@
"Tooltip": false,
"Transform": {
"posX": -59.426,
- "posY": 1.3,
+ "posY": 1,
"posZ": 9.395,
"rotX": 0,
"rotY": 280,
diff --git a/objects/DoomCounter.85c4c6.json b/objects/DoomCounter.85c4c6.json
index 6f061c53..583438fc 100644
--- a/objects/DoomCounter.85c4c6.json
+++ b/objects/DoomCounter.85c4c6.json
@@ -56,5 +56,5 @@
"scaleZ": 0.42
},
"Value": 0,
- "XmlUI_path": "DoomCounter.85c4c6.xml"
+ "XmlUI": "\u003cInclude src=\"DoomCounter.xml\"/\u003e"
}
diff --git a/objects/Fan-MadeAccessories.aa8b38.json b/objects/Fan-MadeAccessories.aa8b38.json
index c5a761d3..3420ead7 100644
--- a/objects/Fan-MadeAccessories.aa8b38.json
+++ b/objects/Fan-MadeAccessories.aa8b38.json
@@ -23,6 +23,7 @@
"CustomDataHelper.2547b3",
"UnderworldMarketHelper.3650ea",
"Subject5U-21Helper.1335e8",
+ "PlayermatHider.a758b2",
"Auto-failCounter.a9a321",
"ElderSignCounter.e62cb5"
],
diff --git a/objects/Fan-MadeAccessories.aa8b38/PlayermatHider.a758b2.json b/objects/Fan-MadeAccessories.aa8b38/PlayermatHider.a758b2.json
new file mode 100644
index 00000000..3c8a1e93
--- /dev/null
+++ b/objects/Fan-MadeAccessories.aa8b38/PlayermatHider.a758b2.json
@@ -0,0 +1,60 @@
+{
+ "AltLookAngle": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "Autoraise": true,
+ "ColorDiffuse": {
+ "b": 1,
+ "g": 1,
+ "r": 1
+ },
+ "CustomImage": {
+ "CustomTile": {
+ "Stackable": false,
+ "Stretch": true,
+ "Thickness": 0.1,
+ "Type": 3
+ },
+ "ImageScalar": 1,
+ "ImageSecondaryURL": "",
+ "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2115061845796985108/F0ADB7094641DA966FFA3AF0CC6987D33D2D9591/",
+ "WidthScale": 0
+ },
+ "Description": "Use the buttons to show / hide a playmat.",
+ "DragSelectable": true,
+ "GMNotes": "",
+ "GUID": "a758b2",
+ "Grid": true,
+ "GridProjection": false,
+ "Hands": false,
+ "HideWhenFaceDown": false,
+ "IgnoreFoW": false,
+ "LayoutGroupSortIndex": 0,
+ "Locked": false,
+ "LuaScript": "require(\"accessories/PlayermatHider\")",
+ "LuaScriptState": "",
+ "MeasureMovement": false,
+ "Name": "Custom_Tile",
+ "Nickname": "PlayermatHider",
+ "Snap": true,
+ "Sticky": true,
+ "Tags": [
+ "CleanUpHelper_ignore"
+ ],
+ "Tooltip": true,
+ "Transform": {
+ "posX": 0,
+ "posY": 2,
+ "posZ": 0,
+ "rotX": 0,
+ "rotY": 270,
+ "rotZ": 0,
+ "scaleX": 5,
+ "scaleY": 1,
+ "scaleZ": 5
+ },
+ "Value": 0,
+ "XmlUI": "\u003cInclude src=\"accessories/PlayermatHider.xml\"/\u003e"
+}
\ No newline at end of file
diff --git a/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json b/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json
index 17e60ad0..572e54b7 100644
--- a/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json
+++ b/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json
@@ -73,5 +73,5 @@
"scaleZ": 1.5
},
"Value": 0,
- "XmlUI_path": "OptionPanelSource.830bd0/CleanUpHelper.26cf4b.xml"
+ "XmlUI": "\u003cInclude src=\"accessories/CleanUpHelper.xml\"/\u003e"
}
diff --git a/src/accessories/PlayermatHider.ttslua b/src/accessories/PlayermatHider.ttslua
new file mode 100644
index 00000000..e01f1ccb
--- /dev/null
+++ b/src/accessories/PlayermatHider.ttslua
@@ -0,0 +1,41 @@
+local guidReferenceApi = require("core/GUIDReferenceApi")
+local objects
+
+function onClick_hideShow(player, matColor)
+ objects = guidReferenceApi.getObjectsByOwner(matColor)
+ local actionTokens = searchMat(objects.Playermat.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1}, isActionToken)
+ local pos = objects.Playermat.getPosition()
+ local mod = (pos.y > 0) and -2 or 2
+
+ -- move all objects
+ for _, obj in pairs(objects) do
+ obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
+ end
+
+ -- move action tokens
+ for _, obj in ipairs(actionTokens) do
+ obj.setLock(pos.y > 0)
+ obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
+ end
+end
+
+function isActionToken(x) return x.getDescription() == 'Action Token' end
+
+function searchMat(origin, size, filter)
+ local searchResult = Physics.cast({
+ origin = origin,
+ direction = { 0, 1, 0 },
+ orientation = objects.Playermat.getRotation(),
+ type = 3,
+ size = size,
+ max_distance = 0
+ })
+
+ local objList = {}
+ for _, v in ipairs(searchResult) do
+ if not filter or (filter and filter(v.hit_object)) then
+ table.insert(objList, v.hit_object)
+ end
+ end
+ return objList
+end
diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua
index 453de993..5b03de49 100644
--- a/src/core/PlayArea.ttslua
+++ b/src/core/PlayArea.ttslua
@@ -44,19 +44,15 @@ local LOC_LINK_EXCLUDE_SCENARIOS = {
["The Heart of Madness"] = true
}
-local guidReferenceApi = require("core/GUIDReferenceApi")
+local guidReferenceApi = require("core/GUIDReferenceApi")
local tokenManager = require("core/token/TokenManager")
-
local clueData = {}
local spawnedLocationGUIDs = {}
local locations = {}
local locationConnections = {}
local draggingGuids = {}
-local locationData
-local currentScenario
-
local missingData = {}
-local countedVP = {}
+local locationData, currentScenario
---------------------------------------------------------
-- general code
@@ -579,17 +575,23 @@ function setLimitSnapsByType(matchTypes)
end
-- count victory points on locations in play area
+---@param highlightOff Boolean True if highlighting should be enabled
---@return. Returns the total amount of VP found in the play area
-function countVP()
+function countVP(highlightOff)
local totalVP = 0
for cardId, metadata in pairs(locations) do
- if metadata ~= nil then
+ local card = getObjectFromGUID(cardId)
+ if metadata ~= nil and card ~= nil then
+ if highlightOff == true then
+ card.highlightOff("Green")
+ end
+
local cardVP = tonumber(metadata.victory) or 0
- if cardVP ~= 0 and not cardHasClues(cardId) then
+ if cardVP ~= 0 and not cardHasClues(card) then
totalVP = totalVP + cardVP
- if cardVP > 0 then
- table.insert(countedVP, getObjectFromGUID(cardId))
+ if highlightOff == false then
+ card.highlightOn("Green")
end
end
end
@@ -599,9 +601,8 @@ function countVP()
end
-- checks if a card has clues on it, returns true if clues are on it
----@param cardId String GUID of the card to check for clues
-function cardHasClues(cardId)
- local card = getObjectFromGUID(cardId)
+---@param card TTSObject Card to check for clues
+function cardHasClues(card)
for _, v in ipairs(searchOnObj(card)) do
local obj = v.hit_object
if obj.memo == "clueDoom" and obj.is_face_down == false then
@@ -639,22 +640,6 @@ function highlightMissingData(state)
end
end
--- highlights all locations in the play area with VP
----@param state Boolean True if highlighting should be enabled
-function highlightCountedVP(state)
- for i, obj in pairs(countedVP) do
- if obj ~= nil then
- if state then
- obj.highlightOff("Green")
- else
- obj.highlightOn("Green")
- end
- else
- countedVP[i] = nil
- end
- end
-end
-
-- rebuilds local snap points (could be useful in the future again)
function buildSnaps()
local upperleft = { x = 1.53, z = -1.09 }
diff --git a/src/core/PlayAreaApi.ttslua b/src/core/PlayAreaApi.ttslua
index f1281b40..db0ef564 100644
--- a/src/core/PlayAreaApi.ttslua
+++ b/src/core/PlayAreaApi.ttslua
@@ -79,7 +79,7 @@ do
-- highlights all locations in the play area with VP
---@param state Boolean True if highlighting should be enabled
PlayAreaApi.highlightCountedVP = function(state)
- return getPlayArea().call("highlightCountedVP", state)
+ return getPlayArea().call("countVP", state)
end
-- Checks if an object is in the play area (returns true or false)
diff --git a/src/core/VictoryDisplay.ttslua b/src/core/VictoryDisplay.ttslua
index c4c95a0e..404f8cdd 100644
--- a/src/core/VictoryDisplay.ttslua
+++ b/src/core/VictoryDisplay.ttslua
@@ -212,8 +212,7 @@ end
function highlightMissingData()
self.editButton({
index = 3,
- tooltip = (highlightMissing and "Enable" or "Disable") ..
- " highlighting of cards without metadata (VP on these is not counted)."
+ tooltip = (highlightMissing and "Enable" or "Disable") .. " highlighting of cards without metadata (VP on these is not counted)."
})
for _, obj in pairs(missingData) do
if obj ~= nil then
diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua
index 5879362a..e5160706 100644
--- a/src/playermat/Playmat.ttslua
+++ b/src/playermat/Playmat.ttslua
@@ -868,11 +868,15 @@ function showDrawButton(visible)
end
end
--- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
----@param showCounter Boolean Whether the clickable clue counter should be present
+-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues
+---@param showCounter Boolean Whether the clickable clue counter should be visible
function clickableClues(showCounter)
local clickerPos = ownedObjects.ClickableClueCounter.getPosition()
local clueCount = 0
+
+ -- move clue counters
+ local modY = showcounter and -0.525 or 0.525
+ ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))
if showCounter then
-- current clue count
@@ -883,18 +887,10 @@ function clickableClues(showCounter)
-- set value for clue clickers
ownedObjects.ClickableClueCounter.call("updateVal", clueCount)
-
- -- move clue counters up
- clickerPos.y = 1.52
- ownedObjects.ClickableClueCounter.setPosition(clickerPos)
else
-- current clue count
clueCount = ownedObjects.ClickableClueCounter.getVar("val")
- -- move clue counters down
- clickerPos.y = 1.3
- ownedObjects.ClickableClueCounter.setPosition(clickerPos)
-
-- spawn clues
local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})
for i = 1, clueCount do
diff --git a/src/util/DeckCutter.ttslua b/src/util/DeckCutter.ttslua
deleted file mode 100644
index 822f72f2..00000000
--- a/src/util/DeckCutter.ttslua
+++ /dev/null
@@ -1,30 +0,0 @@
--- cut 3 (6) cards from a deck if numpad 1 (2) is pressed
-function onScriptingButtonDown(index, player_color)
- if not (index >= 1 and index <= 2) then return end
-
- local count = index * 3
- local player = Player[player_color]
- local object = player.getHoverObject()
-
- if not object then
- broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
- return
- end
- if object.tag ~= "Deck" then
- broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
- return
- end
- if count >= object.getQuantity() then
- broadcastToColor("Deck is too small to cut " .. count .. " cards.", player_color, "Orange")
- return
- end
-
- local pos = object.positionToWorld(Vector(0, 0, -3.5))
- for _ = 1, count do
- object.takeObject {
- index = 0,
- position = pos,
- smooth = false
- }
- end
-end
diff --git a/src/util/TokenSpawnTool.ttslua b/src/util/TokenSpawnTool.ttslua
index c0b89257..91193734 100644
--- a/src/util/TokenSpawnTool.ttslua
+++ b/src/util/TokenSpawnTool.ttslua
@@ -59,6 +59,28 @@ function onScriptingButtonDown(index, playerColor)
if stateID ~= nil and stateID ~= 1 then
callback = function(spawned) spawned.setState(stateID) end
end
+ -- check hovered object for "resourceCounter" tokens and increase them instead
+ elseif tokenType == "resourceCounter" then
+ local hoverObj = Player[playerColor].getHoverObject()
+ if hoverObj then
+ if tokenType == hoverObj.getMemo() then
+ hoverObj.call("addOrSubtract")
+ return
+ end
+ end
+ -- check hovered object for "damage" and "horror" tokens and increase them instead
+ elseif tokenType == "damage" or tokenType == "horror" then
+ local hoverObj = Player[playerColor].getHoverObject()
+ if hoverObj then
+ if tokenType == hoverObj.getMemo() then
+ local stateInfo = hoverObj.getStates()
+ local stateId = hoverObj.getStateId()
+ if stateId <= #stateInfo then
+ hoverObj.setState(stateId + 1)
+ return
+ end
+ end
+ end
end
tokenManager.spawnToken(position, tokenType, rotation, callback)
diff --git a/objects/DoomCounter.85c4c6.xml b/xml/DoomCounter.xml
similarity index 100%
rename from objects/DoomCounter.85c4c6.xml
rename to xml/DoomCounter.xml
diff --git a/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.xml b/xml/accessories/CleanUpHelper.xml
similarity index 100%
rename from objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.xml
rename to xml/accessories/CleanUpHelper.xml
diff --git a/xml/accessories/PlayermatHider.xml b/xml/accessories/PlayermatHider.xml
new file mode 100644
index 00000000..ffc70b81
--- /dev/null
+++ b/xml/accessories/PlayermatHider.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Playermat Hider
+ |
+
+
+
+ Playermat 1 (White)
+ |
+
+
+
+
+ |
+
+
+
+ Playermat 2 (Orange)
+ |
+
+
+
+
+ |
+
+
+
+ Playermat 3 (Green)
+ |
+
+
+
+
+ |
+
+
+
+ Playermat 4 (Red)
+ |
+
+
+
+
+ |
+
+
\ No newline at end of file