diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/script/cpp_api/s_item.h | 1 | ||||
-rw-r--r-- | src/script/cpp_api/s_node.cpp | 6 | ||||
-rw-r--r-- | src/script/cpp_api/s_node.h | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_env.cpp | 2 | ||||
-rw-r--r-- | src/server.cpp | 2 |
5 files changed, 7 insertions, 6 deletions
diff --git a/src/script/cpp_api/s_item.h b/src/script/cpp_api/s_item.h index 4964dd5b4..cca1641fd 100644 --- a/src/script/cpp_api/s_item.h +++ b/src/script/cpp_api/s_item.h @@ -52,7 +52,6 @@ protected: friend class ModApiItemMod; bool getItemCallback(const char *name, const char *callbackname); -private: void pushPointedThing(const PointedThing& pointed); }; diff --git a/src/script/cpp_api/s_node.cpp b/src/script/cpp_api/s_node.cpp index cd8451cf0..55db43584 100644 --- a/src/script/cpp_api/s_node.cpp +++ b/src/script/cpp_api/s_node.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "server.h" #include "environment.h" +#include "util/pointedthing.h" struct EnumString ScriptApiNode::es_DrawType[] = @@ -87,7 +88,7 @@ ScriptApiNode::~ScriptApiNode() { } bool ScriptApiNode::node_on_punch(v3s16 p, MapNode node, - ServerActiveObject *puncher) + ServerActiveObject *puncher, PointedThing pointed) { SCRIPTAPI_PRECHECKHEADER @@ -104,7 +105,8 @@ bool ScriptApiNode::node_on_punch(v3s16 p, MapNode node, push_v3s16(L, p); pushnode(L, node, ndef); objectrefGetOrCreate(puncher); - if(lua_pcall(L, 3, 0, errorhandler)) + pushPointedThing(pointed); + if(lua_pcall(L, 4, 0, errorhandler)) scriptError(); lua_pop(L, 1); // Pop error handler return true; diff --git a/src/script/cpp_api/s_node.h b/src/script/cpp_api/s_node.h index 517b4b04e..b3a6c83b5 100644 --- a/src/script/cpp_api/s_node.h +++ b/src/script/cpp_api/s_node.h @@ -38,7 +38,7 @@ public: virtual ~ScriptApiNode(); bool node_on_punch(v3s16 p, MapNode node, - ServerActiveObject *puncher); + ServerActiveObject *puncher, PointedThing pointed); bool node_on_dig(v3s16 p, MapNode node, ServerActiveObject *digger); void node_on_construct(v3s16 p, MapNode node); diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index f75334750..6447866cd 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -273,7 +273,7 @@ int ModApiEnvMod::l_punch_node(lua_State *L) } // Punch it with a NULL puncher (appears in Lua as a non-functional // ObjectRef) - bool success = scriptIfaceNode->node_on_punch(pos, n, NULL); + bool success = scriptIfaceNode->node_on_punch(pos, n, NULL, PointedThing()); lua_pushboolean(L, success); return 1; } diff --git a/src/server.cpp b/src/server.cpp index 50141f843..47b11d3da 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2918,7 +2918,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) m_emerge->enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false); } if(n.getContent() != CONTENT_IGNORE) - m_script->node_on_punch(p_under, n, playersao); + m_script->node_on_punch(p_under, n, playersao, pointed); // Cheat prevention playersao->noCheatDigStart(p_under); } |