-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings-updates.lua
59 lines (53 loc) · 2.55 KB
/
settings-updates.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
--[[ settings-updates.lua © Penguin_Spy 2023-2024
Creates the skin dropdown menu for players to choose their skin
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
]]
local skin_ids = skins_factored_INTERNAL.registered_skin_ids
-- Mark the default engineer as an available skin
-- This does not affect prototype generation during the data stage, as this is a different table
table.insert(skin_ids, 1, "engineer")
-- List all skins
log("Registered skins: " .. table.concat(skin_ids, ", "))
local skin_ids_string = table.concat(skin_ids, ";")
-- hide user settings if running in compatibility mode
local hide_settings = (mods["minime"] or mods["RitnCharacters"]) and true or false
-- Register all skin_ids as options for the dropdown
data:extend{
{ -- Actual setting for users to pick a skin
type = "string-setting",
name = "skins-factored-selected-skin",
order = "a",
setting_type = "runtime-per-user",
default_value = (#skin_ids == 2 and skin_ids[2]) or "engineer", -- Default to the only custom skin if there's just 1, or to the engineer if there's multiple
allowed_values = skin_ids,
hidden = hide_settings
},
{ -- Fake setting to smuggle the list of skins into the control stage
type = "string-setting",
name = "skins-factored-all-skins",
setting_type = "startup",
hidden = true,
default_value = skin_ids_string, -- setting both default & allowed_values forces the setting to always be this value (even when it changes after it's been saved)
allowed_values = { skin_ids_string }
},
{ -- Should the skin selector GUI display the player's current character in the GUI or the preview character? Suggested to disable in multiplayer due to latency
type = "bool-setting",
name = "skins-factored-render-character",
order = "b",
setting_type = "runtime-per-user",
default_value = true,
hidden = hide_settings
},
{ -- Should the skin selector button be added to the mod-gui flow in the top left
type = "bool-setting",
name = "skins-factored-mod-gui-button",
order = "c",
setting_type = "runtime-per-user",
default_value = true,
hidden = mods["informatron"] and true or hide_settings -- hide the setting if InformaTron is active, as the setting is ignored
}
}