diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-11 12:28:41 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-11 12:28:41 +0200 |
commit | af33b3b338b50c5a1c3ba5f701683fbc7ceeba1d (patch) | |
tree | 9449cd58ba78857f1e139b7f77fa363c6890e057 | |
parent | a87d19cd7ed3a4ca8b320ce573f3a5e1649ed561 (diff) | |
download | minetest-af33b3b338b50c5a1c3ba5f701683fbc7ceeba1d.tar.gz minetest-af33b3b338b50c5a1c3ba5f701683fbc7ceeba1d.tar.bz2 minetest-af33b3b338b50c5a1c3ba5f701683fbc7ceeba1d.zip |
Limit crack update speed
-rw-r--r-- | src/game.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index c45cf47a3..0e3f570f4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1031,6 +1031,8 @@ void the_game( const float object_hit_delay = 0.2; float object_hit_delay_timer = 0.0; float time_from_last_punch = 10; + + float crack_update_timer = 0.0; bool invert_mouse = g_settings->getBool("invert_mouse"); @@ -1177,6 +1179,7 @@ void the_game( if(object_hit_delay_timer >= 0) object_hit_delay_timer -= dtime; time_from_last_punch += dtime; + crack_update_timer += dtime; g_profiler->add("Elapsed time", dtime); g_profiler->avg("FPS", 1./dtime); @@ -1974,9 +1977,14 @@ void the_game( } else if(dig_index < CRACK_ANIMATION_LENGTH) { - //TimeTaker timer("client.setTempMod"); - //infostream<<"dig_index="<<dig_index<<std::endl; - client.setTempMod(nodepos, NodeMod(NODEMOD_CRACK, dig_index)); + // Limit crack update speed + if(crack_update_timer >= 0.1){ + crack_update_timer = 0.0; + //infostream<<"dig_index="<<dig_index<<std::endl; + //TimeTaker timer("client.setTempMod"); + client.setTempMod(nodepos, + NodeMod(NODEMOD_CRACK, dig_index)); + } } else { |