Merge pull request #902 from argonui/victory-display

Victory Display: Added button to spawn additional VP card
This commit is contained in:
Chr1Z 2024-10-07 00:13:45 +02:00 committed by GitHub
commit b63557a3bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 35 additions and 17 deletions

View File

@ -177,7 +177,7 @@
"Decoration-Ammo.d35ee9",
"VictoryDisplay.6ccd6d",
"BuyersGuide.b5ecc1",
"OptionPanelSource.830bd0",
"ObjectSourceBag.830bd0",
"SoundCube.3c988f",
"TokenSpawningReference.f8b3a7",
"3DText.d628cc",

View File

@ -20,8 +20,7 @@
"SecretObjectivesUltimatums.b2077d",
"UnderworldMarketHelper.3650ea",
"Auto-failCounter.a9a321",
"ElderSignCounter.e62cb5",
"AdditionalVictoryPoints.958bc0"
"ElderSignCounter.e62cb5"
],
"ContainedObjects_path": "Fan-MadeAccessories.aa8b38",
"CustomMesh": {

View File

@ -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,

View File

@ -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,

View File

@ -1,4 +1,3 @@
-- Additional Victory Point Card
local victoryDisplayApi = require("core/VictoryDisplayApi")
local MIN_VALUE = -10

View File

@ -75,7 +75,7 @@ local GuidReferences = {
MasterClueCounter = "4a3aa4",
MythosArea = "9f334f",
NavigationOverlayHandler = "797ede",
OptionPanelSource = "830bd0",
ObjectSourceBag = "830bd0",
PlaceholderBoxDummy = "a93466",
PlayArea = "721ba2",
PlayAreaImageSelector = "b7b45b",

View File

@ -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

View File

@ -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,8 @@ 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
if highlightMissing then
@ -233,6 +242,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"

View File

@ -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 })

View File

@ -353,12 +353,12 @@
</Cell>
</Row>
<!-- Group: fan-made accessories -->
<!-- Group: accessories -->
<Row class="group-header">
<Cell class="group-header">
<Panel class="group-header"
image="header_olive">
<Text class="group-header">FAN-MADE ACCESSORIES</Text>
<Text class="group-header">ACCESSORIES</Text>
</Panel>
</Cell>
</Row>