-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlayerReference.ttslua
More file actions
159 lines (143 loc) · 2.93 KB
/
PlayerReference.ttslua
File metadata and controls
159 lines (143 loc) · 2.93 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
--[[
Player Reference
--]]
------------------Constants
START_POS = {x = -115, y = 1.1, z = 48.5}
START_POS_12P = {x = -115, y = 1.1, z = 48.5}
X_RADIUS = -1.2
Z_RADIUS = 1
X_WIDTH = 10
Z_WIDTH = 6
X_SEG_LENGTH = -1 * X_RADIUS / (X_WIDTH / 2)
Z_SEG_LENGTH = Z_RADIUS / (Z_WIDTH / 2)
X_C = {}
Z_C = {}
for i = 1, X_WIDTH + 1 do
X_C[i] = X_RADIUS + X_SEG_LENGTH * (i-1)
end
for i = 1, Z_WIDTH + 1 do
Z_C[i] = Z_RADIUS - Z_SEG_LENGTH * (i-1)
end
PLAYERS =
{
'Astuart007',
'BigFrostie',
'Bless',
'Blooming',
'Bornis',
'BrianDRT',
'Brittany',
'Brokenhope Magoo',
'Broubison',
'Catsandicecream',
'Coo Person',
'Cressie',
'Darthvader',
'Dastina',
'Dead Tube',
'Ducktales',
'Elessar',
'GG77R6',
'Ghost',
'Ikigai',
'Katy',
'Kaz088',
'Lightning McQueen',
'Lost Savage',
'Manaphy',
'Mistah Craig',
'Negative Nancy',
'Nikos',
'Penshar',
'Perry',
'Piggy',
'Prinny',
'Rix',
'Rubio',
'Sionar',
'Sveryhn',
'Tetarus',
'Thebluebunny',
'TMNTWWE05',
'Tux',
'Wolflord2',
'Zechbell',
}
------------------Variables
lineTable = {}
------------------Functions
function onLoad(saveString)
local global_name = Global.getVar('MOD_NAME')
if global_name == 'Secret Hitler: CE' then
local options = Global.getTable('options')
if options.zoneType == 6 then
self.setPosition(START_POS_12P)
else
self.setPosition(START_POS)
end
self.setLock(true)
end
self.setDescription('v ' .. VERSION)
local buttonParam = {
click_function = 'drawBoxes',
label = 'Highlight\nPlayers',
function_owner = self,
position = {0, 0.3, -1.1},
rotation = {0, 0, 0},
width = 600,
height = 400,
font_size = 120,
scale = {0.25,0.25,0.25}
}
self.createButton(buttonParam)
if not (saveString == '') then
local save = JSON.decode(saveString)
lineTable = save['lt']
end
end
function onSave()
local save = {}
save['lt'] = lineTable
local saveString = JSON.encode(save)
return saveString
end
function addSegment(point1, point2)
local lineData =
{
points = {point1, point2},
color = 'Red',
thickness = 0.01,
rotation = {0,180,0}
}
table.insert(lineTable, lineData)
end
function addBox(id)
local x = id % X_WIDTH
if x == 0 then x = 10 end
local z = math.floor((id-1) / X_WIDTH) + 1
local p1 = {X_C[x], 0.3, Z_C[z]}
local p2 = {X_C[x+1], 0.3, Z_C[z]}
local p3 = {X_C[x+1], 0.3, Z_C[z+1]}
local p4 = {X_C[x], 0.3, Z_C[z+1]}
addSegment(p1, p2)
addSegment(p2, p3)
addSegment(p3, p4)
addSegment(p4, p1)
end
function drawBoxes()
local started = Global.getVar('started')
if not started then
lineTable = {}
local allObjects = getAllObjects()
for k,v in pairs(allObjects) do
for i = 1, #PLAYERS do
if string.match(v.getName(), PLAYERS[i]) and not string.match(v.getName(), 'Bingo') then
addBox(i)
end
end
end
self.setVectorLines(lineTable)
else
self.setVectorLines(lineTable)
end
end