From 9b3a121c9754b0b33c9049532d7c326f69567841 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Tue, 19 Nov 2024 23:51:50 +0100 Subject: [PATCH] Added "Token Draw Dummys" - typing numbers to draw x tokens --- config.json | 4 ++ objects/TokenDrawDummy.dummy1.json | 58 ++++++++++++++++++++++++++++ objects/TokenDrawDummy.dummy2.json | 58 ++++++++++++++++++++++++++++ objects/TokenDrawDummy.dummy3.json | 58 ++++++++++++++++++++++++++++ objects/TokenDrawDummy.dummy4.json | 58 ++++++++++++++++++++++++++++ src/core/GUIDReferenceHandler.ttslua | 4 ++ src/core/Global.ttslua | 9 ++++- src/playermat/TokenDrawDummy.ttslua | 22 +++++++++++ 8 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 objects/TokenDrawDummy.dummy1.json create mode 100644 objects/TokenDrawDummy.dummy2.json create mode 100644 objects/TokenDrawDummy.dummy3.json create mode 100644 objects/TokenDrawDummy.dummy4.json create mode 100644 src/playermat/TokenDrawDummy.ttslua diff --git a/config.json b/config.json index 0e451f48..f2025a2a 100644 --- a/config.json +++ b/config.json @@ -187,6 +187,10 @@ "ChaosBagManager.023240", "PlaceholderBoxDummy.a93466", "PopestsBorderlessVol1.fecccd", + "TokenDrawDummy.dummy1", + "TokenDrawDummy.dummy2", + "TokenDrawDummy.dummy3", + "TokenDrawDummy.dummy4", "Tokencache_1.a15273", "Tokencache_0.0a8592", "Tokencache_-1.b644d2", diff --git a/objects/TokenDrawDummy.dummy1.json b/objects/TokenDrawDummy.dummy1.json new file mode 100644 index 00000000..a516cd20 --- /dev/null +++ b/objects/TokenDrawDummy.dummy1.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2501268517219098388/0936FEE03B410319658B5E05DB5D486CEDDE98F5/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": false, + "GMNotes": "", + "GUID": "dummy1", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"playermat/TokenDrawDummy\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "White", + "Name": "Custom_Tile", + "Nickname": "Token Draw Dummy", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -50.25, + "posY": 1.3, + "posZ": 4.2, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.9, + "scaleY": 1, + "scaleZ": 0.9 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/TokenDrawDummy.dummy2.json b/objects/TokenDrawDummy.dummy2.json new file mode 100644 index 00000000..8ae9f179 --- /dev/null +++ b/objects/TokenDrawDummy.dummy2.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2501268517219098388/0936FEE03B410319658B5E05DB5D486CEDDE98F5/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": false, + "GMNotes": "", + "GUID": "dummy2", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"playermat/TokenDrawDummy\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "White", + "Name": "Custom_Tile", + "Nickname": "Token Draw Dummy", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -50.25, + "posY": 1.3, + "posZ": -28, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.9, + "scaleY": 1, + "scaleZ": 0.9 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/TokenDrawDummy.dummy3.json b/objects/TokenDrawDummy.dummy3.json new file mode 100644 index 00000000..8e635add --- /dev/null +++ b/objects/TokenDrawDummy.dummy3.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2501268517219098388/0936FEE03B410319658B5E05DB5D486CEDDE98F5/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": false, + "GMNotes": "", + "GUID": "dummy3", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"playermat/TokenDrawDummy\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "White", + "Name": "Custom_Tile", + "Nickname": "Token Draw Dummy", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -42.25, + "posY": 1.3, + "posZ": 21.85, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 0.9, + "scaleY": 1, + "scaleZ": 0.9 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/TokenDrawDummy.dummy4.json b/objects/TokenDrawDummy.dummy4.json new file mode 100644 index 00000000..d0318de3 --- /dev/null +++ b/objects/TokenDrawDummy.dummy4.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2501268517219098388/0936FEE03B410319658B5E05DB5D486CEDDE98F5/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": false, + "GMNotes": "", + "GUID": "dummy4", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"playermat/TokenDrawDummy\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "White", + "Name": "Custom_Tile", + "Nickname": "Token Draw Dummy", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -18.45, + "posY": 1.3, + "posZ": -21.85, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 0.9, + "scaleY": 1, + "scaleZ": 0.9 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/src/core/GUIDReferenceHandler.ttslua b/src/core/GUIDReferenceHandler.ttslua index dc824471..b9c83d7f 100644 --- a/src/core/GUIDReferenceHandler.ttslua +++ b/src/core/GUIDReferenceHandler.ttslua @@ -11,6 +11,7 @@ local GuidReferences = { Playermat = "8b081b", ResourceCounter = "4406f0", TokenDiscardZone = "457de3", + TokenDrawDummy = "dummy1", Trash = "147e80" }, Orange = { @@ -23,6 +24,7 @@ local GuidReferences = { Playermat = "bd0ff4", ResourceCounter = "816d84", TokenDiscardZone = "457de4", + TokenDrawDummy = "dummy2", Trash = "f7b6c8" }, Green = { @@ -40,6 +42,7 @@ local GuidReferences = { Playermat = "383d8b", ResourceCounter = "cd15ac", TokenDiscardZone = "457de5", + TokenDrawDummy = "dummy3", TokenRemover = "2ba7a5", Trash = "5f896a" }, @@ -58,6 +61,7 @@ local GuidReferences = { Playermat = "0840d5", ResourceCounter = "a4b60d", TokenDiscardZone = "457de6", + TokenDrawDummy = "dummy4", TokenRemover = "39b175", Trash = "4b8594" }, diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 42b9d2a0..6b87dcc2 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -557,9 +557,16 @@ function drawChaosToken(params) -- add the token to the list, compute new position based on list length local tokenOffset = Vector(-1.55 + 0.17 * #chaosTokens, 0.25, -0.58) + + -- slightly rotate subsequent chaos tokens + local tokenRotZ = 0 + if #chaosTokens > 0 then + tokenRotZ = 354.5 + end + local takeParameters = params.takeParameters or {} takeParameters.position = takeParameters.position or params.mat.positionToWorld(tokenOffset) - takeParameters.rotation = takeParameters.rotation or params.mat.getRotation() + takeParameters.rotation = takeParameters.rotation or params.mat.getRotation():setAt("z", tokenRotZ) local token if params.guidToBeResolved then diff --git a/src/playermat/TokenDrawDummy.ttslua b/src/playermat/TokenDrawDummy.ttslua new file mode 100644 index 00000000..711220cd --- /dev/null +++ b/src/playermat/TokenDrawDummy.ttslua @@ -0,0 +1,22 @@ +local chaosBagApi = require("chaosbag/ChaosBagApi") +local guidReferenceApi = require("core/GUIDReferenceApi") + +local matColor + +function onLoad() + matColor = self.getMemo() + self.max_typed_number = 9 +end + +function onNumberTyped(playerColor, number) + if number < 1 then return end + + printToColor("Drawing " .. number .. " chaos tokens", playerColor) + + local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") + if mat ~= nil then + for i = 1, number do + chaosBagApi.drawChaosToken(mat, true) + end + end +end