summaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
authorJürgen Doser <jurgen.doser@gmail.com>2013-01-11 18:52:00 +0100
committerJürgen Doser <jurgen.doser@gmail.com>2013-01-11 18:59:27 +0100
commit076f13cc01916ea9942fcadeb1ec40924c8cde8b (patch)
treec519bbb7f91f395d317b751258a5eba13e61f932 /src/environment.cpp
parent8eb717d4d0d4131eb5b82a73b343c7309b1ebf47 (diff)
downloadminetest-076f13cc01916ea9942fcadeb1ec40924c8cde8b.tar.gz
minetest-076f13cc01916ea9942fcadeb1ec40924c8cde8b.tar.bz2
minetest-076f13cc01916ea9942fcadeb1ec40924c8cde8b.zip
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.
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 020d2b433..3f94484fe 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -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));
}
}