From 14b4496172fe0f2efba87182ed9e5ba030d118e9 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Wed, 2 Oct 2024 19:17:02 +0200 Subject: [PATCH 1/2] added 2nd zone for token bags --- src/playermat/Playermat.ttslua | 42 ++++++++++++++++------------------ src/playermat/Zones.ttslua | 9 +++++--- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/playermat/Playermat.ttslua b/src/playermat/Playermat.ttslua index 88be296b..a955e187 100644 --- a/src/playermat/Playermat.ttslua +++ b/src/playermat/Playermat.ttslua @@ -1353,10 +1353,6 @@ end function newInvestigatorCallback(newId) updateMessageColor() - -- get position/rotation for maybe spawned object - local pos = zones.getZonePosition(playerColor, "SetAside7") - local rot = self.getRotation() - -- remove existing object that was placed for a specific investigator local obj = guidReferenceApi.getObjectByOwnerAndType(playerColor, "InvestigatorSpecifics") if obj ~= nil then @@ -1364,30 +1360,24 @@ function newInvestigatorCallback(newId) guidReferenceApi.editIndex(playerColor, "InvestigatorSpecifics") end - if newId == "01005-p" or newId == "01005-pf" then - -- parallel Wendy Adams + if newId == "01005-p" or newId == "01005-pf" then -- parallel Wendy Adams printToColor("Wendy Adams: There's a Game Key to add sealing options to any card:" .. " Top menu bar > Options > Game Keys", messageColor) - elseif newId == "06003" then - -- Tony Morgan - local spawnedObj = spawnObjectData({ data = tokenManagerApi.getDataForInfiniteBag("bounty", pos, rot) }) - guidReferenceApi.editIndex(playerColor, "InvestigatorSpecifics", spawnedObj.getGUID()) - printToColor("Tony Morgan: Spawned an infinite bag of bounty tokens near your playermat.", messageColor) - elseif newId == "08004" then - -- Norman Withers - printToColor("At the start of the game flip the top card of your deck manually " .. + elseif newId == "06003" then -- Tony Morgan + spawnInfiniteTokenBag("bounty") + printToColor("Tony Morgan: Spawned bounty tokens near your playermat.", messageColor) + elseif newId == "08004" then -- Norman Withers + printToColor("Norman Withers: At the start of the game flip the top card of your deck manually " .. "and then the mod should keep it flipped throughout the game.", messageColor) - elseif newId == "09015" then - -- Darrell Simmons - local spawnedObj = spawnObjectData({ data = tokenManagerApi.getDataForInfiniteBag("evidence", pos, rot) }) - guidReferenceApi.editIndex(playerColor, "InvestigatorSpecifics", spawnedObj.getGUID()) - printToColor("Darrell Simons: Spawned an infinite bag of evidence tokens near your playermat.", messageColor) - elseif newId == "89001" then - -- Subject 5U-21 + elseif newId == "09015" then -- Darrell Simmons + spawnInfiniteTokenBag("evidence") + printToColor("Darrell Simmons: Spawned evidence tokens near your playermat.", messageColor) + elseif newId == "89001" then -- Subject 5U-21 + local pos = zones.getZonePosition(playerColor, "BelowSetAside") + local rot = self.getRotation() local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "OptionPanelSource") for _, objData in ipairs(sourceBag.getData().ContainedObjects) do if objData["Nickname"] == "Subject 5U-21 Helper" then - objData["Locked"] = true local spawnedObj = spawnObjectData({ data = objData, position = pos, rotation = rot }) guidReferenceApi.editIndex(playerColor, "InvestigatorSpecifics", spawnedObj.getGUID()) break @@ -1398,6 +1388,14 @@ function newInvestigatorCallback(newId) end end +-- spawns an infinite token bag of the specified type near the set aside area +function spawnInfiniteTokenBag(tokenType) + local pos = zones.getZonePosition(playerColor, "AboveSetAside") + local rot = self.getRotation() + local spawnedObj = spawnObjectData({ data = tokenManagerApi.getDataForInfiniteBag(tokenType, pos, rot) }) + guidReferenceApi.editIndex(playerColor, "InvestigatorSpecifics", spawnedObj.getGUID()) +end + -- returns the mini ID for the currently placed investigator function getMiniId(baseId) if #baseId < 16 then diff --git a/src/playermat/Zones.ttslua b/src/playermat/Zones.ttslua index f9d4dc30..279edb0e 100644 --- a/src/playermat/Zones.ttslua +++ b/src/playermat/Zones.ttslua @@ -19,7 +19,8 @@ -- SetAside4: Upgrade sheets for customizable cards -- SetAside5: Hunch Deck for Joe Diamond -- SetAside6: currently unused --- SetAside7: Investigator specific object +-- AboveSetAside: Investigator specific object +-- BelowSetAside: Investigator specific object do local playermatApi = require("playermat/PlayermatApi") @@ -80,7 +81,8 @@ do zoneData["White"]["SetAside5"] = { 2.78, 0, 0.042 } zoneData["White"]["SetAside6"] = { 2.78, 0, 0.605 } zoneData["White"]["UnderSetAside6"] = { 2.93, 0, 0.805 } - zoneData["White"]["SetAside7"] = { 2.85, 0, 1.650 } + zoneData["White"]["AboveSetAside"] = { 2.35, 0, -1.132 } + zoneData["White"]["BelowSetAside"] = { 2.85, 0, 1.650 } zoneData["Orange"] = {} zoneData["Orange"]["Investigator"] = commonZones["Investigator"] @@ -113,7 +115,8 @@ do zoneData["Orange"]["SetAside5"] = { -2.78, 0, 0.042 } zoneData["Orange"]["SetAside6"] = { -2.78, 0, 0.605 } zoneData["Orange"]["UnderSetAside6"] = { -2.93, 0, 0.805 } - zoneData["Orange"]["SetAside7"] = { -2.85, 0, 1.650 } + zoneData["Orange"]["AboveSetAside"] = { -2.35, 0, -1.132 } + zoneData["Orange"]["BelowSetAside"] = { -2.85, 0, 1.650 } -- Green positions are the same as White and Red the same as Orange zoneData["Red"] = zoneData["Orange"] From 0356e2c8ce61790e42ab3cb7baa66ffab650214c Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 5 Oct 2024 10:33:12 +0200 Subject: [PATCH 2/2] updated position --- src/playermat/Zones.ttslua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playermat/Zones.ttslua b/src/playermat/Zones.ttslua index 279edb0e..27d5aac6 100644 --- a/src/playermat/Zones.ttslua +++ b/src/playermat/Zones.ttslua @@ -81,7 +81,7 @@ do zoneData["White"]["SetAside5"] = { 2.78, 0, 0.042 } zoneData["White"]["SetAside6"] = { 2.78, 0, 0.605 } zoneData["White"]["UnderSetAside6"] = { 2.93, 0, 0.805 } - zoneData["White"]["AboveSetAside"] = { 2.35, 0, -1.132 } + zoneData["White"]["AboveSetAside"] = { 2.35, 0, -1.069 } zoneData["White"]["BelowSetAside"] = { 2.85, 0, 1.650 } zoneData["Orange"] = {} @@ -115,7 +115,7 @@ do zoneData["Orange"]["SetAside5"] = { -2.78, 0, 0.042 } zoneData["Orange"]["SetAside6"] = { -2.78, 0, 0.605 } zoneData["Orange"]["UnderSetAside6"] = { -2.93, 0, 0.805 } - zoneData["Orange"]["AboveSetAside"] = { -2.35, 0, -1.132 } + zoneData["Orange"]["AboveSetAside"] = { -2.35, 0, -1.069 } zoneData["Orange"]["BelowSetAside"] = { -2.85, 0, 1.650 } -- Green positions are the same as White and Red the same as Orange