Commented out debug statements again
[oweals/minetest.git] / src / environment.cpp
index 05efe9eea75e1970b61928b4b1641d3d4c46f718..80f41f9fd44905dfc6673b00c1d82853e64f30ed 100644 (file)
@@ -1512,6 +1512,11 @@ void ClientEnvironment::step(float dtime)
                Get the speed the player is going
        */
        bool is_climbing = lplayer->is_climbing;
+       
+       /*
+               Check if the player is frozen (don't apply physics)
+       */
+       bool is_frozen = lplayer->is_frozen;
 
        f32 player_speed = 0.001; // just some small value
        player_speed = lplayer->getSpeed().getLength();
@@ -1570,7 +1575,7 @@ void ClientEnvironment::step(float dtime)
                        v3f lplayerpos = lplayer->getPosition();
                        
                        // Apply physics
-                       if(free_move == false && is_climbing == false)
+                       if(free_move == false && is_climbing == false && is_frozen == false)
                        {
                                // Gravity
                                v3f speed = lplayer->getSpeed();
@@ -1638,18 +1643,28 @@ void ClientEnvironment::step(float dtime)
        if(m_lava_hurt_interval.step(dtime, 1.0))
        {
                v3f pf = lplayer->getPosition();
-               v3s16 p1 = floatToInt(pf + v3f(0, BS*0.0, 0), BS);
+               
+               // Feet, middle and head
+               v3s16 p1 = floatToInt(pf + v3f(0, BS*0.1, 0), BS);
                MapNode n1 = m_map->getNodeNoEx(p1);
-               v3s16 p2 = floatToInt(pf + v3f(0, BS*1.5, 0), BS);
+               v3s16 p2 = floatToInt(pf + v3f(0, BS*0.8, 0), BS);
                MapNode n2 = m_map->getNodeNoEx(p2);
-               if(n1.getContent() == CONTENT_LAVA ||
-                               n1.getContent() == CONTENT_LAVASOURCE ||
-                               n2.getContent() == CONTENT_LAVA ||
-                               n2.getContent() == CONTENT_LAVASOURCE)
+               v3s16 p3 = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
+               MapNode n3 = m_map->getNodeNoEx(p2);
+
+               u32 damage_per_second = 0;
+               damage_per_second = MYMAX(damage_per_second,
+                               content_features(n1).damage_per_second);
+               damage_per_second = MYMAX(damage_per_second,
+                               content_features(n2).damage_per_second);
+               damage_per_second = MYMAX(damage_per_second,
+                               content_features(n3).damage_per_second);
+               
+               if(damage_per_second != 0)
                {
                        ClientEnvEvent event;
                        event.type = CEE_PLAYER_DAMAGE;
-                       event.player_damage.amount = 4*2; // 4 hearts
+                       event.player_damage.amount = damage_per_second;
                        m_client_event_queue.push_back(event);
                }
        }
@@ -1925,29 +1940,6 @@ ClientEnvEvent ClientEnvironment::getClientEvent()
        return m_client_event_queue.pop_front();
 }
 
-void ClientEnvironment::drawPostFx(video::IVideoDriver* driver, v3f camera_pos)
-{
-       /*LocalPlayer *player = getLocalPlayer();
-       assert(player);
-       v3f pos_f = player->getPosition() + v3f(0,BS*1.625,0);*/
-       v3f pos_f = camera_pos;
-       v3s16 p_nodes = floatToInt(pos_f, BS);
-       MapNode n = m_map->getNodeNoEx(p_nodes);
-       if(n.getContent() == CONTENT_WATER || n.getContent() == CONTENT_WATERSOURCE)
-       {
-               v2u32 ss = driver->getScreenSize();
-               core::rect<s32> rect(0,0, ss.X, ss.Y);
-               driver->draw2DRectangle(video::SColor(64, 100, 100, 200), rect);
-       }
-       else if(content_features(n).solidness == 2 &&
-                       g_settings.getBool("free_move") == false)
-       {
-               v2u32 ss = driver->getScreenSize();
-               core::rect<s32> rect(0,0, ss.X, ss.Y);
-               driver->draw2DRectangle(video::SColor(255, 0, 0, 0), rect);
-       }
-}
-
 #endif // #ifndef SERVER