98 lines
2.3 KiB
Plaintext
98 lines
2.3 KiB
Plaintext
DOORWAY_GUIDS = { "5c61d9", "72ac0c", "6bb83e" }
|
|
LOCATION_POSITIONS = { {-30.22, 1.64, 7.57}, {-36.77, 1.65, -0.03}, {-30.22, 1.63, -7.70} }
|
|
WITCH_HOUSE_GUID = "7bea34"
|
|
UNKNOWN_PLACES = {
|
|
guid = "2ebf66",
|
|
position = Vector({-17.12, 1.66, 7.57}),
|
|
rotation = {0, 270, 0}
|
|
}
|
|
ASSEMBLY = {
|
|
position = Vector({ x=68, y=0, z=36 }),
|
|
rotation = { x=0, y=270, z=180 }
|
|
}
|
|
|
|
function onLoad()
|
|
self.createButton({
|
|
label="Set Up",
|
|
click_function="setup",
|
|
function_owner=self,
|
|
position={0,0.1,0.4},
|
|
height=120,
|
|
width=400,
|
|
scale={x=1.75, y=1.75, z=1.75},
|
|
font_size=100
|
|
})
|
|
|
|
math.randomseed(os.time())
|
|
end
|
|
|
|
function getAssemblyDeck()
|
|
local objs = Physics.cast({
|
|
origin = ASSEMBLY.position,
|
|
direction = { x=0, y=1, z=0 },
|
|
type = 3,
|
|
size = { x=1, y=1, z=1 },
|
|
orientation = ASSEMBLY.rotation
|
|
})
|
|
|
|
for i,v in ipairs(objs) do
|
|
if v.hit_object.tag == "Deck" then
|
|
return v.hit_object
|
|
end
|
|
end
|
|
|
|
return nil
|
|
end
|
|
|
|
function setup(obj, color, alt_click)
|
|
if DISABLED then return end
|
|
DISABLED = true
|
|
for i,guid in ipairs(DOORWAY_GUIDS) do
|
|
local card = getObjectFromGUID(guid)
|
|
card.setPosition(ASSEMBLY.position)
|
|
end
|
|
Wait.time(setup_2, 1)
|
|
end
|
|
|
|
function setup_2()
|
|
local deck = getAssemblyDeck()
|
|
deck.shuffle()
|
|
|
|
for i=#LOCATION_POSITIONS,2,-1 do
|
|
deck.takeObject({
|
|
position = LOCATION_POSITIONS[i],
|
|
rotation = UNKNOWN_PLACES.rotation,
|
|
smooth = false
|
|
})
|
|
end
|
|
deck.remainder.setPosition(LOCATION_POSITIONS[1])
|
|
|
|
places = getObjectFromGUID(UNKNOWN_PLACES.guid)
|
|
places.shuffle()
|
|
|
|
for i=1,3 do
|
|
places.takeObject({
|
|
position = ASSEMBLY.position,
|
|
rotation = UNKNOWN_PLACES.rotation,
|
|
smooth = false
|
|
})
|
|
end
|
|
|
|
local witch_house = getObjectFromGUID(WITCH_HOUSE_GUID)
|
|
witch_house.flip()
|
|
witch_house.setPosition(UNKNOWN_PLACES.position + Vector(0, 0.5, 0))
|
|
|
|
Wait.time(setup_3, 1)
|
|
end
|
|
|
|
function setup_3()
|
|
places.shuffle()
|
|
deck = getAssemblyDeck()
|
|
deck.shuffle()
|
|
Wait.time(setup_4, 1)
|
|
end
|
|
|
|
function setup_4()
|
|
deck.setPosition(UNKNOWN_PLACES.position + Vector(0, 1, 0))
|
|
end
|