3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "constants.h"
27 void set_default_settings(Settings *settings)
31 settings->setDefault("name", "");
34 settings->setDefault("remote_port", "30000");
35 settings->setDefault("keymap_forward", "KEY_KEY_W");
36 settings->setDefault("keymap_backward", "KEY_KEY_S");
37 settings->setDefault("keymap_left", "KEY_KEY_A");
38 settings->setDefault("keymap_right", "KEY_KEY_D");
39 settings->setDefault("keymap_jump", "KEY_SPACE");
40 settings->setDefault("keymap_sneak", "KEY_LSHIFT");
41 settings->setDefault("keymap_drop", "KEY_KEY_Q");
42 settings->setDefault("keymap_inventory", "KEY_KEY_I");
43 settings->setDefault("keymap_special1", "KEY_KEY_E");
44 settings->setDefault("keymap_chat", "KEY_KEY_T");
45 settings->setDefault("keymap_cmd", "/");
46 settings->setDefault("keymap_minimap", "KEY_F9");
47 settings->setDefault("keymap_console", "KEY_F10");
48 settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
49 settings->setDefault("keymap_freemove", "KEY_KEY_K");
50 settings->setDefault("keymap_fastmove", "KEY_KEY_J");
51 settings->setDefault("keymap_noclip", "KEY_KEY_H");
52 settings->setDefault("keymap_cinematic", "KEY_F8");
53 settings->setDefault("keymap_screenshot", "KEY_F12");
54 settings->setDefault("keymap_toggle_hud", "KEY_F1");
55 settings->setDefault("keymap_toggle_chat", "KEY_F2");
56 settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3");
57 settings->setDefault("keymap_toggle_update_camera",
63 settings->setDefault("keymap_toggle_debug", "KEY_F5");
64 settings->setDefault("keymap_toggle_profiler", "KEY_F6");
65 settings->setDefault("keymap_camera_mode", "KEY_F7");
66 settings->setDefault("keymap_increase_viewing_range_min", "+");
67 settings->setDefault("keymap_decrease_viewing_range_min", "-");
68 settings->setDefault("enable_build_where_you_stand", "false" );
69 settings->setDefault("3d_mode", "none");
70 settings->setDefault("3d_paralax_strength", "0.025");
71 settings->setDefault("aux1_descends", "false");
72 settings->setDefault("doubletap_jump", "false");
73 settings->setDefault("always_fly_fast", "true");
74 settings->setDefault("directional_colored_fog", "true");
75 settings->setDefault("tooltip_show_delay", "400");
77 // Some (temporary) keys for debugging
78 settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
79 settings->setDefault("keymap_quicktune_prev", "KEY_HOME");
80 settings->setDefault("keymap_quicktune_next", "KEY_END");
81 settings->setDefault("keymap_quicktune_dec", "KEY_NEXT");
82 settings->setDefault("keymap_quicktune_inc", "KEY_PRIOR");
84 // Show debug info by default?
86 settings->setDefault("show_debug", "false");
88 settings->setDefault("show_debug", "true");
91 settings->setDefault("wanted_fps", "30");
92 settings->setDefault("fps_max", "60");
93 settings->setDefault("pause_fps_max", "20");
94 // A bit more than the server will send around the player, to make fog blend well
95 settings->setDefault("viewing_range_nodes_max", "240");
96 settings->setDefault("viewing_range_nodes_min", "35");
97 settings->setDefault("map_generation_limit", "31000");
98 settings->setDefault("screenW", "800");
99 settings->setDefault("screenH", "600");
100 settings->setDefault("fullscreen", "false");
101 settings->setDefault("fullscreen_bpp", "24");
102 settings->setDefault("fsaa", "0");
103 settings->setDefault("vsync", "false");
104 settings->setDefault("address", "");
105 settings->setDefault("random_input", "false");
106 settings->setDefault("client_unload_unused_data_timeout", "600");
107 settings->setDefault("client_mapblock_limit", "1000");
108 settings->setDefault("enable_fog", "true");
109 settings->setDefault("fov", "72");
110 settings->setDefault("view_bobbing", "true");
111 settings->setDefault("new_style_water", "false");
112 settings->setDefault("leaves_style", "fancy");
113 settings->setDefault("connected_glass", "false");
114 settings->setDefault("smooth_lighting", "true");
115 settings->setDefault("display_gamma", "1.8");
116 settings->setDefault("texture_path", "");
117 settings->setDefault("shader_path", "");
118 settings->setDefault("video_driver", "opengl");
119 settings->setDefault("free_move", "false");
120 settings->setDefault("noclip", "false");
121 settings->setDefault("continuous_forward", "false");
122 settings->setDefault("cinematic", "false");
123 settings->setDefault("camera_smoothing", "0");
124 settings->setDefault("cinematic_camera_smoothing", "0.7");
125 settings->setDefault("fast_move", "false");
126 settings->setDefault("invert_mouse", "false");
127 settings->setDefault("enable_clouds", "true");
128 settings->setDefault("screenshot_path", ".");
129 settings->setDefault("view_bobbing_amount", "1.0");
130 settings->setDefault("fall_bobbing_amount", "0.0");
131 settings->setDefault("enable_3d_clouds", "true");
132 settings->setDefault("cloud_height", "120");
133 settings->setDefault("cloud_radius", "12");
134 settings->setDefault("menu_clouds", "true");
135 settings->setDefault("opaque_water", "false");
136 settings->setDefault("console_color", "(0,0,0)");
137 settings->setDefault("console_alpha", "200");
138 settings->setDefault("selectionbox_color", "(0,0,0)");
139 settings->setDefault("enable_node_highlighting", "false");
140 settings->setDefault("crosshair_color", "(255,255,255)");
141 settings->setDefault("crosshair_alpha", "255");
142 settings->setDefault("hud_scaling", "1.0");
143 settings->setDefault("gui_scaling", "1.0");
144 settings->setDefault("gui_scaling_filter", "false");
145 settings->setDefault("gui_scaling_filter_txr2img", "true");
146 settings->setDefault("mouse_sensitivity", "0.2");
147 settings->setDefault("enable_sound", "true");
148 settings->setDefault("sound_volume", "0.8");
149 settings->setDefault("desynchronize_mapblock_texture_animation", "true");
150 settings->setDefault("selectionbox_width","2");
151 settings->setDefault("hud_hotbar_max_width","1.0");
152 settings->setDefault("enable_local_map_saving", "false");
154 settings->setDefault("mip_map", "false");
155 settings->setDefault("anisotropic_filter", "false");
156 settings->setDefault("bilinear_filter", "false");
157 settings->setDefault("trilinear_filter", "false");
158 settings->setDefault("texture_clean_transparent", "false");
159 settings->setDefault("texture_min_size", "64");
160 settings->setDefault("preload_item_visuals", "false");
161 settings->setDefault("enable_bumpmapping", "false");
162 settings->setDefault("enable_parallax_occlusion", "false");
163 settings->setDefault("generate_normalmaps", "false");
164 settings->setDefault("normalmaps_strength", "0.6");
165 settings->setDefault("normalmaps_smooth", "1");
166 settings->setDefault("parallax_occlusion_mode", "1");
167 settings->setDefault("parallax_occlusion_iterations", "4");
168 settings->setDefault("parallax_occlusion_scale", "0.08");
169 settings->setDefault("parallax_occlusion_bias", "0.04");
170 settings->setDefault("enable_waving_water", "false");
171 settings->setDefault("water_wave_height", "1.0");
172 settings->setDefault("water_wave_length", "20.0");
173 settings->setDefault("water_wave_speed", "5.0");
174 settings->setDefault("enable_waving_leaves", "false");
175 settings->setDefault("enable_waving_plants", "false");
176 settings->setDefault("ambient_occlusion_gamma", "2.2");
177 settings->setDefault("enable_shaders", "true");
178 settings->setDefault("repeat_rightclick_time", "0.25");
179 settings->setDefault("enable_particles", "true");
180 settings->setDefault("enable_mesh_cache", "false");
182 settings->setDefault("enable_minimap", "true");
183 settings->setDefault("minimap_shape_round", "true");
184 settings->setDefault("minimap_double_scan_height", "true");
186 settings->setDefault("curl_timeout", "5000");
187 settings->setDefault("curl_parallel_limit", "8");
188 settings->setDefault("curl_file_download_timeout", "300000");
189 settings->setDefault("curl_verify_cert", "true");
191 settings->setDefault("enable_remote_media_server", "true");
193 settings->setDefault("serverlist_url", "servers.minetest.net");
194 settings->setDefault("serverlist_file", "favoriteservers.txt");
195 settings->setDefault("server_announce", "false");
196 settings->setDefault("server_url", "");
197 settings->setDefault("server_address", "");
198 settings->setDefault("server_name", "");
199 settings->setDefault("server_description", "");
202 settings->setDefault("freetype", "true");
203 settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "liberationsans.ttf"));
204 settings->setDefault("font_shadow", "1");
205 settings->setDefault("font_shadow_alpha", "128");
206 settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
207 settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf"));
209 settings->setDefault("fallback_font_shadow", "1");
210 settings->setDefault("fallback_font_shadow_alpha", "128");
212 std::stringstream fontsize;
213 fontsize << TTF_DEFAULT_FONT_SIZE;
215 settings->setDefault("font_size", fontsize.str());
216 settings->setDefault("mono_font_size", fontsize.str());
217 settings->setDefault("fallback_font_size", fontsize.str());
219 settings->setDefault("freetype", "false");
220 settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "lucida_sans"));
221 settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans"));
223 std::stringstream fontsize;
224 fontsize << DEFAULT_FONT_SIZE;
226 settings->setDefault("font_size", fontsize.str());
227 settings->setDefault("mono_font_size", fontsize.str());
231 // "map-dir" doesn't exist by default.
232 settings->setDefault("workaround_window_size","5");
233 settings->setDefault("max_packets_per_iteration","1024");
234 settings->setDefault("port", "30000");
235 settings->setDefault("bind_address", "");
236 settings->setDefault("default_game", "minetest");
237 settings->setDefault("motd", "");
238 settings->setDefault("max_users", "15");
239 settings->setDefault("strict_protocol_version_checking", "false");
240 settings->setDefault("creative_mode", "false");
241 settings->setDefault("enable_damage", "true");
242 settings->setDefault("fixed_map_seed", "");
243 settings->setDefault("give_initial_stuff", "false");
244 settings->setDefault("default_password", "");
245 settings->setDefault("default_privs", "interact, shout");
246 settings->setDefault("player_transfer_distance", "0");
247 settings->setDefault("enable_pvp", "true");
248 settings->setDefault("disallow_empty_password", "false");
249 settings->setDefault("disable_anticheat", "false");
250 settings->setDefault("enable_rollback_recording", "false");
252 settings->setDefault("deprecated_lua_api_handling", "legacy");
254 settings->setDefault("deprecated_lua_api_handling", "log");
257 settings->setDefault("kick_msg_shutdown", "Server shutting down.");
258 settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
259 settings->setDefault("ask_reconnect_on_crash", "false");
261 settings->setDefault("profiler_print_interval", "0");
262 settings->setDefault("enable_mapgen_debug_info", "false");
263 settings->setDefault("active_object_send_range_blocks", "3");
264 settings->setDefault("active_block_range", "2");
265 //settings->setDefault("max_simultaneous_block_sends_per_client", "1");
266 // This causes frametime jitter on client side, or does it?
267 settings->setDefault("max_simultaneous_block_sends_per_client", "10");
268 settings->setDefault("max_simultaneous_block_sends_server_total", "40");
269 settings->setDefault("max_block_send_distance", "9");
270 settings->setDefault("max_block_generate_distance", "7");
271 settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096");
272 settings->setDefault("time_send_interval", "5");
273 settings->setDefault("time_speed", "72");
274 settings->setDefault("year_days", "30");
275 settings->setDefault("server_unload_unused_data_timeout", "29");
276 settings->setDefault("max_objects_per_block", "49");
277 settings->setDefault("server_map_save_interval", "5.3");
278 settings->setDefault("sqlite_synchronous", "2");
279 settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
280 settings->setDefault("dedicated_server_step", "0.1");
281 settings->setDefault("ignore_world_load_errors", "false");
282 settings->setDefault("remote_media", "");
283 settings->setDefault("debug_log_level", "2");
284 settings->setDefault("emergequeue_limit_total", "256");
285 settings->setDefault("emergequeue_limit_diskonly", "32");
286 settings->setDefault("emergequeue_limit_generate", "32");
287 settings->setDefault("num_emerge_threads", "1");
288 settings->setDefault("secure.enable_security", "false");
289 settings->setDefault("secure.trusted_mods", "");
292 settings->setDefault("movement_acceleration_default", "3");
293 settings->setDefault("movement_acceleration_air", "2");
294 settings->setDefault("movement_acceleration_fast", "10");
295 settings->setDefault("movement_speed_walk", "4");
296 settings->setDefault("movement_speed_crouch", "1.35");
297 settings->setDefault("movement_speed_fast", "20");
298 settings->setDefault("movement_speed_climb", "2");
299 settings->setDefault("movement_speed_jump", "6.5");
300 settings->setDefault("movement_liquid_fluidity", "1");
301 settings->setDefault("movement_liquid_fluidity_smooth", "0.5");
302 settings->setDefault("movement_liquid_sink", "10");
303 settings->setDefault("movement_gravity", "9.81");
306 settings->setDefault("liquid_loop_max", "100000");
307 settings->setDefault("liquid_queue_purge_time", "0");
308 settings->setDefault("liquid_update", "1.0");
311 settings->setDefault("mg_name", "v6");
312 settings->setDefault("water_level", "1");
313 settings->setDefault("chunksize", "5");
314 settings->setDefault("mg_flags", "dungeons");
315 settings->setDefault("mgv6_spflags", "jungles, snowbiomes");
316 settings->setDefault("enable_floating_dungeons", "true");
319 settings->setDefault("enable_ipv6", "true");
320 settings->setDefault("ipv6_server", "false");
322 settings->setDefault("main_menu_path", "");
323 settings->setDefault("main_menu_mod_mgr", "1");
324 settings->setDefault("main_menu_game_mgr", "0");
325 settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/");
326 settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/");
327 settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
329 settings->setDefault("high_precision_fpu", "true");
331 settings->setDefault("language", "");
334 settings->setDefault("screenW", "0");
335 settings->setDefault("screenH", "0");
336 settings->setDefault("enable_shaders", "false");
337 settings->setDefault("fullscreen", "true");
338 settings->setDefault("enable_particles", "false");
339 settings->setDefault("video_driver", "ogles1");
340 settings->setDefault("touchtarget", "true");
341 settings->setDefault("TMPFolder","/sdcard/" PROJECT_NAME_C "/tmp/");
342 settings->setDefault("touchscreen_threshold","20");
343 settings->setDefault("smooth_lighting", "false");
344 settings->setDefault("max_simultaneous_block_sends_per_client", "3");
345 settings->setDefault("emergequeue_limit_diskonly", "8");
346 settings->setDefault("emergequeue_limit_generate", "8");
347 settings->setDefault("preload_item_visuals", "false");
349 settings->setDefault("viewing_range_nodes_max", "50");
350 settings->setDefault("viewing_range_nodes_min", "20");
351 settings->setDefault("inventory_image_hack", "false");
353 //check for device with small screen
354 float x_inches = ((double) porting::getDisplaySize().X /
355 (160 * porting::getDisplayDensity()));
356 if (x_inches < 3.5) {
357 settings->setDefault("hud_scaling", "0.6");
359 else if (x_inches < 4.5) {
360 settings->setDefault("hud_scaling", "0.7");
362 settings->setDefault("curl_verify_cert","false");
364 settings->setDefault("screen_dpi", "72");
368 void override_default_settings(Settings *settings, Settings *from)
370 std::vector<std::string> names = from->getNames();
371 for(size_t i=0; i<names.size(); i++){
372 const std::string &name = names[i];
373 settings->setDefault(name, from->get(name));