Addressing PR fixes

This commit is contained in:
Entrox-Licher 2024-01-09 13:42:00 -05:00
parent 1bc78bd2a1
commit 01a292f10a

View File

@ -52,7 +52,7 @@ function onLoad()
function_owner = self, function_owner = self,
label = "Export", label = "Export",
tooltip = "Create a campaign save token!", tooltip = "Create a campaign save token!",
position = { x = -1, y = 0.2, z = 0 }, position = { x = -1, y = 0.21, z = 0 },
font_size = 400, font_size = 400,
width = 1400, width = 1400,
height = 600, height = 600,
@ -67,17 +67,17 @@ end
function onCollisionEnter(info) function onCollisionEnter(info)
local objectData = info.collision_object.getData() local objectData = info.collision_object.getData()
if info.collision_object.hasTag("ImporterToken") then if info.collision_object.hasTag("ImporterToken") then
findCampaignFromToken(info.collision_object) importFromToken(info.collision_object)
end end
end end
-- Identifies import token, determines campaign box and downloads it (if needed) -- Identifies import token, determines campaign box and downloads it (if needed)
function findCampaignFromToken(coin) function importFromToken(coin)
broadcastToAll("Campaign Import Initiated") broadcastToAll("Campaign Import Initiated")
local importData = JSON.decode(coin.getGMNotes()) local importData = JSON.decode(coin.getGMNotes())
coin.destruct() coin.destruct()
campaignBoxGUID = importData["box"] local campaignBoxGUID = importData["box"]
local campaignBox = getObjectFromGUID(campaignBoxGUID) local campaignBox = getObjectFromGUID(campaignBoxGUID)
if campaignBox.type == "Generic" then if campaignBox.type == "Generic" then
campaignBox.call("buttonClick_download") campaignBox.call("buttonClick_download")
@ -163,7 +163,7 @@ function createCampaignFromToken(importData)
end end
-- restore PlayArea image -- restore PlayArea image
playAreaApi.updateSurface(importData["playmat"]) playAreaApi.updateSurface(importData["playarea"])
broadcastToAll("Campaign successfully imported!", Color.Green) broadcastToAll("Campaign successfully imported!", Color.Green)
end end
@ -207,7 +207,6 @@ function createCampaignToken(_, playerColor, _)
end end
else else
printToAll("Trauma values could not be found in campaign log!", "Yellow") printToAll("Trauma values could not be found in campaign log!", "Yellow")
return
end end
local campaignGuide = findUniqueObjectWithTag("CampaignGuide") local campaignGuide = findUniqueObjectWithTag("CampaignGuide")
@ -227,7 +226,7 @@ function createCampaignToken(_, playerColor, _)
trauma = traumaValues, trauma = traumaValues,
decks = deckImporterApi.getUiState(), decks = deckImporterApi.getUiState(),
clueCount = playAreaApi.getInvestigatorCount(), clueCount = playAreaApi.getInvestigatorCount(),
playmat = playAreaApi.getSurface(), playarea = playAreaApi.getSurface(),
options = optionPanelApi.getOptions(), options = optionPanelApi.getOptions(),
guide = campaignGuide.Book.getPage(), guide = campaignGuide.Book.getPage(),
additionalIndex = additionalIndex.getJSON() additionalIndex = additionalIndex.getJSON()