Created
March 29, 2021 19:36
-
-
Save blam23/853e56215765ed4a3f2611e60dc308f2 to your computer and use it in GitHub Desktop.
Better shuffle for TableTop Simulator for decks users spawn in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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