Check for card types when updating customizable data
Avoids errors from GMNotes on tokens which aren't JSON
This commit is contained in:
parent
6990c8a628
commit
6a09da1723
@ -458,8 +458,9 @@ end
|
|||||||
function syncCustomizableMetadata(card)
|
function syncCustomizableMetadata(card)
|
||||||
local cardMetadata = JSON.decode(card.getGMNotes()) or { }
|
local cardMetadata = JSON.decode(card.getGMNotes()) or { }
|
||||||
if cardMetadata ~= nil and cardMetadata.customizations ~= nil then
|
if cardMetadata ~= nil and cardMetadata.customizations ~= nil then
|
||||||
for _, obj in ipairs(searchArea(PLAY_ZONE_POSITION, PLAY_ZONE_SCALE)) do
|
for _, collision in ipairs(searchArea(PLAY_ZONE_POSITION, PLAY_ZONE_SCALE)) do
|
||||||
local obj = obj.hit_object
|
local obj = collision.hit_object
|
||||||
|
if obj.name == "Card" or obj.name == "CardCustom" then
|
||||||
local notes = JSON.decode(obj.getGMNotes()) or { }
|
local notes = JSON.decode(obj.getGMNotes()) or { }
|
||||||
if notes.id == (cardMetadata.id .. "-c") then
|
if notes.id == (cardMetadata.id .. "-c") then
|
||||||
for i, customization in ipairs(cardMetadata.customizations) do
|
for i, customization in ipairs(cardMetadata.customizations) do
|
||||||
@ -474,6 +475,7 @@ function syncCustomizableMetadata(card)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function spawnTokensFor(object)
|
function spawnTokensFor(object)
|
||||||
local extraUses = { }
|
local extraUses = { }
|
||||||
|
Loading…
Reference in New Issue
Block a user