Introduce Player::getLightPosition

This is currently only used in the lighting update for remote
players in client.
This commit is contained in:
Giuseppe Bilotta 2011-08-10 07:38:51 +02:00
parent 69fca4f3cb
commit 98fa00db12
2 changed files with 6 additions and 1 deletions

@ -1653,7 +1653,7 @@ void ClientEnvironment::step(float dtime)
u8 light = LIGHT_MAX; u8 light = LIGHT_MAX;
try{ try{
// Get node at head // 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); MapNode n = m_map->getNode(p);
light = n.getLightBlend(getDayNightRatio()); light = n.getLightBlend(getDayNightRatio());
} }

@ -62,6 +62,11 @@ public:
return m_position; return m_position;
} }
v3s16 getLightPosition() const
{
return floatToInt(m_position + v3f(0,BS+BS/2,0), BS);
}
virtual void setPosition(const v3f &position) virtual void setPosition(const v3f &position)
{ {
m_position = position; m_position = position;