fix node timers so on_timer gets the correct position
authordarkrose <lisa@ltmnet.com>
Fri, 10 Aug 2012 02:34:02 +0000 (12:34 +1000)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 12 Aug 2012 12:28:31 +0000 (15:28 +0300)
src/environment.cpp

index e3e6210650d9bf786b62a637eee17f50d277e7c9..b88f55dead838a51b25f3c0a89c50fad8e9ddde7 100644 (file)
@@ -1087,7 +1087,8 @@ void ServerEnvironment::step(float dtime)
                                                i = elapsed_timers.begin();
                                                i != elapsed_timers.end(); i++){
                                        n = block->getNodeNoEx(i->first);
-                                       if(scriptapi_node_on_timer(m_lua,i->first,n,i->second.elapsed))
+                                       p = i->first + block->getPosRelative();
+                                       if(scriptapi_node_on_timer(m_lua,p,n,i->second.elapsed))
                                                block->setNodeTimer(i->first,NodeTimer(i->second.timeout,0));
                                }
                        }