]> git.lizzy.rs Git - minetest.git/blobdiff - src/script/common/c_converter.h
Add callback on_mapblocks_changed
[minetest.git] / src / script / common / c_converter.h
index 2af726d1618d7d336a4b69a41b62e19d8ea7e639..f1e4e47ec255b8e3ab48c7e7f622b2d0461a66a2 100644 (file)
@@ -121,3 +121,12 @@ void                warn_if_field_exists(lua_State *L, int table,
 
 size_t write_array_slice_float(lua_State *L, int table_index, float *data,
        v3u16 data_size, v3u16 slice_offset, v3u16 slice_size);
+
+// This must match the implementation in builtin/game/misc_s.lua
+// Note that this returns a floating point result as Lua integers are 32-bit
+inline lua_Number hash_node_position(v3s16 pos)
+{
+       return (((s64)pos.Z + 0x8000L) << 32)
+                       | (((s64)pos.Y + 0x8000L) << 16)
+                       | ((s64)pos.X + 0x8000L);
+}