mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
Make lighting update occur immediately after ClientActiveObject addition to make objects show up much more responsively
This commit is contained in:
parent
70363847aa
commit
65b2a2cb02
@ -2289,8 +2289,18 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
|
|||||||
infostream<<"ClientEnvironment::addActiveObject(): "
|
infostream<<"ClientEnvironment::addActiveObject(): "
|
||||||
<<"added (id="<<object->getId()<<")"<<std::endl;
|
<<"added (id="<<object->getId()<<")"<<std::endl;
|
||||||
m_active_objects.insert(object->getId(), object);
|
m_active_objects.insert(object->getId(), object);
|
||||||
// TODO: Make g_texturesource non-global
|
|
||||||
object->addToScene(m_smgr, m_texturesource);
|
object->addToScene(m_smgr, m_texturesource);
|
||||||
|
{ // Update lighting immediately
|
||||||
|
u8 light = 0;
|
||||||
|
try{
|
||||||
|
// Get node at head
|
||||||
|
v3s16 p = object->getLightPosition();
|
||||||
|
MapNode n = m_map->getNode(p);
|
||||||
|
light = n.getLightBlend(getDayNightRatio(), m_gamedef->ndef());
|
||||||
|
}
|
||||||
|
catch(InvalidPositionException &e) {}
|
||||||
|
object->updateLight(light);
|
||||||
|
}
|
||||||
return object->getId();
|
return object->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user