Skip to content

Instantly share code, notes, and snippets.

@sofar
Created March 23, 2018 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofar/f3bdaa9ab1253f3d6d893127bc41e562 to your computer and use it in GitHub Desktop.
Save sofar/f3bdaa9ab1253f3d6d893127bc41e562 to your computer and use it in GitHub Desktop.
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index f72a81d32..ba9f08700 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -561,6 +561,26 @@ int ObjectRef::l_get_eye_offset(lua_State *L)
return 2;
}
+// send_block(pos)
+int ObjectRef::l_send_block(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ RemotePlayer *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+ // Do it
+ v3f pos = v3f(0, 0, 0);
+ if (!lua_isnil(L, 2))
+ pos = read_v3f(L, 2);
+ elsee
+ return 0;
+
+ getServer(L)->send_mapblocks(player, pos); //????
+
+ lua_pushboolean(L, true);
+ return 1;
+}
+
// set_animation_frame_speed(self, frame_speed)
int ObjectRef::l_set_animation_frame_speed(lua_State *L)
{
@@ -1843,5 +1863,6 @@ const luaL_Reg ObjectRef::methods[] = {
luamethod(ObjectRef, get_local_animation),
luamethod(ObjectRef, set_eye_offset),
luamethod(ObjectRef, get_eye_offset),
+ luamethod(ObjectRef, send_block),
{0,0}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment