mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Add repeat_dig_time setting (#14295)
This commit is contained in:
parent
d307d01b18
commit
bb6782ca58
@ -114,7 +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.16 2
|
||||
repeat_place_time (Place repetition interval) float 0.25 0.15 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
|
||||
|
||||
# Automatically jump up single-node obstacles.
|
||||
autojump (Automatic jumping) bool false
|
||||
|
@ -939,6 +939,7 @@ private:
|
||||
f32 m_cache_mouse_sensitivity;
|
||||
f32 m_cache_joystick_frustum_sensitivity;
|
||||
f32 m_repeat_place_time;
|
||||
f32 m_repeat_dig_time;
|
||||
f32 m_cache_cam_smoothing;
|
||||
|
||||
bool m_invert_mouse;
|
||||
@ -985,6 +986,8 @@ Game::Game() :
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("repeat_place_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("repeat_dig_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("noclip",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("free_move",
|
||||
@ -1051,6 +1054,8 @@ Game::~Game()
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("repeat_place_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("repeat_dig_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("noclip",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("free_move",
|
||||
@ -3912,12 +3917,14 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
|
||||
runData.nodig_delay_timer =
|
||||
runData.dig_time_complete / (float)crack_animation_length;
|
||||
|
||||
// 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.3)
|
||||
runData.nodig_delay_timer = 0.3;
|
||||
else if (runData.dig_instantly)
|
||||
runData.nodig_delay_timer = 0.15;
|
||||
// Don't add a corresponding delay to very time consuming nodes.
|
||||
runData.nodig_delay_timer = std::min(runData.nodig_delay_timer, 0.3f);
|
||||
|
||||
// Ensure that the delay between breaking nodes
|
||||
// (dig_time_complete + nodig_delay_timer) is at least the
|
||||
// value of the repeat_dig_time setting.
|
||||
runData.nodig_delay_timer = std::max(runData.nodig_delay_timer,
|
||||
m_repeat_dig_time - runData.dig_time_complete);
|
||||
|
||||
if (client->modsLoaded() &&
|
||||
client->getScript()->on_dignode(nodepos, n)) {
|
||||
@ -4315,7 +4322,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.16f, 2.0);
|
||||
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_cache_enable_noclip = g_settings->getBool("noclip");
|
||||
m_cache_enable_free_move = g_settings->getBool("free_move");
|
||||
|
@ -301,6 +301,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("safe_dig_and_place", "false");
|
||||
settings->setDefault("random_input", "false");
|
||||
settings->setDefault("aux1_descends", "false");
|
||||
|
Loading…
Reference in New Issue
Block a user