From 7aa2d4d109cf8a92582a271d505f20a0f348f5a3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 10 Apr 2011 16:20:31 +0300 Subject: new-style rats are now generated in the map --- src/environment.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/environment.cpp') diff --git a/src/environment.cpp b/src/environment.cpp index 435690bca..eaea6d0b5 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -429,7 +429,7 @@ void ServerEnvironment::step(float dtime) bool send_recommended = false; m_send_recommended_timer += dtime; - if(m_send_recommended_timer > 0.2) + if(m_send_recommended_timer > 0.1) { m_send_recommended_timer = 0; send_recommended = true; @@ -1111,7 +1111,7 @@ void ClientEnvironment::step(float dtime) } /* - Step active objects + Step active objects and update lighting of them */ for(core::map::Iterator @@ -1121,6 +1121,17 @@ void ClientEnvironment::step(float dtime) ClientActiveObject* obj = i.getNode()->getValue(); // Step object obj->step(dtime, this); + // Update lighting + //u8 light = LIGHT_MAX; + u8 light = 0; + try{ + // Get node at head + v3s16 p = obj->getLightPosition(); + MapNode n = m_map->getNode(p); + light = n.getLightBlend(m_daynight_ratio); + } + catch(InvalidPositionException &e) {} + obj->updateLight(light); } } -- cgit v1.2.3