tts-community / tts-community-bug-tracker

Community maintained list of Tabletop Simulator bugs.
2 stars 0 forks source link

CardCustom never finishes loading according to loading_custom #15

Open Benjamin-Dobell opened 4 years ago

Benjamin-Dobell commented 4 years ago

Describe the bug

When spawning a custom CardCustom using spawnObjectJSON, loading_custom remains as true indefinitely i.e. after the card texture has visibly loaded.

To Reproduce

  1. Create a new Single Player game, dismiss the Load prompt to use the default empty scene.
  2. Open the Scripting editor and paste the Lua attached below into Global.
  3. Hit "Save & Play".

Expected behavior

Should see in Game chat tab:

Loading complete for Card Loading complete for CardCustom

Actual behavior

Instead seeing:

Loading complete for Card Loading failed to complete for CardCustom. spawning = false, loading_custom = true

Lua Scripts:

Global:

local function waitUntilLoadedCallback(object)
    Wait.condition(function()
        local name = JSON.decode(object.getJSON()).Name
        print('Loading complete for ' .. name)
    end, function()
        return not object.spawning and not object.loading_custom
    end, 10, function()
        local name = JSON.decode(object.getJSON()).Name
        print('Loading failed to complete for ' .. name .. '. spawning = ' .. tostring(object.spawning) .. ' loading_custom = ' .. tostring(object.loading_custom))
    end)
end

function onLoad()
    local jsonRepresentation = {
      Name = "Card",
      Transform = {
        posX = 0,
        posY = 3,
        posZ = 0,
        rotX = 0,
        rotY = 180,
        rotZ = 0,
        scaleX = 1,
        scaleY = 1.2,
        scaleZ = 1.4
      },
      Nickname = "Test Card",
      Hands = true,
      CardID = 2111,
      CustomDeck = {
        ["21"] = {
          FaceURL = "https://kb.tabletopsimulator.com/img/custom-deck/template-sheet.png",
          BackURL = "https://kb.tabletopsimulator.com/img/custom-deck/template-sheet.png",
          NumWidth = 10,
          NumHeight = 7,
          BackIsHidden = true,
          UniqueBack = true
        }
      }
    }

    spawnObjectJSON({
        json = JSON.encode(jsonRepresentation),
        callback_function = waitUntilLoadedCallback
    })

    jsonRepresentation.Name = "CardCustom"
    jsonRepresentation.Transform.posX = 2

    spawnObjectJSON({
        json = JSON.encode(jsonRepresentation),
        callback_function = waitUntilLoadedCallback
    })
end

Tabletop Simulator Info (please complete the following information):

Known workarounds

None.

Additional context

Likely arose in 12.2.2 as changes were made in this area to attempt to address https://github.com/tts-community/tts-community-bug-tracker/issues/12.

apachano commented 3 years ago

Just noting that this still happens on 12.4.3 - in Linux :(