Repeated right clicking when holding the right mouse button
authorJeija <norrepli@gmail.com>
Fri, 4 Jan 2013 14:19:16 +0000 (15:19 +0100)
committerPilzAdam <PilzAdam@gmx.de>
Fri, 4 Jan 2013 17:33:53 +0000 (18:33 +0100)
Configure using repeat_rightclick_time in minetest.conf

minetest.conf.example
src/defaultsettings.cpp
src/game.cpp

index 34a2acebcdd50b2d9fd39ec788bc933fae540b53..5fb4244b2d30091de983f66df288eeae35f90b6b 100644 (file)
 # (1: low level shaders; not implemented)
 # 2: enable high level shaders
 #enable_shaders = 2
+# The time in seconds it takes between repeated
+# right clicks when holding the right mouse button
+#repeat_rightclick_time = 0.25
 
 # will only work for servers which use remote_media setting
 # and only for clients compiled with cURL
index f9c942590c70b363a142f041ecd5bc806ad5b359..cac3e568a155569e467fe0a36f380470c8f514ae 100644 (file)
@@ -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");
 
index 42863ff3749a5c067193a434d91505d9a4359e54..fdb083ff1b490542ee701007b68c68a7b5a9005b 100644 (file)
@@ -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.