diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index bb7ba7f7f..955c7e599 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -114,11 +114,11 @@ always_fly_fast (Always fly fast) bool true # the place button. # # Requires: keyboard_mouse -repeat_place_time (Place repetition interval) float 0.25 0.15 2.0 +repeat_place_time (Place repetition interval) float 0.25 0.16 2.0 # The minimum time in seconds it takes between digging nodes when holding # the dig button. -repeat_dig_time (Dig repetition interval) float 0.15 0.15 2.0 +repeat_dig_time (Minimum dig repetition interval) float 0.0 0.0 2.0 # Automatically jump up single-node obstacles. autojump (Automatic jumping) bool false diff --git a/doc/lua_api.md b/doc/lua_api.md index ee1f4060b..a749b337e 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -2352,9 +2352,12 @@ for this group, and unable to dig the rating `1`, which is the toughest. Unless there is a matching group that enables digging otherwise. If the result digging time is 0, a delay of 0.15 seconds is added between -digging nodes; If the player releases LMB after digging, this delay is set to 0, +digging nodes. If the player releases LMB after digging, this delay is set to 0, i.e. players can more quickly click the nodes away instead of holding LMB. +This extra delay is not applied in case of a digging time between 0 and 0.15, +so a digging time of 0.01 is actually faster than a digging time of 0. + ### Damage groups List of damage for groups of entities. See [Entity damage mechanism]. diff --git a/games/devtest/mods/basetools/init.lua b/games/devtest/mods/basetools/init.lua index aa91d5e92..17e53c1fe 100644 --- a/games/devtest/mods/basetools/init.lua +++ b/games/devtest/mods/basetools/init.lua @@ -71,7 +71,7 @@ end -- Mese Pickaxe: special tool that digs "everything" instantly minetest.register_tool("basetools:pick_mese", { description = "Mese Pickaxe".."\n".. - "Digs diggable nodes instantly", + "Digs diggable nodes instantly.", inventory_image = "basetools_mesepick.png", tool_capabilities = { full_punch_interval = 1.0, @@ -88,6 +88,28 @@ minetest.register_tool("basetools:pick_mese", { }) +-- A variant of the mese pickaxe that is not affected by the 0.15s digging delay +minetest.register_tool("basetools:pick_mese_no_delay", { + description = "Mese Pickaxe (no delay)".."\n".. + "Digs diggable nodes instantly.".."\n".. + "There is no delay between digging each node,\n".. + 'but the "repeat_dig_time" setting is still respected.', + inventory_image = "basetools_mesepick_no_delay.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + cracky={times={[1]=0.001, [2]=0.001, [3]=0.001}, maxlevel=255}, + crumbly={times={[1]=0.001, [2]=0.001, [3]=0.001}, maxlevel=255}, + snappy={times={[1]=0.001, [2]=0.001, [3]=0.001}, maxlevel=255}, + choppy={times={[1]=0.001, [2]=0.001, [3]=0.001}, maxlevel=255}, + dig_immediate={times={[1]=0.001, [2]=0.001, [3]=0.001}, maxlevel=255}, + }, + damage_groups = {fleshy=100}, + }, +}) + + -- -- Pickaxes: Dig cracky -- diff --git a/games/devtest/mods/basetools/textures/basetools_mesepick_no_delay.png b/games/devtest/mods/basetools/textures/basetools_mesepick_no_delay.png new file mode 100644 index 000000000..5a7db7e0a Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_mesepick_no_delay.png differ diff --git a/src/client/game.cpp b/src/client/game.cpp index 88892beb5..3dd829d53 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3987,8 +3987,12 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos, runData.nodig_delay_timer = runData.dig_time_complete / (float)crack_animation_length; - // Don't add a corresponding delay to very time consuming nodes. - runData.nodig_delay_timer = std::min(runData.nodig_delay_timer, 0.3f); + // We don't want a corresponding delay to very time consuming nodes + // and nodes without digging time (e.g. torches) get a fixed delay. + if (runData.nodig_delay_timer > 0.3f) + runData.nodig_delay_timer = 0.3f; + else if (runData.dig_instantly) + runData.nodig_delay_timer = 0.15f; // Ensure that the delay between breaking nodes // (dig_time_complete + nodig_delay_timer) is at least the @@ -4392,8 +4396,8 @@ void Game::readSettings() m_cache_enable_fog = g_settings->getBool("enable_fog"); m_cache_mouse_sensitivity = g_settings->getFloat("mouse_sensitivity", 0.001f, 10.0f); m_cache_joystick_frustum_sensitivity = std::max(g_settings->getFloat("joystick_frustum_sensitivity"), 0.001f); - m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.15f, 2.0f); - m_repeat_dig_time = g_settings->getFloat("repeat_dig_time", 0.15f, 2.0f); + m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.16f, 2.0f); + m_repeat_dig_time = g_settings->getFloat("repeat_dig_time", 0.0f, 2.0f); m_cache_enable_noclip = g_settings->getBool("noclip"); m_cache_enable_free_move = g_settings->getBool("free_move"); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 13b323960..ca89b642d 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -359,7 +359,7 @@ void set_default_settings() settings->setDefault("invert_hotbar_mouse_wheel", "false"); settings->setDefault("mouse_sensitivity", "0.2"); settings->setDefault("repeat_place_time", "0.25"); - settings->setDefault("repeat_dig_time", "0.15"); + settings->setDefault("repeat_dig_time", "0.0"); settings->setDefault("safe_dig_and_place", "false"); settings->setDefault("random_input", "false"); settings->setDefault("aux1_descends", "false");