From b43fb142c73481d5a931f1094512d0446419fd24 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 5 Oct 2024 23:00:22 +0200 Subject: [PATCH 1/3] Added button to spawn additional VP card --- config.json | 2 +- objects/Fan-MadeAccessories.aa8b38.json | 3 +-- ...30bd0.json => ObjectSourceBag.830bd0.json} | 9 ++++---- .../AdditionalVictoryPoints.958bc0.json | 10 ++++----- .../AttachmentHelper.7f4976.json | 0 .../AttachmentHelper.d45664.json | 0 .../CYOACampaignGuides.e87ea2.json | 0 .../CleanUpHelper.26cf4b.json | 0 .../DisplacementTool.0f1374.json | 0 .../HandHelper.450688.json | 0 .../SearchAssistant.17aed0.json | 0 .../Subject5U-21Helper.1335e8.json | 0 .../AdditionalVictoryPointsCard.ttslua | 1 - src/core/GUIDReferenceHandler.ttslua | 2 +- src/core/Global.ttslua | 2 +- src/core/VictoryDisplay.ttslua | 22 ++++++++++++++++++- src/playermat/Playermat.ttslua | 2 +- xml/Global/OptionPanel.xml | 4 ++-- 18 files changed, 38 insertions(+), 19 deletions(-) rename objects/{OptionPanelSource.830bd0.json => ObjectSourceBag.830bd0.json} (82%) rename objects/{Fan-MadeAccessories.aa8b38 => ObjectSourceBag.830bd0}/AdditionalVictoryPoints.958bc0.json (89%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/AttachmentHelper.7f4976.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/AttachmentHelper.7f4976/AttachmentHelper.d45664.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/CYOACampaignGuides.e87ea2.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/CleanUpHelper.26cf4b.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/DisplacementTool.0f1374.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/HandHelper.450688.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/SearchAssistant.17aed0.json (100%) rename objects/{OptionPanelSource.830bd0 => ObjectSourceBag.830bd0}/Subject5U-21Helper.1335e8.json (100%) rename objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua => src/accessories/AdditionalVictoryPointsCard.ttslua (98%) diff --git a/config.json b/config.json index a8a5ceb8..756b3ec1 100644 --- a/config.json +++ b/config.json @@ -177,7 +177,7 @@ "Decoration-Ammo.d35ee9", "VictoryDisplay.6ccd6d", "BuyersGuide.b5ecc1", - "OptionPanelSource.830bd0", + "ObjectSourceBag.830bd0", "SoundCube.3c988f", "TokenSpawningReference.f8b3a7", "3DText.d628cc", diff --git a/objects/Fan-MadeAccessories.aa8b38.json b/objects/Fan-MadeAccessories.aa8b38.json index 042ee175..681a130d 100644 --- a/objects/Fan-MadeAccessories.aa8b38.json +++ b/objects/Fan-MadeAccessories.aa8b38.json @@ -20,8 +20,7 @@ "SecretObjectivesUltimatums.b2077d", "UnderworldMarketHelper.3650ea", "Auto-failCounter.a9a321", - "ElderSignCounter.e62cb5", - "AdditionalVictoryPoints.958bc0" + "ElderSignCounter.e62cb5" ], "ContainedObjects_path": "Fan-MadeAccessories.aa8b38", "CustomMesh": { diff --git a/objects/OptionPanelSource.830bd0.json b/objects/ObjectSourceBag.830bd0.json similarity index 82% rename from objects/OptionPanelSource.830bd0.json rename to objects/ObjectSourceBag.830bd0.json index 743e1af4..8d56fbf7 100644 --- a/objects/OptionPanelSource.830bd0.json +++ b/objects/ObjectSourceBag.830bd0.json @@ -14,6 +14,7 @@ "r": 0.70588 }, "ContainedObjects_order": [ + "AdditionalVictoryPoints.958bc0", "CYOACampaignGuides.e87ea2", "AttachmentHelper.7f4976", "SearchAssistant.17aed0", @@ -22,8 +23,8 @@ "DisplacementTool.0f1374", "CleanUpHelper.26cf4b" ], - "ContainedObjects_path": "OptionPanelSource.830bd0", - "Description": "Contains the objects that are spawnable via option panel", + "ContainedObjects_path": "ObjectSourceBag.830bd0", + "Description": "Contains objects that are spawnable via scripting like the option panel", "DragSelectable": true, "GMNotes": "", "GUID": "830bd0", @@ -40,7 +41,7 @@ "MeasureMovement": false, "MeshIndex": -1, "Name": "Bag", - "Nickname": "OptionPanel Source", + "Nickname": "Object Source Bag", "Snap": true, "Sticky": true, "Tooltip": true, @@ -57,4 +58,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.json b/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json similarity index 89% rename from objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.json rename to objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json index ade1c77f..957c3e76 100644 --- a/objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.json +++ b/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json @@ -33,8 +33,8 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, + "LuaScript": "require(\"accessories/AdditionalVictoryPointsCard\")", "LuaScriptState": "{\"notes\":\"Click to type\",\"vp\":1}", - "LuaScript_path": "Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua", "MeasureMovement": false, "Name": "CardCustom", "Nickname": "Additional Victory Points", @@ -46,9 +46,9 @@ ], "Tooltip": true, "Transform": { - "posX": -61.591, - "posY": 4.834, - "posZ": -74.678, + "posX": -4, + "posY": 2.5, + "posZ": 41, "rotX": 0, "rotY": 270, "rotZ": 0, @@ -58,4 +58,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/OptionPanelSource.830bd0/AttachmentHelper.7f4976.json b/objects/ObjectSourceBag.830bd0/AttachmentHelper.7f4976.json similarity index 100% rename from objects/OptionPanelSource.830bd0/AttachmentHelper.7f4976.json rename to objects/ObjectSourceBag.830bd0/AttachmentHelper.7f4976.json diff --git a/objects/OptionPanelSource.830bd0/AttachmentHelper.7f4976/AttachmentHelper.d45664.json b/objects/ObjectSourceBag.830bd0/AttachmentHelper.7f4976/AttachmentHelper.d45664.json similarity index 100% rename from objects/OptionPanelSource.830bd0/AttachmentHelper.7f4976/AttachmentHelper.d45664.json rename to objects/ObjectSourceBag.830bd0/AttachmentHelper.7f4976/AttachmentHelper.d45664.json diff --git a/objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.json b/objects/ObjectSourceBag.830bd0/CYOACampaignGuides.e87ea2.json similarity index 100% rename from objects/OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.json rename to objects/ObjectSourceBag.830bd0/CYOACampaignGuides.e87ea2.json diff --git a/objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json b/objects/ObjectSourceBag.830bd0/CleanUpHelper.26cf4b.json similarity index 100% rename from objects/OptionPanelSource.830bd0/CleanUpHelper.26cf4b.json rename to objects/ObjectSourceBag.830bd0/CleanUpHelper.26cf4b.json diff --git a/objects/OptionPanelSource.830bd0/DisplacementTool.0f1374.json b/objects/ObjectSourceBag.830bd0/DisplacementTool.0f1374.json similarity index 100% rename from objects/OptionPanelSource.830bd0/DisplacementTool.0f1374.json rename to objects/ObjectSourceBag.830bd0/DisplacementTool.0f1374.json diff --git a/objects/OptionPanelSource.830bd0/HandHelper.450688.json b/objects/ObjectSourceBag.830bd0/HandHelper.450688.json similarity index 100% rename from objects/OptionPanelSource.830bd0/HandHelper.450688.json rename to objects/ObjectSourceBag.830bd0/HandHelper.450688.json diff --git a/objects/OptionPanelSource.830bd0/SearchAssistant.17aed0.json b/objects/ObjectSourceBag.830bd0/SearchAssistant.17aed0.json similarity index 100% rename from objects/OptionPanelSource.830bd0/SearchAssistant.17aed0.json rename to objects/ObjectSourceBag.830bd0/SearchAssistant.17aed0.json diff --git a/objects/OptionPanelSource.830bd0/Subject5U-21Helper.1335e8.json b/objects/ObjectSourceBag.830bd0/Subject5U-21Helper.1335e8.json similarity index 100% rename from objects/OptionPanelSource.830bd0/Subject5U-21Helper.1335e8.json rename to objects/ObjectSourceBag.830bd0/Subject5U-21Helper.1335e8.json diff --git a/objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua b/src/accessories/AdditionalVictoryPointsCard.ttslua similarity index 98% rename from objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua rename to src/accessories/AdditionalVictoryPointsCard.ttslua index 264bbdc3..dfe99353 100644 --- a/objects/Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua +++ b/src/accessories/AdditionalVictoryPointsCard.ttslua @@ -1,4 +1,3 @@ --- Additional Victory Point Card local victoryDisplayApi = require("core/VictoryDisplayApi") local MIN_VALUE = -10 diff --git a/src/core/GUIDReferenceHandler.ttslua b/src/core/GUIDReferenceHandler.ttslua index 92359c2a..151ca07c 100644 --- a/src/core/GUIDReferenceHandler.ttslua +++ b/src/core/GUIDReferenceHandler.ttslua @@ -75,7 +75,7 @@ local GuidReferences = { MasterClueCounter = "4a3aa4", MythosArea = "9f334f", NavigationOverlayHandler = "797ede", - OptionPanelSource = "830bd0", + ObjectSourceBag = "830bd0", PlaceholderBoxDummy = "a93466", PlayArea = "721ba2", PlayAreaImageSelector = "b7b45b", diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 316a2220..e184d82b 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -1722,7 +1722,7 @@ end ---@param position tts__Vector Desired position of the object ---@param rotation? tts__Vector Desired rotation of the object (defaults to object's rotation) function spawnHelperObject(name, position, rotation) - local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "OptionPanelSource") + local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "ObjectSourceBag") -- error handling for missing sourceBag if not sourceBag then diff --git a/src/core/VictoryDisplay.ttslua b/src/core/VictoryDisplay.ttslua index 4057fca6..e85a4c48 100644 --- a/src/core/VictoryDisplay.ttslua +++ b/src/core/VictoryDisplay.ttslua @@ -54,6 +54,14 @@ function onLoad() buttonParameters.position.x = 1.5 self.createButton(buttonParameters) + -- index 5: spawn additional VP card button + buttonParameters.label = "+" + buttonParameters.click_function = "spawnAdditionalVP" + buttonParameters.tooltip = "Spawn a card to track additional earned VP" + buttonParameters.color = { 86 / 255, 90 / 255, 233 / 255 } + buttonParameters.position.x = -1.82 + self.createButton(buttonParameters) + -- update the display label once Wait.time(updateCount, 1) end @@ -200,7 +208,9 @@ 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 if highlightMissing then @@ -233,6 +243,16 @@ function highlightCountedVP() highlightCounted = not highlightCounted end +function spawnAdditionalVP() + local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "ObjectSourceBag") + for _, objData in ipairs(sourceBag.getData().ContainedObjects) do + if objData["Nickname"] == "Additional Victory Points" then + placeCard(spawnObjectData({ data = objData })) + return + end + end +end + -- places the provided card in the first empty spot function placeCard(card) local name = card.getName() or "Unnamed card" diff --git a/src/playermat/Playermat.ttslua b/src/playermat/Playermat.ttslua index a955e187..f12e791f 100644 --- a/src/playermat/Playermat.ttslua +++ b/src/playermat/Playermat.ttslua @@ -1375,7 +1375,7 @@ function newInvestigatorCallback(newId) elseif newId == "89001" then -- Subject 5U-21 local pos = zones.getZonePosition(playerColor, "BelowSetAside") local rot = self.getRotation() - local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "OptionPanelSource") + local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "ObjectSourceBag") for _, objData in ipairs(sourceBag.getData().ContainedObjects) do if objData["Nickname"] == "Subject 5U-21 Helper" then local spawnedObj = spawnObjectData({ data = objData, position = pos, rotation = rot }) diff --git a/xml/Global/OptionPanel.xml b/xml/Global/OptionPanel.xml index 48960103..a68f5d49 100644 --- a/xml/Global/OptionPanel.xml +++ b/xml/Global/OptionPanel.xml @@ -353,12 +353,12 @@ - + - FAN-MADE ACCESSORIES + ACCESSORIES From 0b173ecf2d702dde4393057cc492af9da542454f Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 5 Oct 2024 23:02:42 +0200 Subject: [PATCH 2/3] fixed EOF newlines --- objects/ObjectSourceBag.830bd0.json | 2 +- .../ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/ObjectSourceBag.830bd0.json b/objects/ObjectSourceBag.830bd0.json index 8d56fbf7..397d8dc8 100644 --- a/objects/ObjectSourceBag.830bd0.json +++ b/objects/ObjectSourceBag.830bd0.json @@ -58,4 +58,4 @@ }, "Value": 0, "XmlUI": "" -} \ No newline at end of file +} diff --git a/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json b/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json index 957c3e76..bfe037d1 100644 --- a/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json +++ b/objects/ObjectSourceBag.830bd0/AdditionalVictoryPoints.958bc0.json @@ -58,4 +58,4 @@ }, "Value": 0, "XmlUI": "" -} \ No newline at end of file +} From 85627465f20637e2edc2fc3d5d66b115e33a141b Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 5 Oct 2024 23:05:36 +0200 Subject: [PATCH 3/3] reformatted tooltip --- src/core/VictoryDisplay.ttslua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/VictoryDisplay.ttslua b/src/core/VictoryDisplay.ttslua index e85a4c48..49688c8c 100644 --- a/src/core/VictoryDisplay.ttslua +++ b/src/core/VictoryDisplay.ttslua @@ -208,8 +208,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 "En" or "Dis") .. "able highlighting of cards without metadata (VP on these is not counted)." }) for _, obj in pairs(missingData) do if obj ~= nil then