Skip to content

Instantly share code, notes, and snippets.

@blam23
Created March 29, 2021 19:36
Show Gist options
  • Select an option

  • Save blam23/853e56215765ed4a3f2611e60dc308f2 to your computer and use it in GitHub Desktop.

Select an option

Save blam23/853e56215765ed4a3f2611e60dc308f2 to your computer and use it in GitHub Desktop.
Better shuffle for TableTop Simulator for decks users spawn in
shufflePlusTag = "shuffle+"
function onObjectSpawn(obj)
if (obj.type == "Deck") then
obj:addContextMenuItem("Shuffle+", function(player_color)
if (obj:hasTag(shufflePlusTag)) then
return
end
obj:addTag(shufflePlusTag)
newDecks = obj:split(4)
Wait.frames(
function()
main = newDecks[#newDecks]
for i = 1, #newDecks do
newDecks[i]:randomize()
end
for i = 1, #newDecks do
if (newDecks[i] ~= main) then
main:putObject(newDecks[i])
end
main:randomize()
end
obj:removeTag(shufflePlusTag)
end,
1
)
end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment