Minor improvements with token generation and identification

This commit is contained in:
Jorge Parra 2023-03-19 14:49:10 -04:00
parent ab42241199
commit 200b85829e

View File

@ -25,6 +25,9 @@ local campaignTokenData = {
g = 1.0,
b = 1.0
},
Tags = {
"ImporterToken"
},
LayoutGroupSortIndex = 0,
Value = 0,
Locked = false,
@ -106,7 +109,7 @@ end
function findCampaignFromToken(_, _, _)
local coin = nil
for _, obj in ipairs(tokenZone.getObjects()) do
if obj.getDescription() == "SCED Importer Token" then
if obj.hasTag("ImporterToken") then
coin = obj
end
end
@ -183,10 +186,12 @@ function createCampaignToken(_, _, _)
end
campaignData = {campaignBoxGUID, campaignLog.getData(), chaosBag.getData()}
campaignTokenData.GMNotes = JSON.encode(campaignData)
campaignTokenData.Nickname = getObjectFromGUID(campaignBoxGUID).getName() .. os.date(" Save: %b %d")
spawnObjectData({
data = campaignTokenData,
position = {-21.25, 1.68, 55.59}
})
broadcastToAll("Campaign successfully exported! Save coin object to import on a fresh save", Color.Green)
end