-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings_orig.lua
177 lines (166 loc) · 5.33 KB
/
settings_orig.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
dofile("data/scripts/lib/mod_settings.lua") -- see this file for documentation on some of the features.
-- This file can't access other files from this or other mods in all circumstances.
-- Settings will be automatically saved.
function mod_setting_bool_custom( mod_id, gui, in_main_menu, im_id, setting )
local value = ModSettingGetNextValue( mod_setting_get_id(mod_id,setting) )
local text = setting.ui_name .. " - " .. GameTextGet( value and "$option_on" or "$option_off" )
if GuiButton( gui, 0, 0, text, im_id ) then
ModSettingSetNextValue( mod_setting_get_id(mod_id,setting), not value, false )
end
mod_setting_tooltip( mod_id, gui, in_main_menu, setting )
end
function mod_setting_change_callback( mod_id, gui, in_main_menu, setting, old_value, new_value )
print( tostring(new_value) )
end
function make_title(s)
return {
not_setting = true,
ui_fn = function(mod_id, gui, in_main_menu, im_id, setting)
GuiLayoutAddVerticalSpacing(gui, 4)
GuiTextCentered(gui, 150, 0, "---- " .. s .. " ----")
GuiLayoutAddVerticalSpacing(gui, 4)
end
}
end
local mod_id = "example" -- This should match the name of your mod's folder.
mod_settings_version = 1 -- This is a magic global that can be used to migrate settings to new mod versions. call mod_settings_get_version() before mod_settings_update() to get the old value.
mod_settings =
{
make_title("Occurance chances"),
{
id = "room_occurences_coalmine",
ui_name = "Mines", --"$biome_coalmine",
ui_description = "",
value_default = 0.7,
value_min = 0.0,
value_max = 1.3,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_excavationsite",
ui_name = "$biome_excavationsite",
ui_description = "",
value_default = 1.3,
value_min = 0.0,
value_max = 1.64,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_snowcave",
ui_name = "$biome_snowcave",
ui_description = "",
value_default = 1.2,
value_min = 0.0,
value_max = 2.73,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_snowcastle",
ui_name = "$biome_snowcastle",
ui_description = "",
value_default = 1.2,
value_min = 0.0,
value_max = 2.26,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_rainforest",
ui_name = "$biome_rainforest",
ui_description = "",
value_default = 1.2,
value_min = 0.0,
value_max = 3.99,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_vault",
ui_name = "$biome_vault",
ui_description = "",
value_default = 2.0,
value_min = 0.0,
value_max = 4.91,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_crypt",
ui_name = "$biome_crypt",
ui_description = "",
value_default = 2.5,
value_min = 0.0,
value_max = 4.74,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
{
id = "room_occurences_volcanobiome",
ui_name = "VolcanoBiome (Mod)",
ui_description = "",
value_default = 3.5,
value_min = 0.0,
value_max = 4.74,
value_display_multiplier = 1.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_NEW_GAME,
},
make_title("Misc"),
{
id = "buff_amount",
ui_name = "Buff amount",
ui_description = "How much stronger the result of 2 wand combining is",
value_default = 0.5,
value_min = 0.0,
value_max = 2.0,
value_display_multiplier = 100.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_RUNTIME,
},
{
id = "buff_amount_improved",
ui_name = "Buff amount with 2 tablets",
ui_description = "",
value_default = 0.8,
value_min = 0.0,
value_max = 3.0,
value_display_multiplier = 100.0,
value_display_formatting = "",
scope = MOD_SETTING_SCOPE_RUNTIME,
},
{
id = "reusable",
ui_name = "Reusable",
ui_description = "Makes the anvil reusable by resetting it after picking up the reward",
value_default = false,
scope = MOD_SETTING_SCOPE_RUNTIME,
},
}
-- This function is called to ensure the correct setting values are visible to the game. your mod's settings don't work if you don't have a function like this defined in settings.lua.
function ModSettingsUpdate( init_scope )
local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
mod_settings_update( mod_id, mod_settings, init_scope )
end
-- This function should return the number of visible setting UI elements.
-- Your mod's settings wont be visible in the mod settings menu if this function isn't defined correctly.
-- If your mod changes the displayed settings dynamically, you might need to implement custom logic for this function.
function ModSettingsGuiCount()
if (not DebugGetIsDevBuild()) then
return 0
end
return mod_settings_gui_count( mod_id, mod_settings )
end
-- This function is called to display the settings UI for this mod. your mod's settings wont be visible in the mod settings menu if this function isn't defined correctly.
function ModSettingsGui( gui, in_main_menu )
mod_settings_gui( mod_id, mod_settings, gui, in_main_menu )
end