HugePinball

deck_flip_top_card_global.lua

Feb 26th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. -- scripts to flip the top card of a deck when it is removed from a bag
  2.  
  3. -- global version
  4. -- code to be placed in global
  5.  
  6. function onObjectLeaveContainer(bag, obj)
  7.     log(obj.tag)
  8.     if obj.tag == "Deck" then
  9.         -- make test whatever you need to check for the desired deck
  10.         if obj.getName() == "Flip Deck" then
  11.            Wait.condition(function() flipTop(obj) end, function() return obj.resting end)        
  12.         end
  13.     end
  14. end
  15.  
  16. function flipTop(deck)
  17.     local pos = deck.getPosition()
  18.     deck.takeObject({ position = { pos.x, pos.y + 2, pos.z}, flip = true })
  19. end
Add Comment
Please, Sign In to add comment