1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Pass pointed_thing to on_punch and minetest.register_on_punchnode callbacks

This commit is contained in:
ShadowNinja 2014-01-23 19:21:01 -05:00
parent cd7e8372f3
commit 76d4396fa1
7 changed files with 28 additions and 38 deletions

View file

@ -52,7 +52,6 @@ protected:
friend class ModApiItemMod;
bool getItemCallback(const char *name, const char *callbackname);
private:
void pushPointedThing(const PointedThing& pointed);
};

View file

@ -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;

View file

@ -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);