-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacters.ttslua
More file actions
366 lines (355 loc) · 12.8 KB
/
characters.ttslua
File metadata and controls
366 lines (355 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
characterData = {
["Caprice"] = {
fullName = 'Caprice Nisei',
guids = {
bag = '02124d',
sheet = 'f6b92e',
twilightMarker = '12879f',
tipSheet = '5d2bce',
plots = 'a3cdcc',
plotTwo = '13693b',
lightDeck = '711d52',
darkDeck = 'd77753',
token = '1d46ef',
leadOne = '84cab9',
leadTwo = 'f1a949',
heroMarkers = 'eb3cad',
warrants = '4f7de6',
favorsOne = 'f0ea7a',
favorsThree = '60a79c',
statusOne = 'a27b9d',
statusTwo = 'd82d2d',
statusThree = '0ad3f7',
sanityCard = '2c15ca',
sanityMarker = '692e4c',
jintekiWarrant = 'c4c2dc'
},
startingLocations = {
token = {area = 'board', x = -17.53, y = 2.20, z = -11.21, xRot = 0, yRot = 0, zRot = 0},
leadOne = {area = 'board', x = -16.04, y = 1.0, z = -18.16, xRot = 0, yRot = 90, zRot = 180},
leadTwo = {area = 'board', x = -24.81, y = 1.0, z = -21.72, xRot = 0, yRot = 180, zRot = 0},
darkDeck = {area = 'board', x = -16.99, y = 1.1, z = 0.75, xRot = 0, yRot = 180, zRot = 180},
sanityCard = {area = 'tray', x = 4.75, y = 0.7, z = 3, xRot = 0, yRot = 180, zRot = 0, lock = true},
sanityMarker = {area = 'tray', x = 7, y = 0.8, z = 2.4, xRot = 0, yRot = 180, zRot = 180},
jintekiWarrant = {area = 'board', x = -15.03, y = 1.1, z = -9.64, xRot = 0, yRot = 180, zRot = 0},
}
},
["Floyd"] = {
fullName = 'Floyd 2X3A7C',
guids = {
bag = '83215a',
sheet = '18cd23',
twilightMarker = 'a4a35e',
tipSheet = '047dce',
plots = 'bcc8be',
lightDeck = '33735a',
darkDeck = '241520',
token = '4fd00f',
leadOne = 'e20c25',
leadTwo = '2a6fdc',
heroMarkers = 'f90713',
warrants = '865768',
favorsOne = '34dc5e',
statusOne = '8a9a22',
statusTwo = 'df45f8',
statusThree = '085735',
specialCardOne = '1e5705',
specialCardTwo = 'c84713',
specialCardThree = '826556',
hbWarrant = '6e33c6',
startingFavorOne = '3b87f5'
},
startingLocations = {
token = {area = 'board', x = -19.58, y = 2.20, z = 21.24, xRot = 0, yRot = 0, zRot = 0},
leadOne = {area = 'board', x = -20.11, y = 1.0, z = 15.66, xRot = 0, yRot = 90, zRot = 180},
leadTwo = {area = 'board', x = -14.81, y = 1.0, z = 5.32, xRot = 0, yRot = 180, zRot = 0},
darkDeck = {area = 'board', x = -29.22, y = 1.1, z = 0.75, xRot = 0, yRot = 180, zRot = 180},
hbWarrant = {area = 'board', x = -17.07, y = 1.1, z = 19.58, xRot = 0, yRot = 180, zRot = 0}
}
},
["Louis"] = {
fullName = 'Louis Blaine',
guids = {
bag = '6d8d74',
sheet = '273c8f',
twilightMarker = '684399',
tipSheet = 'a83922',
plots = 'daa15d',
lightDeck = '85631d',
darkDeck = '6f9654',
token = 'e72d42',
leadOne = 'b7e58c',
leadTwo = '6604bb',
heroMarkers = '581726',
warrants = '435d29',
favorsOne = '19486b',
favorsTwo = 'f5b8ce',
statusOne = '9e4e5a',
statusTwo = '80efbf',
statusThree = '7b0395',
startingFavorOne = '86384a',
startingFavorTwo = 'dae7c5',
specialCardOne = 'a22957'
},
startingLocations = {
token = {area = 'board', x = 17.71, y = 2.20, z = -9.78, xRot = 0, yRot = 0, zRot = 0},
leadOne = {area = 'board', x = 17.66, y = 1.0, z = -15.32, xRot = 0, yRot = 90, zRot = 180},
leadTwo = {area = 'board', x = 31.36, y = 1.0, z = -16.08, xRot = 0, yRot = 180, zRot = 0},
darkDeck = {area = 'board', x = -5.12, y = 1.1, z = 0.75, xRot = 0, yRot = 180, zRot = 180}
}
},
["Rachel"] = {
fullName = 'Rachel Beckmann',
guids = {
bag = '42c8a2',
sheet = '6b8674',
twilightMarker = '81d1dd',
tipSheet = 'acb65e',
plots = '9a5121',
lightDeck = 'af0855',
darkDeck = 'ca2290',
token = 'e9fa3e',
leadOne = '16b73e',
leadTwo = 'be9234',
heroMarkers = 'b193d6',
warrants = '4937a5',
favorsOne = '667f6a',
favorsThree = '5c984c',
statusOne = '9ef393',
statusTwo = '78e0e6',
statusThree = 'a51099',
specialCardOne = 'b99bc8',
moneyMarker = 'a2a9da'
},
startingLocations = {
token = {area = 'board', x = 6.48, y = 2.20, z = 22.62, xRot = 0, yRot = 0, zRot = 0},
leadOne = {area = 'board', x = 5.69, y = 1.0, z = 4.44, xRot = 0, yRot = 90, zRot = 180},
leadTwo = {area = 'board', x = -4.89, y = 1.0, z = 11.19, xRot = 0, yRot = 180, zRot = 0},
darkDeck = {area = 'board', x = -10.86, y = 1.1, z = 0.75, xRot = 0, yRot = 180, zRot = 180},
moneyMarker = {area = 'tray', x = 7, y = 0.8, z = 3.14, xRot = 0, yRot = 180, zRot = 180}
}
},
["Raymond"] = {
fullName = 'Raymond Flint',
guids = {
bag = '571c7c',
sheet = '551412',
twilightMarker = '8f49f8',
tipSheet = '8f57e9',
plots = 'dc1b04',
lightDeck = '7013c7',
darkDeck = '49cb2b',
token = '818aaa',
leadOne = 'ebf731',
leadTwo = 'f350de',
heroMarkers = '44ff31',
warrants = '11d4a9',
favorsOne = '940056',
statusOne = '7ec446',
statusTwo = '661873',
statusThree = '66b770',
specialCardOne = 'd940f4',
memoryDeck = '7556ad'
},
startingLocations = {
token = {area = 'board', x = -4.42, y = 2.20, z = -13.94, xRot = 0, yRot = 0, zRot = 0},
leadOne = {area = 'board', x = -9.07, y = 1.0, z = -14.42, xRot = 0, yRot = 90, zRot = 180},
leadTwo = {area = 'board', x = -0.36, y = 1.3, z = -10.58, xRot = 0, yRot = 180, zRot = 0},
darkDeck = {area = 'board', x = -23.31, y = 1.1, z = 0.75, xRot = 0, yRot = 180, zRot = 180},
dropshipToken = {area = 'tray', x = -2.4, y = 0.8, z = -0.75, xRot = 0, yRot = 180, zRot = 0}
}
}
}
commonCharacterItemStartingLocations = {
bag = {area = 'tray', x = -10, y = 3, z = -5, xRot = 0, yRot = 0, zRot = 0},
sheet = {area = 'tray', x = -11.2, y = 0.8, z = 2.2, xRot = 0, yRot = 180, zRot = 0},
twilightMarker = {area = 'tray', x = -11.2, y = 0.8, z = 1.4, xRot = 0, yRot = 0, zRot = 0},
tipSheet = {area = 'tray', x = -11.2, y = 0.8, z = -2.1, xRot = 0, yRot = 180, zRot = 0},
plotOne = {area = 'tray', x = -2.75, y = 0.8, z = 3, xRot = 0, yRot = 180, zRot = 180},
plotTwo = {area = 'tray', x = 1, y = 0.8, z = 3, xRot = 0, yRot = 180, zRot = 180},
heroMarkers = {area = 'tray', x = -3.3, y = 0.8, z = 0.5, xRot = 0, yRot = 180, zRot = 0},
warrants = {area = 'tray', x = -1.5, y = 0.8, z = 0.5, xRot = 0, yRot = 180, zRot = 0},
favorsOne = {area = 'tray', x = 12, y = 0.8, z = -3.6, xRot = 0, yRot = 180, zRot = 0},
favorsTwo = {area = 'tray', x = 14.2, y = 0.8, z = -3.6, xRot = 0, yRot = 180, zRot = 0},
favorsThree = {area = 'tray', x = 16.4, y = 0.8, z = -3.6, xRot = 0, yRot = 180, zRot = 0},
startingFavorOne = {area = 'tray', x = 1, y = 0.8, z = 0.5, xRot = 0, yRot = 180, zRot = 0},
startingFavorTwo = {area = 'tray', x = 4, y = 0.8, z = 0.5, xRot = 0, yRot = 180, zRot = 0},
statusOne = {area = 'tray', x = 1, y = 0.8, z = -0.75, xRot = 0, yRot = 180, zRot = 0},
statusTwo = {area = 'tray', x = 4, y = 0.8, z = -0.75, xRot = 0, yRot = 180, zRot = 0},
statusThree = {area = 'tray', x = 7, y = 0.8, z = -0.75, xRot = 0, yRot = 180, zRot = 0},
lightDeck = {area = 'tray', x = -2, y = 0.8, z = -2.75, xRot = 180, yRot = 0, zRot = 0},
specialCardOne = {area = 'tray', x = 4.75, y = 0.8, z = 3, xRot = 0, yRot = 180, zRot = 0},
specialCardTwo = {area = 'tray', x = 8.5, y = 0.8, z = 3, xRot = 0, yRot = 180, zRot = 0},
specialCardThree = {area = 'tray', x = 12.25, y = 0.8, z = 3, xRot = 0, yRot = 180, zRot = 0}
}
itemNotInBags = {
bag = true,
statusOne = true,
statusTwo = true,
statusThree = true
}
startingPuzzleMarkerLocations = {
{x = 45.44, y = 1.01, z = 14.94, xRot = 0, yRot = 180, zRot = 180},
{x = 45.44, y = 1.01, z = 16.81, xRot = 0, yRot = 180, zRot = 180},
{x = 49.17, y = 1.01, z = 14.94, xRot = 0, yRot = 180, zRot = 180},
{x = 49.17, y = 1.01, z = 16.81, xRot = 0, yRot = 180, zRot = 180},
{x = 47.44, y = 1.01, z = 15.83, xRot = 0, yRot = 180, zRot = 180}
}
function setUpCharacters()
for playerColor, characterID in pairs(playerCharacters) do
bag = getObjectFromGUID(characterData[characterID]['guids']['bag'])
tray = getObjectFromGUID(playerObjectGUIDs[playerColor]['trayLiner'])
setUpCharacter(bag, tray, playerColor)
end
-- wait for everything to appear/fall before this next bit
Wait.time(function()
local i = 1
for playerColor, characterID in pairs(playerCharacters) do
-- lock some things in place
local data = characterData[characterID]
for item, location in pairs(data['startingLocations']) do
if location.lock == true and data['guids'][item] != nil then
getObjectFromGUID(data['guids'][item]).setLock(true)
end
end
-- puzzle piece markers
markers = getObjectFromGUID(data['guids']['heroMarkers'])
l = startingPuzzleMarkerLocations[i]
markers.takeObject({position = {l.x, l.y, l.z}, rotation = {l.xRot, l.yRot, l.zRot}})
i = i + 1
-- shuffle things! deal light cards!
lightDeck = getObjectFromGUID(data['guids']['lightDeck'])
lightDeck.shuffle()
lightDeck.deal(2, playerColor)
getObjectFromGUID(data['guids']['darkDeck']).shuffle()
end
local turnOrder = Turns.order
for i = 5, 1, -1 do
if Player[turnOrder[i]].seated == false then
table.remove(turnOrder, i)
end
end
for i, color in pairs(turnOrder) do
nextColor = turnOrder[i + 1]
if nextColor == nil then nextColor = turnOrder[1] end
darkDeck = getObjectFromGUID(characterData[playerCharacters[nextColor]]['guids']['darkDeck'])
darkDeck.deal(1, color)
end
end, 2)
end
function setUpCharacter(bag, tray, playerColor)
local id = bag.getName()
local data = characterData[id]
if data == nil then
return
end
local guids = data['guids']
for item, location in pairs(commonCharacterItemStartingLocations) do
if itemNotInBags[item] then
placeCharacterItem(guids[item], tray, location)
else
placeCharacterItemFromBag(bag, guids[item], tray, location)
end
end
for item, location in pairs(data.startingLocations) do
placeCharacterItemFromBag(bag, guids[item], tray, location)
end
bag.takeObject({
guid = guids['plots'],
callback_function = function(plotsBag)
plotsBag.randomize()
placePlot(plotsBag, tray, commonCharacterItemStartingLocations['plotOne'], true)
if id != 'Caprice' and id != 'Raymond' then
placePlot(plotsBag, tray, commonCharacterItemStartingLocations['plotTwo'], false)
end
plotsBag.destruct()
end
})
if id == 'Raymond' then
-- get dropship token
local l = data.startingLocations.dropshipToken
getObjectFromGUID(dropshipTokensGUID).takeObject({
position = locationToPosition(l, tray),
rotation = locationToRotation(l, tray)
})
-- set up memory cards
bag.takeObject({
guid = data.guids.memoryDeck,
position = locationToPosition(commonCharacterItemStartingLocations.specialCardTwo, tray),
callback_function = function(deck)
deck.shuffle()
for _, player in pairs(Player.getPlayers()) do
if player.color != playerColor then
deck.deal(1, player.color)
end
end
deck.destruct()
end
})
end
bag.destruct()
end
function placeCharacterItemFromBag(bag, itemGUID, tray, location)
if itemGUID == nil then
return
end
bag.takeObject({
guid = itemGUID,
position = locationToPosition(location, tray),
rotation = locationToRotation(location, tray),
smooth = false;
})
end
function placeCharacterItem(itemGUID, tray, location)
if itemGUID == nil then
return
end
item = getObjectFromGUID(itemGUID)
item.setPosition(locationToPosition(location, tray))
item.setRotation(locationToRotation(location, tray))
end
function placePlot(plots, tray, location, start)
local item = plots.takeObject({
position = locationToPosition(location, tray),
rotation = locationToRotation(location, tray),
smooth = false
})
if start then
Wait.time(function()
pos = item.getPosition()
pos.y = pos.y + 0.2
item.takeObject({position = pos, flip = true})
end, 0.1)
end
end
function locationToPosition(location, tray)
pos = {
x = location.x,
y = location.y,
z = location.z
}
if location.area == 'tray' then
pos = tray.positionToWorld(pos)
end
return pos
end
function locationToRotation(location, tray)
rot = {
x = location.xRot,
y = location.yRot,
z = location.zRot
}
if location.area == 'tray' then
rot.y = rot.y + tray.getRotation().y
if rot.y >= 360 then
rot.y = rot.y - 360
end
end
return rot
end
function characterIDFromBag(object)
if object.tag == "Bag" and characterData[object.getName()] != nil then
return object.getName()
end
return nil
end