forked from sionar/Botc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameSettings.ttslua
333 lines (307 loc) · 11.1 KB
/
GameSettings.ttslua
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
--[[
Table Controls
Made by Sionar
--]]
------------------Constants
VERSION = '1.2.1'
BUTTON_Z_OFFSET = 0.25
#include GUIDs.ttslua
------------------Variables
objects = {}
------------------Functions
function onLoad()
refreshUI()
assignObjects()
self.setDescription('v ' .. VERSION .. '\nMade by Sionar')
end
function assignObjects()
objects.teamTool = getObjectFromGUID(TEAM_TOOL_GUID)
end
function toggleSeatLock(clickedObject, playerColor)
if playerColor ~= 'Black' then
return
end
local options = Global.getTable('options')
if options.seatLock == false then
options.seatLock = true
self.editButton({
index = 1,
label = 'Grey Seats [DA1917]OFF[-]',
tooltip = 'Allow people to sit in the grey seats.',
})
printToColor('Extension seats are locked.', playerColor, {1,1,1})
else
options.seatLock = false
self.editButton({
index = 1,
label = 'Grey Seats [1E87FF]ON[-]',
tooltip = 'Prevent people from sitting in the grey seats.',
})
printToColor('Extension seats are unlocked.', playerColor, {1,1,1})
end
Global.setTable('options', options)
end
function toggleTableText(clickedObject, playerColor)
if playerColor ~= 'Black' then
return
end
local options = Global.getTable('options')
options.tableText = not options.tableText
if options.tableText == false then
Global.call('disableTableText')
self.editButton({index = 2, label = 'Table Text [DA1917]OFF[-]', tooltip = 'Click this to enable the Table Text UI for all players.'})
printToColor('The Table text UI is disabled.', playerColor, {1,1,1})
else
Global.call('enableTableText')
self.editButton({index = 2, label = 'Table Text [1E87FF]ON[-]', tooltip = 'Click this to disable the Table Text UI for all players.'})
printToColor('The Table text UI is enabled.', playerColor, {1,1,1})
end
Global.setTable('options', options)
end
function toggleDecals(clickedObject, playerColor)
if playerColor ~= 'Black' then
return
end
local options = Global.getTable('options')
options.decalsEnabled = not options.decalsEnabled
if options.decalsEnabled == false then
Global.call('disableDecals')
self.editButton({index = 3, label = 'Decal UI [DA1917]OFF[-]', tooltip = 'Click this to enable the Decal UI for all players.'})
printToColor('The decal UI is disabled.', playerColor, {1,1,1})
else
Global.call('enableDecals')
self.editButton({index = 3, label = 'Decal UI [1E87FF]ON[-]', tooltip = 'Click this to disable the Decal UI for all players.'})
printToColor('The decal UI is enabled.', playerColor, {1,1,1})
end
Global.setTable('options', options)
end
function toggleWhispers(clickedObjet, playerColor)
if playerColor ~= 'Black' then
return
end
local options = Global.getTable('options')
if options.whispersOn == true then
Global.call('disableWhispers')
self.editButton({index = 4, label = 'Whispers [DA1917]OFF[-]', tooltip = 'Click this to enable whispering for all players.'})
printToColor('Whispers are disabled.', playerColor, {1,1,1})
else
Global.call('enableWhispers')
self.editButton({index = 4, label = 'Whispers [1E87FF]ON[-]', tooltip = 'Click this to disable whispering for all players.'})
printToColor('Whispers are enabled.', playerColor, {1,1,1})
end
end
function toggleWhisperLength(clickedObjet, playerColor)
if playerColor ~= 'Black' then
return
end
local options = Global.getTable('options')
if options.whisperLengthOn then
Global.call('disableWhisperLength')
self.editButton({index = 5, label = 'Whispers Length [DA1917]OFF[-]', tooltip = 'Click this to show the length of whisper messages.'})
printToColor('Whisper length is disabled.', playerColor, {1,1,1})
else
Global.call('enableWhisperLength')
self.editButton({index = 5, label = 'Whisper Length [1E87FF]ON[-]', tooltip = 'Click this to hide the length of whisper messages.'})
printToColor('Whisper length is enabled.', playerColor, {1,1,1})
end
end
function callDefaultTeamToggle(clickedObject, playerColor)
if playerColor ~= 'Black' then
return
end
if objects.teamTool ~= nil then
objects.teamTool.call('defaultTeamToggle')
local options = Global.getTable('options')
if options.jokersDefault then
Player['Black'].print('The default team is now Jokers.')
self.editButton({index = 6, label = 'Default Team [1E87FF]Jokers[-]', tooltip = 'Make None the default team'})
else
Player['Black'].print('The default team is now None.')
self.editButton({index = 6, label = 'Default Team [DA1917]None[-]', tooltip = 'Make Jokers the default team'})
end
end
end
function callSafetyToggle(clickedObject, playerColor)
if playerColor ~= 'Black' then
return
end
Global.call('toggleSafety')
local options = Global.getTable('options')
if options.safetyOn then
Player['Black'].print('Safety is now on.')
self.editButton({index = 7, label = 'Safety [1E87FF]ON[-]', tooltip = 'Click this to disable safety for revealing the Grimoire and resetting the game.'})
else
Player['Black'].print('Safety is now off.')
self.editButton({index = 7, label = 'Safety [DA1917]OFF[-]', tooltip = 'Click this to enable safety for revealing the Grimoire and resetting the game.'})
end
end
function refreshUI()
self.clearButtons()
local num = 0
local z_inc = 0.4
local z_start = -1.2
local font_size = 250
local params
local options = Global.getTable('options')
params = {
click_function = 'nullFunc',
function_owner = self,
label = 'Game Settings',
color = {0,0,0,1},
font_color = stringColorToRGB('White'),
position = {0,0.2,-1.8 + BUTTON_Z_OFFSET},
width = 0,
height = 0,
font_size = 120
}
self.createButton(params)
params = {
click_function = 'toggleSeatLock',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.seatLock then
params.label = 'Grey Seats [DA1917]OFF[-]'
params.tooltip = 'Allow people to sit in the grey seats.'
else
params.label = 'Grey Seats [1E87FF]ON[-]'
params.tooltip = 'Prevent people from sitting in the grey seats.'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'toggleTableText',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.tableText then
params.label = 'Table Text [1E87FF]ON[-]'
params.tooltip = 'Click this to disable the Table Text UI for all players.'
else
params.label = 'Table Text [DA1917]OFF[-]'
params.tooltip = 'Click this to enable the Table Text UI for all players.'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'toggleDecals',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.decalsEnabled then
params.label = 'Decal UI [1E87FF]ON[-]'
params.tooltip = 'Click this to disable the Decal UI for all players.'
else
params.label = 'Decal UI [DA1917]OFF[-]'
params.tooltip = 'Click this to enable the Decal UI for all players.'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'toggleWhispers',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
label = 'Whispers [1E87FF]ON[-]',
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.whispersOn then
params.label = 'Whispers [1E87FF]ON[-]'
params.tooltip = 'Click this to disable whispering for all players.'
else
params.label = 'Whispers [DA1917]OFF[-]'
params.tooltip = 'Click this to enable whispering for all players.'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'toggleWhisperLength',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
label = 'Whispers [1E87FF]ON[-]',
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.whisperLengthOn then
params.label = 'Whisper Length [1E87FF]ON[-]'
params.tooltip = 'Click this to hide the length of whisper messages.'
else
params.label = 'Whispers Length [DA1917]OFF[-]'
params.tooltip = 'Click this to show the length of whisper messages.'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'callDefaultTeamToggle',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
color = {0,0,0},
font_color = {1,1,1},
font_size = 250,
scale = {0.5,0.5,0.5},
}
if options.jokersDefault then
params.label = 'Default Team [1E87FF]Jokers[-]'
params.tooltip = 'Make None the default team'
else
params.label = 'Default Team [DA1917]None[-]'
params.tooltip = 'Make Jokers the default team'
end
self.createButton(params)
num = num + 1
params = {
click_function = 'callSafetyToggle',
function_owner = self,
position = {0,0.2,z_start + num * z_inc + BUTTON_Z_OFFSET},
rotation = {0,0,0},
width = 2500,
height = 400,
color = {0,0,0},
font_color = {1,1,1},
font_size = font_size,
scale = {0.5,0.5,0.5},
}
if options.safetyOn then
params.label = 'Safety [1E87FF]ON[-]'
params.tooltip = 'Click this to disable safety for revealing the Grimoire and resetting the game.'
else
params.label = 'Safety [DA1917]OFF[-]'
params.tooltip = 'Click this to enable safety for revealing the Grimoire and resetting the game.'
end
self.createButton(params)
num = num + 1
end