From d5fac353a7420631797d1efaf29854a336187257 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 5 Jan 2023 14:10:45 +0100 Subject: [PATCH] use local discard pile and draw deck position --- objects/3DText.134348.json | 4 ++-- objects/3DText.a28d9c.json | 2 +- objects/Playermat1White.8b081b.json | 2 +- objects/Playermat1White.8b081b.ttslua | 3 --- objects/Playermat2Orange.bd0ff4.json | 2 +- objects/Playermat2Orange.bd0ff4.ttslua | 3 --- objects/Playermat3Green.383d8b.json | 2 +- objects/Playermat3Green.383d8b.ttslua | 3 --- objects/Playermat4Red.0840d5.json | 2 +- objects/Playermat4Red.0840d5.ttslua | 3 --- src/playermat/Playmat.ttslua | 8 +++++++- src/playermat/PlaymatApi.ttslua | 2 +- 12 files changed, 15 insertions(+), 21 deletions(-) diff --git a/objects/3DText.134348.json b/objects/3DText.134348.json index 91e0fad0..81e0c934 100644 --- a/objects/3DText.134348.json +++ b/objects/3DText.134348.json @@ -39,9 +39,9 @@ }, "Tooltip": true, "Transform": { - "posX": 36.91, + "posX": 37.5, "posY": 1.572, - "posZ": 28.789, + "posZ": 28.5, "rotX": 90, "rotY": 90, "rotZ": 0, diff --git a/objects/3DText.a28d9c.json b/objects/3DText.a28d9c.json index 7a28c71b..a912b258 100644 --- a/objects/3DText.a28d9c.json +++ b/objects/3DText.a28d9c.json @@ -29,7 +29,7 @@ "Snap": true, "Sticky": true, "Text": { - "Text": "Player card area - use the panel below to spawn cards!", + "Text": "Player card area - use the panel below to spawn cards", "colorstate": { "b": 1, "g": 1, diff --git a/objects/Playermat1White.8b081b.json b/objects/Playermat1White.8b081b.json index c86ba5c5..12bb5635 100644 --- a/objects/Playermat1White.8b081b.json +++ b/objects/Playermat1White.8b081b.json @@ -211,7 +211,7 @@ "Position": { "x": -1.82, "y": 0.1, - "z": -0.03 + "z": 0 }, "Rotation": { "x": 0, diff --git a/objects/Playermat1White.8b081b.ttslua b/objects/Playermat1White.8b081b.ttslua index 7a5d78de..b2cd6913 100644 --- a/objects/Playermat1White.8b081b.ttslua +++ b/objects/Playermat1White.8b081b.ttslua @@ -5,9 +5,6 @@ PLAYER_COLOR = "White" PLAY_ZONE_POSITION = { x = -54.5, y = 4, z = 19 } PLAY_ZONE_SCALE = { x = 32, y = 5, z = 12 } -DRAW_DECK_POSITION = { x = -54.8, y = 2.5, z = 4.29 } -DISCARD_PILE_POSITION = { x = -58.9, y = 4, z = 4.29 } - TRASHCAN_GUID = "147e80" STAT_TRACKER_GUID = "e598c2" RESOURCE_COUNTER_GUID = "4406f0" diff --git a/objects/Playermat2Orange.bd0ff4.json b/objects/Playermat2Orange.bd0ff4.json index 5f08d57f..4e439de4 100644 --- a/objects/Playermat2Orange.bd0ff4.json +++ b/objects/Playermat2Orange.bd0ff4.json @@ -211,7 +211,7 @@ "Position": { "x": -1.82, "y": 0.1, - "z": -0.03 + "z": 0 }, "Rotation": { "x": 0, diff --git a/objects/Playermat2Orange.bd0ff4.ttslua b/objects/Playermat2Orange.bd0ff4.ttslua index 2e83d081..0d86c537 100644 --- a/objects/Playermat2Orange.bd0ff4.ttslua +++ b/objects/Playermat2Orange.bd0ff4.ttslua @@ -5,9 +5,6 @@ PLAYER_COLOR = "Orange" PLAY_ZONE_POSITION = { x = -54.5, y = 4, z = -19 } PLAY_ZONE_SCALE = { x = 32, y = 5, z = 12 } -DRAW_DECK_POSITION = { x = -54.86, y = 2.5, z = -27.82 } -DISCARD_PILE_POSITION = { x = -58.96, y = 4, z = -27.82 } - TRASHCAN_GUID = "f7b6c8" STAT_TRACKER_GUID = "b4a5f7" RESOURCE_COUNTER_GUID = "816d84" diff --git a/objects/Playermat3Green.383d8b.json b/objects/Playermat3Green.383d8b.json index 52e96e5d..c8bae84a 100644 --- a/objects/Playermat3Green.383d8b.json +++ b/objects/Playermat3Green.383d8b.json @@ -211,7 +211,7 @@ "Position": { "x": -1.82, "y": 0.1, - "z": -0.03 + "z": 0 }, "Rotation": { "x": 0, diff --git a/objects/Playermat3Green.383d8b.ttslua b/objects/Playermat3Green.383d8b.ttslua index e02af58c..17c1a652 100644 --- a/objects/Playermat3Green.383d8b.ttslua +++ b/objects/Playermat3Green.383d8b.ttslua @@ -5,9 +5,6 @@ PLAYER_COLOR = "Green" PLAY_ZONE_POSITION = { x = -26.5, y = 4, z = 26.5 } PLAY_ZONE_SCALE = { x = 32, y = 5, z = 12 } -DRAW_DECK_POSITION = { x = -42.04, y = 2.5, z = 26.45 } -DISCARD_PILE_POSITION = { x = -42.04, y = 4, z = 30.55 } - TRASHCAN_GUID = "5f896a" STAT_TRACKER_GUID = "af7ed7" RESOURCE_COUNTER_GUID = "cd15ac" diff --git a/objects/Playermat4Red.0840d5.json b/objects/Playermat4Red.0840d5.json index 264e7a82..11f926d2 100644 --- a/objects/Playermat4Red.0840d5.json +++ b/objects/Playermat4Red.0840d5.json @@ -211,7 +211,7 @@ "Position": { "x": -1.82, "y": 0.1, - "z": -0.03 + "z": 0 }, "Rotation": { "x": 0, diff --git a/objects/Playermat4Red.0840d5.ttslua b/objects/Playermat4Red.0840d5.ttslua index a40f9878..024f8cdd 100644 --- a/objects/Playermat4Red.0840d5.ttslua +++ b/objects/Playermat4Red.0840d5.ttslua @@ -5,9 +5,6 @@ PLAYER_COLOR = "Red" PLAY_ZONE_POSITION = { x = -26.5, y = 4, z = -26.5 } PLAY_ZONE_SCALE = { x = 32, y = 5, z = 12 } -DRAW_DECK_POSITION = { x = -18.64, y = 2.5, z = -26.45 } -DISCARD_PILE_POSITION = { x = -18.64, y = 4, z = -30.55 } - TRASHCAN_GUID = "4b8594" STAT_TRACKER_GUID = "e74881" RESOURCE_COUNTER_GUID = "a4b60d" diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index e19e6c26..1a3e12e7 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -49,6 +49,8 @@ local THREAT_AREA = { } } +local DRAW_DECK_POSITION = { x = -1.82, y = 1, z = 0 } +local DISCARD_PILE_POSITION = { x = -1.82, y = 1.5, z = 0.61 } local PLAY_ZONE_ROTATION = self.getRotation() local TRASHCAN @@ -391,7 +393,7 @@ end function shuffleDiscardIntoDeck() if not discardPile.is_face_down then discardPile.flip() end discardPile.shuffle() - discardPile.setPositionSmooth(DRAW_DECK_POSITION, false, false) + discardPile.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false) drawDeck = discardPile discardPile = nil end @@ -619,6 +621,10 @@ function drawEncountercard(_, _, isRightClick) Global.call("drawEncountercard", {self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET), self.getRotation(), isRightClick}) end +function returnGlobalDiscardPosition() + return self.positionToWorld(DISCARD_PILE_POSITION) +end + -- Sets this playermat's draw 1 button to visible ---@param visible Boolean. Whether the draw 1 button should be visible function showDrawButton(visible) diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index 621c22de..b51b5ba4 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -53,7 +53,7 @@ do ---@param matColor String Color of the playermat PlaymatApi.getDiscardPosition = function(matColor) local mat = getObjectFromGUID(MAT_IDS[matColor]) - return mat.getTable("DISCARD_PILE_POSITION") + return mat.call("returnGlobalDiscardPosition") end -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If