summaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-22 03:33:58 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-22 03:33:58 +0200
commitb94a00786454968a1cc309b01180292b114da4bd (patch)
tree7500f452ebcf81fabaaaf478747b9826417420b9 /src/environment.cpp
parent3f5bad938a3fcb601ad41924a4707476b8b87241 (diff)
downloadminetest-b94a00786454968a1cc309b01180292b114da4bd.tar.gz
minetest-b94a00786454968a1cc309b01180292b114da4bd.tar.bz2
minetest-b94a00786454968a1cc309b01180292b114da4bd.zip
some work-in-progress
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 386eb124d..7c236c355 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -103,6 +103,8 @@ void Environment::step(float dtime)
i != m_players.end(); i++)
{
Player *player = *i;
+
+ v3f playerpos = player->getPosition();
// Apply physics to local player
if(player->isLocal())
@@ -136,11 +138,21 @@ void Environment::step(float dtime)
player->move(dtime_part, *m_map);
/*
+ Update lighting on remote players on client
+ */
+ u8 light = LIGHT_MAX;
+ try{
+ // Get node at feet
+ v3s16 p = floatToInt(playerpos + v3f(0,BS/4,0));
+ MapNode n = m_map->getNode(p);
+ light = n.getLightBlend(m_daynight_ratio);
+ }
+ catch(InvalidPositionException &e) {}
+ player->updateLight(light);
+
+ /*
Add footsteps to grass
*/
- //TimeTaker footsteptimer("footstep", g_device);
- // 0ms
- v3f playerpos = player->getPosition();
// Get node that is at BS/4 under player
v3s16 bottompos = floatToInt(playerpos + v3f(0,-BS/4,0));
try{
@@ -163,7 +175,6 @@ void Environment::step(float dtime)
catch(InvalidPositionException &e)
{
}
- //footsteptimer.stop();
}
}
while(dtime > 0.001);