1
0
Fork 0

Limit crack update speed

mutilcraft-mt53
Perttu Ahola 2012-03-11 12:28:41 +02:00
parent a87d19cd7e
commit af33b3b338
1 changed files with 11 additions and 3 deletions

View File

@ -1032,6 +1032,8 @@ void the_game(
float object_hit_delay_timer = 0.0; float object_hit_delay_timer = 0.0;
float time_from_last_punch = 10; float time_from_last_punch = 10;
float crack_update_timer = 0.0;
bool invert_mouse = g_settings->getBool("invert_mouse"); bool invert_mouse = g_settings->getBool("invert_mouse");
bool respawn_menu_active = false; bool respawn_menu_active = false;
@ -1177,6 +1179,7 @@ void the_game(
if(object_hit_delay_timer >= 0) if(object_hit_delay_timer >= 0)
object_hit_delay_timer -= dtime; object_hit_delay_timer -= dtime;
time_from_last_punch += dtime; time_from_last_punch += dtime;
crack_update_timer += dtime;
g_profiler->add("Elapsed time", dtime); g_profiler->add("Elapsed time", dtime);
g_profiler->avg("FPS", 1./dtime); g_profiler->avg("FPS", 1./dtime);
@ -1974,9 +1977,14 @@ void the_game(
} }
else if(dig_index < CRACK_ANIMATION_LENGTH) else if(dig_index < CRACK_ANIMATION_LENGTH)
{ {
//TimeTaker timer("client.setTempMod"); // Limit crack update speed
if(crack_update_timer >= 0.1){
crack_update_timer = 0.0;
//infostream<<"dig_index="<<dig_index<<std::endl; //infostream<<"dig_index="<<dig_index<<std::endl;
client.setTempMod(nodepos, NodeMod(NODEMOD_CRACK, dig_index)); //TimeTaker timer("client.setTempMod");
client.setTempMod(nodepos,
NodeMod(NODEMOD_CRACK, dig_index));
}
} }
else else
{ {