aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/environment.cpp2
-rw-r--r--src/player.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 680d209fc..e293eb511 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -1653,7 +1653,7 @@ void ClientEnvironment::step(float dtime)
u8 light = LIGHT_MAX;
try{
// Get node at head
- v3s16 p = floatToInt(playerpos + v3f(0,BS+BS/2,0), BS);
+ v3s16 p = player->getLightPosition();
MapNode n = m_map->getNode(p);
light = n.getLightBlend(getDayNightRatio());
}
diff --git a/src/player.h b/src/player.h
index b91c3cb1b..00a1d4408 100644
--- a/src/player.h
+++ b/src/player.h
@@ -62,6 +62,11 @@ public:
return m_position;
}
+ v3s16 getLightPosition() const
+ {
+ return floatToInt(m_position + v3f(0,BS+BS/2,0), BS);
+ }
+
virtual void setPosition(const v3f &position)
{
m_position = position;