-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodinfo.lua
285 lines (241 loc) · 7.45 KB
/
modinfo.lua
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
name = "Auto-Join"
version = "0.9.0-alpha"
description = [[Version: ]] .. version .. "\n\n" ..
[[Adds "Auto-Join" and "Rejoin" buttons.]] .. "\n\n" ..
[[The first one allows continuous reconnections to the selected server until joining, and ]] ..
[[the second - rejoin the last server.]]
author = "Depressed DST Modders"
api_version = 10
forumthread = ""
priority = 0
icon = "modicon.tex"
icon_atlas = "modicon.xml"
all_clients_require_mod = false
client_only_mod = true
dont_starve_compatible = false
dst_compatible = true
reign_of_giants_compatible = false
shipwrecked_compatible = false
folder_name = folder_name or "mod-auto-join"
if not folder_name:find("workshop-") then
name = name .. " (dev)"
end
--
-- Configuration
--
local function AddConfig(name, label, hover, options, default)
return { label = label, name = name, options = options, default = default, hover = hover or "" }
end
local function AddBooleanConfig(name, label, hover, default)
default = default == nil and true or default
return AddConfig(name, label, hover, {
{ description = "Enabled", data = true },
{ description = "Disabled", data = false },
}, default)
end
local function AddKeyListConfig(name, label, hover, default)
if default == nil then
default = false
end
-- helpers
local function AddDisabled(t)
t[#t + 1] = { description = "Disabled", data = false }
end
local function AddKey(t, key)
t[#t + 1] = { description = key, data = "KEY_" .. key:gsub(" ", ""):upper() }
end
local function AddKeysByName(t, names)
for i = 1, #names do
AddKey(t, names[i])
end
end
local function AddAlphabetKeys(t)
local string = ""
for i = 1, 26 do
AddKey(t, string.char(64 + i))
end
end
local function AddTypewriterNumberKeys(t)
for i = 1, 10 do
AddKey(t, "" .. (i % 10))
end
end
local function AddTypewriterModifierKeys(t)
AddKeysByName(t, { "Alt", "Ctrl", "Shift" })
end
local function AddTypewriterKeys(t)
AddAlphabetKeys(t)
AddKeysByName(t, {
"Slash",
"Backslash",
"Period",
"Semicolon",
"Left Bracket",
"Right Bracket",
})
AddKeysByName(t, { "Space", "Tab", "Backspace", "Enter" })
AddTypewriterModifierKeys(t)
AddKeysByName(t, { "Tilde" })
AddTypewriterNumberKeys(t)
AddKeysByName(t, { "Minus", "Equals" })
end
local function AddFunctionKeys(t)
for i = 1, 12 do
AddKey(t, "F" .. i)
end
end
local function AddArrowKeys(t)
AddKeysByName(t, { "Up", "Down", "Left", "Right" })
end
local function AddNavigationKeys(t)
AddKeysByName(t, { "Insert", "Delete", "Home", "End", "Page Up", "Page Down" })
end
-- key list
local list = {}
AddDisabled(list)
AddArrowKeys(list)
AddFunctionKeys(list)
AddTypewriterKeys(list)
AddNavigationKeys(list)
AddKeysByName(list, { "Escape", "Pause", "Print" })
return AddConfig(name, label, hover, list, default)
end
local function AddSection(title)
return AddConfig("", title, nil, { { description = "", data = 0 } }, 0)
end
configuration_options = {
--
-- General
--
AddSection("General"),
AddBooleanConfig(
"disable_music",
"Disable music",
"When enabled, disables music while attempting to join"
),
AddConfig(
"notification_sound",
"Notification sound",
"Plays the following sound if connection succeeds",
{
{ description = "Disabled", data = false },
{ description = "Beefalo Horn", data = "dontstarve/common/Horn_beefalo" },
{ description = "Splumonkey Taunt", data = "dontstarve/creatures/monkey/taunt" },
{ description = "Batilisk Taunt", data = "dontstarve/creatures/bat/taunt" },
},
false
),
AddConfig(
"waiting_time",
"Waiting time",
"The time between reconnection attempts",
{
{ description = "5s", data = 5 },
{ description = "10s", data = 10 },
{ description = "15s", data = 15 },
{ description = "20s", data = 20 },
{ description = "25s", data = 25 },
{ description = "30s", data = 30 },
{ description = "35s", data = 35 },
{ description = "40s", data = 40 },
{ description = "45s", data = 45 },
{ description = "50s", data = 50 },
{ description = "55s", data = 55 },
{ description = "1m", data = 60 },
},
15
),
--
-- Indicator
--
AddSection("Indicator"),
AddBooleanConfig(
"indicator",
"Indicator",
"When enabled, adds a corner indicator on the supported screens"
),
AddConfig(
"indicator_position",
"Indicator position",
"Indicator position on the screen",
{
{ description = "Top Left", data = 1 },
{ description = "Top Right", data = 2 },
{ description = "Bottom Right", data = 3 },
{ description = "Bottom Left", data = 4 },
},
2
),
AddConfig(
"indicator_padding",
"Indicator padding",
"Indicator padding from the screen edges",
{
{ description = "5", data = 5 },
{ description = "10", data = 10 },
{ description = "15", data = 15 },
{ description = "20", data = 20 },
},
10
),
AddConfig(
"indicator_scale",
"Indicator scale",
"Indicator scale on the screen",
{
{ description = "1", data = 1 },
{ description = "1.1", data = 1.1 },
{ description = "1.2", data = 1.2 },
{ description = "1.3", data = 1.3 },
{ description = "1.4", data = 1.4 },
{ description = "1.5", data = 1.5 },
},
1.3
),
--
-- Rejoin
--
AddSection("Rejoin"),
AddKeyListConfig(
"key_rejoin",
"Rejoin key",
"Key used for toggling the rejoin functionality.\nAvailable on the main and pause screens",
"KEY_CTRL"
),
AddConfig(
"rejoin_initial_wait",
"Rejoin initial wait",
[[Initial wait in seconds to retrieve a list of servers before rejoining.]] .. "\n" ..
[[Change based on your network speed]],
{
{ description = "1s", data = 1 },
{ description = "2s", data = 2 },
{ description = "3s", data = 3 },
{ description = "5s", data = 5 },
{ description = "10s", data = 10 },
},
3
),
AddBooleanConfig(
"rejoin_main_screen_button",
"Rejoin main screen button",
[[When enabled, adds "Rejoin" button in the multiplayer main screen.]] .. "\n" ..
[[On Windows, replaces the last "Games" button']]
),
AddBooleanConfig(
"rejoin_pause_screen_button",
"Rejoin pause screen button",
[[When enabled, adds "Rejoin" button in the pause screen.]] .. "\n" ..
[[Replaces "Disconnect" while holding the rejoin key]]
),
--
-- Other
--
AddSection("Other"),
AddBooleanConfig(
"debug",
"Debug",
"When enabled, displays debug data in the console.\nUsed mainly for development",
false
),
}