Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onLoad(save_state)
- buttons = {
- click_function = "placeSleeve",
- function_owner = self,
- label = "",
- position = {-0.61, 0.1, 0.8},
- width = 400,
- height = 100,
- color = {0,0,0,0}
- }
- self.createButton(buttons)
- buttons.click_function = "drawCard"
- buttons.position = {0.535, 0.1, 0.8}
- buttons.width = 250
- self.createButton(buttons)
- buttons.click_function = "reshuffle"
- buttons.position = {1.135, 0.1, 0.8}
- buttons.width = 300
- self.createButton(buttons)
- end
- function placeSleeve()
- getObjectFromGUID("b26c16").takeObject({
- position = self.positionToWorld({0.61, 0.5, -0.1484}),
- rotation = {0, 0, 0}
- })
- end
- function drawCard()
- local hitlist = Physics.cast({
- origin = self.positionToWorld({-0.855, 0, -0.551}),
- direction = {0,1,0},
- type = 2,
- size = {1,1,1},
- max_distance = 0,
- debug = false
- }) -- returns {{Vector point, Vector normal, float distance, Object hit_object}, ...}
- for i, j in pairs(hitlist) do
- if j.hit_object.tag == "Deck" then
- j.hit_object.takeObject({
- position = self.positionToWorld({-0.855, 1, 0.2595}),
- flip = true
- })
- return
- end
- end
- end
- function reshuffle()
- local hitlist = Physics.cast({
- origin = self.positionToWorld({-0.855, 0, 0.2595}),
- direction = {0,1,0},
- type = 2,
- size = {1,1,1},
- max_distance = 0,
- debug = false
- }) -- returns {{Vector point, Vector normal, float distance, Object hit_object}, ...}
- for i, j in pairs(hitlist) do
- if j.hit_object.tag == "Deck" or j.hit_object.tag == "Card" then
- deck = Physics.cast({
- origin = self.positionToWorld({-0.855, 0, -0.551}),
- direction = {0,1,0},
- type = 2,
- size = {1,1,1},
- max_distance = 0,
- debug = false
- }) -- returns {{Vector point, Vector normal, float distance, Object hit_object}, ...}
- for u, v in pairs(deck) do
- if v.hit_object.tag == "Deck" then
- v.hit_object.putObject(j.hit_object)
- v.hit_object.shuffle()
- end
- end
- return
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement