PR Comments Addressed

This commit is contained in:
Entrox-Licher 2024-01-15 16:43:33 -05:00
parent 2c0f7612b2
commit e285f8e151
3 changed files with 17 additions and 24 deletions

View File

@ -59,7 +59,7 @@
"Position": { "Position": {
"x": -0.95, "x": -0.95,
"y": 0.2, "y": 0.2,
"z": 0.01 "z": 0
} }
} }
] ]

View File

@ -6,8 +6,6 @@ local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playmatApi = require("playermat/PlaymatApi")
local additionalIndex
local campaignLog
local checkWarning = true local checkWarning = true
local campaignTokenData = { local campaignTokenData = {
@ -87,7 +85,6 @@ end
--------------------------------------------------------- ---------------------------------------------------------
function onCollisionEnter(info) function onCollisionEnter(info)
local objectData = info.collision_object.getData()
if info.collision_object.hasTag("ImporterToken") then if info.collision_object.hasTag("ImporterToken") then
importFromToken(info.collision_object) importFromToken(info.collision_object)
end end
@ -112,7 +109,7 @@ function importFromToken(coin)
if #campaignBox.getObjects() > 0 then if #campaignBox.getObjects() > 0 then
placeCampaignFromToken(importData, coin) placeCampaignFromToken(importData, coin)
else else
createCampaignFromToken(importData, coin) restoreCampaignData(importData, coin)
end end
end, end,
function() function()
@ -132,7 +129,7 @@ end
function placeCampaignFromToken(importData, coin) function placeCampaignFromToken(importData, coin)
getObjectFromGUID(importData["box"]).call("buttonClick_place") getObjectFromGUID(importData["box"]).call("buttonClick_place")
Wait.condition( Wait.condition(
function() createCampaignFromToken(importData, coin) end, function() restoreCampaignData(importData, coin) end,
function() return findUniqueObjectWithTag("CampaignLog") ~= nil end, function() return findUniqueObjectWithTag("CampaignLog") ~= nil end,
2, 2,
function() broadcastToAll("Error placing campaign box") end function() broadcastToAll("Error placing campaign box") end
@ -140,14 +137,13 @@ function placeCampaignFromToken(importData, coin)
end end
-- After content is placed on table, conducts all the other import operations -- After content is placed on table, conducts all the other import operations
function createCampaignFromToken(importData, coin) function restoreCampaignData(importData, coin)
checkWarning = false checkWarning = false
if importData["additionalIndex"] then if importData["additionalIndex"] then
findUniqueObjectWithTag("AllCardsHotfix").destruct() guidReferenceApi.getObjectByOwnerAndType("Mythos", "AdditionalPlayerCardsBag").destruct()
if coin.type == "Bag" then if coin.type == "Bag" then
local newBag = coin.takeObject({index = 0, position = importData["additionalIndex"]}) coin.takeObject({index = 0, position = importData["additionalIndex"], callback_function = function(obj) obj.setLock(true) end})
Wait.time(function() newBag.setLock(true) end, 1)
else else
spawnObjectJSON({json = importData["additionalIndex"]}) spawnObjectJSON({json = importData["additionalIndex"]})
end end
@ -156,8 +152,7 @@ function createCampaignFromToken(importData, coin)
-- destroy existing campaign log and load saved campaign log -- destroy existing campaign log and load saved campaign log
findUniqueObjectWithTag("CampaignLog").destruct() findUniqueObjectWithTag("CampaignLog").destruct()
if coin.type == "Bag" then if coin.type == "Bag" then
local newLog = coin.takeObject({index = 0, position = importData["log"]}) local newLog = coin.takeObject({index = 0, position = importData["log"], callback_function = function(obj) obj.setLock(true) end})
Wait.time(function() newLog.setLock(true) end, 1)
else else
spawnObjectData({ data = importData["log"] }) spawnObjectData({ data = importData["log"] })
end end
@ -228,13 +223,13 @@ function createCampaignToken(_, playerColor, _)
return return
end end
campaignLog = findUniqueObjectWithTag("CampaignLog") local campaignLog = findUniqueObjectWithTag("CampaignLog")
if campaignLog == nil then if campaignLog == nil then
broadcastToAll("Campaign log not found!", Color.Red) broadcastToAll("Campaign log not found!", Color.Red)
return return
end end
additionalIndex = findUniqueObjectWithTag("AllCardsHotfix") local additionalIndex = guidReferenceApi.getObjectByOwnerAndType("Mythos", "AdditionalPlayerCardsBag")
local traumaValues = { } local traumaValues = { }
local trauma = campaignLog.getVar("returnTrauma") local trauma = campaignLog.getVar("returnTrauma")
@ -273,20 +268,17 @@ function createCampaignToken(_, playerColor, _)
} }
campaignTokenData.GMNotes = JSON.encode(campaignData) campaignTokenData.GMNotes = JSON.encode(campaignData)
campaignTokenData.Nickname = campaignBox.getName() .. os.date(" %b %d") .. " Save" campaignTokenData.Nickname = campaignBox.getName() .. os.date(" %b %d") .. " Save"
campaignTokenData.ContainedObjects = { }
local indexData = additionalIndex.getData()
indexData.Locked = false
table.insert(campaignTokenData.ContainedObjects, indexData)
local logData = campaignLog.getData()
logData.Locked = false
table.insert(campaignTokenData.ContainedObjects, logData)
spawnObjectData({ data = campaignTokenData, callback_function = finishTokenSpawning }) spawnObjectData({ data = campaignTokenData, callback_function = finishTokenSpawning })
end end
function finishTokenSpawning(obj) function finishTokenSpawning(obj)
local logData = campaignLog.getData()
local indexData = additionalIndex.getData()
campaignLog.setLock(false)
additionalIndex.setLock(false)
checkWarning = false
obj.putObject(additionalIndex)
obj.putObject(campaignLog)
checkWarning = true
spawnObjectData({data = indexData})
spawnObjectData({data = logData})
broadcastToAll("Campaign successfully exported! Save coin object to import on a fresh save", Color.Green) broadcastToAll("Campaign successfully exported! Save coin object to import on a fresh save", Color.Green)
end end

View File

@ -60,6 +60,7 @@ local GuidReferences = {
Trash = "4b8594" Trash = "4b8594"
}, },
Mythos = { Mythos = {
AdditionalPlayerCardsBag = "2cba6b",
AllCardsBag = "15bb07", AllCardsBag = "15bb07",
BlessCurseManager = "5933fb", BlessCurseManager = "5933fb",
CampaignThePathToCarcosa = "aca04c", CampaignThePathToCarcosa = "aca04c",