diff options
author | Jeija <norrepli@gmail.com> | 2013-01-04 15:19:16 +0100 |
---|---|---|
committer | PilzAdam <PilzAdam@gmx.de> | 2013-01-04 18:33:53 +0100 |
commit | b50da63852f2a2360d07cc2f1e29fc6844b15ccc (patch) | |
tree | 7eed7ae64db23162d34aa8f9d0bbfe7209491a01 /src | |
parent | 5bc14e2fe45f12cdb69d302807d05985ee5552ee (diff) | |
download | minetest-b50da63852f2a2360d07cc2f1e29fc6844b15ccc.tar.gz minetest-b50da63852f2a2360d07cc2f1e29fc6844b15ccc.tar.bz2 minetest-b50da63852f2a2360d07cc2f1e29fc6844b15ccc.zip |
Repeated right clicking when holding the right mouse button
Configure using repeat_rightclick_time in minetest.conf
Diffstat (limited to 'src')
-rw-r--r-- | src/defaultsettings.cpp | 1 | ||||
-rw-r--r-- | src/game.cpp | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index f9c942590..cac3e568a 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -121,6 +121,7 @@ void set_default_settings(Settings *settings) settings->setDefault("trilinear_filter", "false"); settings->setDefault("preload_item_visuals", "true"); settings->setDefault("enable_shaders", "2"); + settings->setDefault("repeat_rightclick_time", "0.25"); settings->setDefault("media_fetch_threads", "8"); diff --git a/src/game.cpp b/src/game.cpp index 42863ff37..fdb083ff1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1335,6 +1335,8 @@ void the_game( float time_of_day = 0; float time_of_day_smooth = 0; + float repeat_rightclick_timer = 0; + /* Shader constants */ @@ -2266,6 +2268,9 @@ void the_game( bool left_punch = false; soundmaker.m_player_leftpunch_sound.name = ""; + if(input->getRightState()) + repeat_rightclick_timer += dtime; + if(playeritem_usable && input->getLeftState()) { if(input->getLeftClicked()) @@ -2406,8 +2411,10 @@ void the_game( camera.setDigging(0); // left click animation } - if(input->getRightClicked()) + if(input->getRightClicked() || + repeat_rightclick_timer >= g_settings->getFloat("repeat_rightclick_time")) { + repeat_rightclick_timer = 0; infostream<<"Ground right-clicked"<<std::endl; // Sign special case, at least until formspec is properly implemented. |