diff --git a/config.json b/config.json index dd8eb1af..ad8ed59d 100644 --- a/config.json +++ b/config.json @@ -67,6 +67,10 @@ "ScriptingTrigger.67ce9a", "Detailedphasereference.68fe54", "RulesIndex.91c83e", + "Clues.3f22e5", + "Clues.db85d6", + "Clues.891403", + "Clues.4111de", "Resources.4406f0", "Damage.eb08d6", "Horror.468e88", @@ -129,11 +133,10 @@ "LeakedItems.42cd6e", "ChaosTokenReserve.106418", "3DText.134348", - "Custom_Model.032300", - "Custom_Model.1769ed", - "Custom_Model.37be78", - "Custom_Model.d86b7c", - "ClueCounterSwapper.d919d6", + "ClueCounter.37be78", + "ClueCounter.1769ed", + "ClueCounter.032300", + "ClueCounter.d86b7c", "MasterClueCounter.4a3aa4", "LegacyAssets.7165a9", "Weaknessdecks.750fdd", diff --git a/objects/Custom_Model.032300.json b/objects/ClueCounter.032300.json similarity index 92% rename from objects/Custom_Model.032300.json rename to objects/ClueCounter.032300.json index 911a4667..506ba145 100644 --- a/objects/Custom_Model.032300.json +++ b/objects/ClueCounter.032300.json @@ -46,16 +46,16 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", - "Nickname": "", + "Nickname": "Clue Counter", "Snap": true, "Sticky": true, - "Tooltip": true, + "Tooltip": false, "Transform": { - "posX": -31.911, + "posX": -32.193, "posY": 1.52, - "posZ": 30.97, + "posZ": 30.977, "rotX": 0, - "rotY": 0, + "rotY": 10, "rotZ": 0, "scaleX": 0.33, "scaleY": 0.33, @@ -63,4 +63,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Custom_Model.1769ed.json b/objects/ClueCounter.1769ed.json similarity index 91% rename from objects/Custom_Model.1769ed.json rename to objects/ClueCounter.1769ed.json index 7b1fef5d..7f9d652d 100644 --- a/objects/Custom_Model.1769ed.json +++ b/objects/ClueCounter.1769ed.json @@ -46,16 +46,16 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", - "Nickname": "", + "Nickname": "Clue Counter", "Snap": true, "Sticky": true, - "Tooltip": true, + "Tooltip": false, "Transform": { - "posX": -59.449, + "posX": -59.426, "posY": 1.52, - "posZ": -22.628, + "posZ": -22.721, "rotX": 0, - "rotY": 270, + "rotY": 280, "rotZ": 0, "scaleX": 0.33, "scaleY": 0.33, @@ -63,4 +63,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Custom_Model.37be78.json b/objects/ClueCounter.37be78.json similarity index 91% rename from objects/Custom_Model.37be78.json rename to objects/ClueCounter.37be78.json index 21be4e19..a7c05ad3 100644 --- a/objects/Custom_Model.37be78.json +++ b/objects/ClueCounter.37be78.json @@ -46,16 +46,16 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", - "Nickname": "", + "Nickname": "Clue Counter", "Snap": true, "Sticky": true, - "Tooltip": true, + "Tooltip": false, "Transform": { - "posX": -18.983, + "posX": -18.87, "posY": 1.52, - "posZ": -31.01, + "posZ": -30.977, "rotX": 0, - "rotY": 180, + "rotY": 190, "rotZ": 0, "scaleX": 0.33, "scaleY": 0.33, @@ -63,4 +63,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Custom_Model.d86b7c.json b/objects/ClueCounter.d86b7c.json similarity index 92% rename from objects/Custom_Model.d86b7c.json rename to objects/ClueCounter.d86b7c.json index 833cc355..3a6858e3 100644 --- a/objects/Custom_Model.d86b7c.json +++ b/objects/ClueCounter.d86b7c.json @@ -46,16 +46,16 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", - "Nickname": "", + "Nickname": "Clue Counter", "Snap": true, "Sticky": true, - "Tooltip": true, + "Tooltip": false, "Transform": { - "posX": -59.499, + "posX": -59.426, "posY": 1.52, - "posZ": 9.561, + "posZ": 9.395, "rotX": 0, - "rotY": 270, + "rotY": 280, "rotZ": 0, "scaleX": 0.33, "scaleY": 0.33, @@ -63,4 +63,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/ClueCounterSwapper.d919d6.json b/objects/ClueCounterSwapper.d919d6.json deleted file mode 100644 index 72d1aa6e..00000000 --- a/objects/ClueCounterSwapper.d919d6.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 1, - "g": 0.99217, - "r": 1 - }, - "ContainedObjects_order": [ - "Clues.3f22e5", - "Clues.4111de", - "Clues.891403", - "Clues.db85d6" - ], - "ContainedObjects_path": "ClueCounterSwapper.d919d6", - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1179328606460871995/F2AFA106E788BB456C6F9134CE7A7B14D510F973/", - "MaterialIndex": 3, - "MeshURL": "http://pastebin.com/raw.php?i=uWAmuNZ2", - "NormalURL": "", - "TypeIndex": 6 - }, - "Description": "Counter mode courtesy of tadgh's clue counter mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2115363630", - "DragSelectable": true, - "GMNotes": "", - "GUID": "d919d6", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "require(\"util/ClueCounterSwapper\")", - "LuaScriptState_path": "ClueCounterSwapper.d919d6.luascriptstate", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Custom_Model_Bag", - "Nickname": "Clue Counter Swapper", - "Snap": true, - "Sticky": true, - "Tooltip": false, - "Transform": { - "posX": -50.9, - "posY": 1.51, - "posZ": 0, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.4, - "scaleY": 0.01, - "scaleZ": 0.4 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/ClueCounterSwapper.d919d6.luascriptstate b/objects/ClueCounterSwapper.d919d6.luascriptstate deleted file mode 100644 index 42c673a6..00000000 --- a/objects/ClueCounterSwapper.d919d6.luascriptstate +++ /dev/null @@ -1 +0,0 @@ -{"ml":{"3f22e5":{"lock":true,"pos":{"x":-59.50,"y":1.54,"z":9.56},"rot":{"x":0,"y":280,"z":0}},"4111de":{"lock":true,"pos":{"x":-59.45,"y":1.54,"z":-22.63},"rot":{"x":0,"y":280,"z":0}},"891403":{"lock":true,"pos":{"x":-31.91,"y":1.54,"z":30.97},"rot":{"x":0,"y":10,"z":0}},"db85d6":{"lock":true,"pos":{"x":-18.98,"y":1.54,"z":-31.01},"rot":{"x":0,"y":190,"z":0}}}} \ No newline at end of file diff --git a/objects/ClueCounterSwapper.d919d6/Clues.3f22e5.json b/objects/Clues.3f22e5.json similarity index 90% rename from objects/ClueCounterSwapper.d919d6/Clues.3f22e5.json rename to objects/Clues.3f22e5.json index 4c3eced1..b394e586 100644 --- a/objects/ClueCounterSwapper.d919d6/Clues.3f22e5.json +++ b/objects/Clues.3f22e5.json @@ -40,13 +40,16 @@ "Nickname": "Clues", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": false, "Transform": { - "posX": -59.318, - "posY": 1.64, - "posZ": -17.674, + "posX": -59.426, + "posY": 1.3, + "posZ": -22.721, "rotX": 0, - "rotY": 270, + "rotY": 280, "rotZ": 0, "scaleX": 0.26, "scaleY": 1, @@ -54,4 +57,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/ClueCounterSwapper.d919d6/Clues.4111de.json b/objects/Clues.4111de.json similarity index 90% rename from objects/ClueCounterSwapper.d919d6/Clues.4111de.json rename to objects/Clues.4111de.json index 4d272e1a..4b8bec86 100644 --- a/objects/ClueCounterSwapper.d919d6/Clues.4111de.json +++ b/objects/Clues.4111de.json @@ -40,13 +40,16 @@ "Nickname": "Clues", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": false, "Transform": { - "posX": -23.81, - "posY": 1.589, - "posZ": -30.927, + "posX": -18.87, + "posY": 1.3, + "posZ": -30.977, "rotX": 0, - "rotY": 180, + "rotY": 190, "rotZ": 0, "scaleX": 0.26, "scaleY": 1, @@ -54,4 +57,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/ClueCounterSwapper.d919d6/Clues.891403.json b/objects/Clues.891403.json similarity index 90% rename from objects/ClueCounterSwapper.d919d6/Clues.891403.json rename to objects/Clues.891403.json index 4d4b6157..01cecada 100644 --- a/objects/ClueCounterSwapper.d919d6/Clues.891403.json +++ b/objects/Clues.891403.json @@ -40,13 +40,16 @@ "Nickname": "Clues", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": false, "Transform": { - "posX": -31.911, - "posY": 1.564, - "posZ": 30.92, + "posX": -32.193, + "posY": 1.3, + "posZ": 30.977, "rotX": 0, - "rotY": 0, + "rotY": 10, "rotZ": 0, "scaleX": 0.26, "scaleY": 1, @@ -54,4 +57,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/ClueCounterSwapper.d919d6/Clues.db85d6.json b/objects/Clues.db85d6.json similarity index 90% rename from objects/ClueCounterSwapper.d919d6/Clues.db85d6.json rename to objects/Clues.db85d6.json index 12a35cd0..4ee7f3ae 100644 --- a/objects/ClueCounterSwapper.d919d6/Clues.db85d6.json +++ b/objects/Clues.db85d6.json @@ -40,13 +40,16 @@ "Nickname": "Clues", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": false, "Transform": { - "posX": -59.439, - "posY": 1.637, - "posZ": 9.472, + "posX": -59.426, + "posY": 1.3, + "posZ": 9.395, "rotX": 0, - "rotY": 270, + "rotY": 280, "rotZ": 0, "scaleX": 0.26, "scaleY": 1, @@ -54,4 +57,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/MasterClueCounter.4a3aa4.json b/objects/MasterClueCounter.4a3aa4.json index 6099abb3..8ece3ec1 100644 --- a/objects/MasterClueCounter.4a3aa4.json +++ b/objects/MasterClueCounter.4a3aa4.json @@ -34,7 +34,7 @@ "LayoutGroupSortIndex": 0, "Locked": true, "LuaScript": "require(\"core/MasterClueCounter\")", - "LuaScriptState": "", + "LuaScriptState": "false", "MeasureMovement": false, "Name": "Custom_Token", "Nickname": "Master Clue Counter\n", diff --git a/objects/Playermat1White.8b081b.ttslua b/objects/Playermat1White.8b081b.ttslua index 61f732a9..f134d968 100644 --- a/objects/Playermat1White.8b081b.ttslua +++ b/objects/Playermat1White.8b081b.ttslua @@ -12,5 +12,6 @@ TRASHCAN_GUID = "147e80" STAT_TRACKER_GUID = "e598c2" RESOURCE_COUNTER_GUID = "4406f0" CLUE_COUNTER_GUID = "d86b7c" +CLUE_CLICKER_GUID = "db85d6" require("playermat/Playmat") diff --git a/objects/Playermat2Orange.bd0ff4.ttslua b/objects/Playermat2Orange.bd0ff4.ttslua index 2c996e3a..ae82c4a5 100644 --- a/objects/Playermat2Orange.bd0ff4.ttslua +++ b/objects/Playermat2Orange.bd0ff4.ttslua @@ -12,5 +12,6 @@ TRASHCAN_GUID = "f7b6c8" STAT_TRACKER_GUID = "b4a5f7" RESOURCE_COUNTER_GUID = "816d84" CLUE_COUNTER_GUID = "1769ed" +CLUE_CLICKER_GUID = "3f22e5" require("playermat/Playmat") diff --git a/objects/Playermat3Green.383d8b.ttslua b/objects/Playermat3Green.383d8b.ttslua index 255daf1f..4d1e6bb5 100644 --- a/objects/Playermat3Green.383d8b.ttslua +++ b/objects/Playermat3Green.383d8b.ttslua @@ -12,5 +12,6 @@ TRASHCAN_GUID = "5f896a" STAT_TRACKER_GUID = "af7ed7" RESOURCE_COUNTER_GUID = "cd15ac" CLUE_COUNTER_GUID = "032300" +CLUE_CLICKER_GUID = "891403" require("playermat/Playmat") diff --git a/objects/Playermat4Red.0840d5.ttslua b/objects/Playermat4Red.0840d5.ttslua index a15ffc52..8e182e8b 100644 --- a/objects/Playermat4Red.0840d5.ttslua +++ b/objects/Playermat4Red.0840d5.ttslua @@ -12,5 +12,6 @@ TRASHCAN_GUID = "4b8594" STAT_TRACKER_GUID = "e74881" RESOURCE_COUNTER_GUID = "a4b60d" CLUE_COUNTER_GUID = "37be78" +CLUE_CLICKER_GUID = "4111de" require("playermat/Playmat") diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index a4c26687..b06ac9e5 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -632,6 +632,8 @@ function applyChange(id, state) printToAll("Clickable clue counters " .. (state and "en" or "dis") .."abled.", "White") PlayerMatAPI.clickableClues(state, "All") + -- update master clue counter + getObjectFromGUID("4a3aa4").setVar("clickableCounters", state) end end diff --git a/src/core/MasterClueCounter.ttslua b/src/core/MasterClueCounter.ttslua index ae88b0ee..c54ebc26 100644 --- a/src/core/MasterClueCounter.ttslua +++ b/src/core/MasterClueCounter.ttslua @@ -6,11 +6,27 @@ local clueCounterGUIDS = { "d86b7c" } -function onLoad() +local clueClickers = {} +local clueClickerGUIDS = { + "db85d6", + "3f22e5", + "891403", + "4111de" +} + +count = 0 +clickableCounters = false + +function onSave() return JSON.encode(clickableCounters) end + +function onLoad(savedData) + if savedData ~= nil then + clickableCounters = JSON.decode(savedData) + end self.createButton({ label = "0", click_function = "removeAllPlayerClues", - tooltip = "Click here to remove all Clues from playermats", + tooltip = "Click here to remove all collected clues", function_owner = self, position = { 0, 0.06, 0 }, height = 900, @@ -21,26 +37,41 @@ function onLoad() color = { 0, 0, 0, 0 } }) - -- loading object references to the counting bowls via GUID + -- loading object references to the clue counters / clickers via GUID for i = 1, 4 do clueCounters[i] = getObjectFromGUID(clueCounterGUIDS[i]) + clueClickers[i] = getObjectFromGUID(clueClickerGUIDS[i]) end loopID = Wait.time(sumClues, 2, -1) end --- removes all player clues by calling the respective function from the counting bowls +-- removes all player clues by calling the respective function from the counting bowls / clickers function removeAllPlayerClues() - for i = 1, 4 do - clueCounters[i].call("removeAllClues") + printToAll(count .. " clue(s) from playermats removed.", "White") + if not clickableCounters then + for i = 1, 4 do + clueCounters[i].call("removeAllClues") + end + else + for i = 1, 4 do + clueClickers[i].call("updateVal", 0) + end end + self.editButton({ index = 0, label = "0" }) end --- gets the counted values from the counting bowls and sums them up +-- gets the counted values from the counting bowls / clickers and sums them up function sumClues() - local count = 0 - for i = 1, 4 do - count = count + tonumber(clueCounters[i].getVar("exposedValue")) + count = 0 + if not clickableCounters then + for i = 1, 4 do + count = count + tonumber(clueCounters[i].getVar("exposedValue")) + end + else + for i = 1, 4 do + count = count + tonumber(clueClickers[i].getVar("val")) + end end self.editButton({ index = 0, label = tostring(count) }) end diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index f6e617ab..00bd2222 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -679,7 +679,8 @@ end ---@param clickableCounter Boolean. Whether the clickable clue counter should be present function clickableClues(clickableCounter) local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID) - local pos = self.positionToWorld({x = -1.03, y = 0.05, z = 0.69}) + local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID) + local clickerPos = CLUE_CLICKER.getPosition() local clueCount = 0 if clickableCounter then @@ -689,26 +690,26 @@ function clickableClues(clickableCounter) -- remove clues CLUE_COUNTER.call("removeAllClues") - -- spawn clue counter - - -- update master clue counter + -- set value for clue clickers + CLUE_CLICKER.call("updateVal", clueCount) + -- move clue counters up + clickerPos.y = 1.52 + CLUE_CLICKER.setPosition(clickerPos) else -- current clue count + clueCount = CLUE_CLICKER.getVar("val") - -- remove clue counter + -- move clue counters down + clickerPos.y = 1.3 + CLUE_CLICKER.setPosition(clickerPos) -- spawn clues + local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7}) for i = 1, clueCount do - pos.y = pos.y + 0.1 * i + pos.y = pos.y + 0.045 * i spawnToken(pos, "clue") end - - -- rotation = {x= 0, y= PLAY_ZONE_ROTATION.y + 15, z =0 } - - -- update master clue counter - - end end