fixes node timer bug (fixes #407).

Previously, when a block was activated, on_timer callbacks where
called with the relative position of the node inside the block,
instead of the absolute position of the node.
This commit is contained in:
Jürgen Doser 2013-01-11 18:52:00 +01:00
parent 8eb717d4d0
commit 076f13cc01
1 changed files with 2 additions and 1 deletions

View File

@ -804,7 +804,8 @@ void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_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))
v3s16 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));
}
}