76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
LOCATIONS = {
|
|
{
|
|
name = "Downtown",
|
|
guids = { "1aa7cb", "b5b8db" },
|
|
position = Vector({-17.12, 1.62, -0.03})
|
|
},
|
|
{
|
|
name = "Southside",
|
|
guids = { "076b61", "19e7d8" },
|
|
position = Vector({-30.22, 1.64, -0.03})
|
|
}
|
|
}
|
|
|
|
ACOLYTE_SPAWNS = {
|
|
{-33.72, 1.64, -0.02}, {-13.78, 1.61, 0.01}, {-23.79, 1.63, -10.13}
|
|
}
|
|
|
|
ENCOUNTER_DECK_GUID = "28e161"
|
|
|
|
SET_ASIDE = {
|
|
position = Vector({-5.75, 1.54, 19.25}),
|
|
rotation = { x=0, y=270, z=0 }
|
|
}
|
|
|
|
function onLoad()
|
|
self.createButton({
|
|
label="Set Up",
|
|
click_function="setup",
|
|
function_owner=self,
|
|
position={0,0.1,-00},
|
|
height=120,
|
|
width=500,
|
|
scale={x=1.75, y=1.75, z=1.75},
|
|
font_size=80
|
|
})
|
|
|
|
COUNTER = getObjectFromGUID('f182ee')
|
|
math.randomseed(os.time())
|
|
end
|
|
|
|
function setup(_obj, _color, alt_click)
|
|
if SETUP_DONE then return end
|
|
SETUP_DONE = true
|
|
for i,loc in ipairs(LOCATIONS) do
|
|
local chosen = math.random(2)
|
|
local guid = loc.guids[chosen]
|
|
local card = getObjectFromGUID(loc.guids[3 - chosen])
|
|
card.setPosition(SET_ASIDE.position)
|
|
card.setRotation({0, 270, 0})
|
|
card = getObjectFromGUID(guid)
|
|
card.setPosition(loc.position)
|
|
card.setRotation({0, 270, 0})
|
|
end
|
|
|
|
local numPlayers = COUNTER.getVar('val')
|
|
if numPlayers > 1 then
|
|
local deck = getObjectFromGUID(ENCOUNTER_DECK_GUID)
|
|
local objs = deck.getObjects()
|
|
local indexes = {}
|
|
for i,card in ipairs(objs) do
|
|
if card.name == "Acolyte" then
|
|
table.insert(indexes, card.index)
|
|
end
|
|
end
|
|
for i=numPlayers-1,1,-1 do
|
|
deck.takeObject({
|
|
index = indexes[i],
|
|
position = ACOLYTE_SPAWNS[i],
|
|
rotation = {0, 270, 0},
|
|
smooth = false
|
|
})
|
|
Global.call("spawnToken", { Vector(ACOLYTE_SPAWNS[i]) + Vector({ 0, 1, 0}), "doom" })
|
|
end
|
|
end
|
|
end
|