
When a custom deck is spawned via Lua scripting with spawnObjectData(), no player can use the “Search” feature on the deck. Other functions such as shuffle, Cut, Split, and Reset work just fine. However, the Search function will remain unusable until an entirely new deck is formed (i.e. by Spreading all cards then grouping them back into a new deck).
I cannot identify exactly the cause, but it is fully consistent in all spawned deck across my modules and scripted objects. Decks spawned directly by a player or already in the module do not seem to be affected.



cannot reproduce, can you provide sample code?

I am afraid the issue shows up in some fairly large creations of mine but I will attach a copy of an object affected by this with much of its scripting trimmed down to hopefully make it easier to locate. I can confirm this version still produces unsearchable decks with 100% consistency on my platform.

This bug appears to be caused by spawning a deck object (whether by spawnObjectData() or just editing an object’s .json) where the ContainedObjects contains cards that do not have a declared Transform table.
Note that for the spawnObjectData() function, the given Transform parameter data does not need to include any actual values, so Transform = {} is valid, and will allow the function to spawn Transform values which allows the cards to be searched. If this is not provided explicitly in the input table, spawnObjectData() will produce a Deck object where the cards have no Transform table, resulting in the Search function being unable to work on the deck.
The attached object file is an example of a Deck object where it impossible to Search the cards contained in it, due to a lack of Transform data.
The following code provides a simple script for spawning in a deck with these properties.
function onObjectDrop()
local templateDeck = {
GUID = nil,
Name = "Deck",
Transform = {
posX = 0,
posY = 0,
posZ = 0,
rotX = 0,
rotY = 0,
rotZ = 0,
scaleX = 1.5,
scaleY = 1.5,
scaleZ = 1.5,
},
Nickname = "",
Description = "",
GMNotes = "",
Tags = {},
AltLookAngle = {
x = 0.0,
y = 0.0,
z = 0.0
},
ColorDiffuse = {
r = 0.0,
g = 0.0,
b = 0.0
},
LayoutGroupSortIndex = 0,
Value = 0,
Locked = false,
Grid = true,
Snap = true,
IgnoreFoW = false,
MeasureMovement = false,
DragSelectable = true,
Autoraise = true,
Sticky = true,
Tooltip = true,
GridProjection = false,
HideWhenFaceDown = true,
Hands = false,
SidewaysCard = false,
DeckIDs = {},
LuaScript = "",
LuaScriptState = "",
XmlUI = "",
ContainedObjects = {},
}
-- Add cards to the deck
for i=1,20,1 do
table.insert(templateDeck.ContainedObjects, {
Name = "Card",
CardID = i,
-- Transform = {}, -- Uncomment this line to fix the bug!
})
table.insert(templateDeck.DeckIDs, i)
end
-- Spawn the deck
spawnObjectData({
data = templateDeck,
position = {x=0, y=5, z=0}
})
end