]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/environment.cpp
new hotbar, more minecraft-like
[dragonfireclient.git] / src / environment.cpp
index b1722ee3fd7cc54109ca3bcb5bf3533129b1a59f..07437ec400057dc175d60622eea739812c7c4699 100644 (file)
@@ -67,10 +67,15 @@ void Environment::step(float dtime)
        }
        //playerspeed.stop();
        
+       /*
+               Maximum position increment
+       */
+       //f32 position_max_increment = 0.05*BS;
+       f32 position_max_increment = 0.1*BS;
+
        // Maximum time increment (for collision detection etc)
-       // Allow 0.1 blocks per increment
        // time = distance / speed
-       f32 dtime_max_increment = 0.1*BS / maximum_player_speed;
+       f32 dtime_max_increment = position_max_increment / maximum_player_speed;
        // Maximum time increment is 10ms or lower
        if(dtime_max_increment > 0.01)
                dtime_max_increment = 0.01;
@@ -118,9 +123,9 @@ void Environment::step(float dtime)
                                /*
                                        Apply water resistance
                                */
-                               if(player->in_water)
+                               if(player->in_water_stable || player->in_water)
                                {
-                                       f32 max_down = 1.0*BS;
+                                       f32 max_down = 2.0*BS;
                                        if(speed.Y < -max_down) speed.Y = -max_down;
 
                                        f32 max = 2.5*BS;
@@ -137,7 +142,7 @@ void Environment::step(float dtime)
                                Move the player.
                                For local player, this also calculates collision detection.
                        */
-                       player->move(dtime_part, *m_map);
+                       player->move(dtime_part, *m_map, position_max_increment);
                        
                        /*
                                Update lighting on remote players on client
@@ -155,27 +160,30 @@ void Environment::step(float dtime)
                        /*
                                Add footsteps to grass
                        */
-                       // Get node that is at BS/4 under player
-                       v3s16 bottompos = floatToInt(playerpos + v3f(0,-BS/4,0));
-                       try{
-                               MapNode n = m_map->getNode(bottompos);
-                               if(n.d == CONTENT_GRASS)
-                               {
-                                       n.d = CONTENT_GRASS_FOOTSTEPS;
-                                       m_map->setNode(bottompos, n);
-#ifndef SERVER
-                                       // Update mesh on client
-                                       if(m_map->mapType() == MAPTYPE_CLIENT)
+                       if(g_settings.getBool("footprints"))
+                       {
+                               // Get node that is at BS/4 under player
+                               v3s16 bottompos = floatToInt(playerpos + v3f(0,-BS/4,0));
+                               try{
+                                       MapNode n = m_map->getNode(bottompos);
+                                       if(n.d == CONTENT_GRASS)
                                        {
-                                               v3s16 p_blocks = getNodeBlockPos(bottompos);
-                                               MapBlock *b = m_map->getBlockNoCreate(p_blocks);
-                                               b->updateMesh(m_daynight_ratio);
-                                       }
+                                               n.d = CONTENT_GRASS_FOOTSTEPS;
+                                               m_map->setNode(bottompos, n);
+#ifndef SERVER
+                                               // Update mesh on client
+                                               if(m_map->mapType() == MAPTYPE_CLIENT)
+                                               {
+                                                       v3s16 p_blocks = getNodeBlockPos(bottompos);
+                                                       MapBlock *b = m_map->getBlockNoCreate(p_blocks);
+                                                       b->updateMesh(m_daynight_ratio);
+                                               }
 #endif
+                                       }
+                               }
+                               catch(InvalidPositionException &e)
+                               {
                                }
-                       }
-                       catch(InvalidPositionException &e)
-                       {
                        }
                }
        }