aboutsummaryrefslogtreecommitdiff
path: root/src/script/common/c_converter.h
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-09-03 22:05:07 -0400
committerJude Melton-Houghton <jwmhjwmh@gmail.com>2022-12-24 08:24:59 -0500
commit5c248c2d7de3db54e85f7c388743a2eb8e36fee4 (patch)
treeb0d27690b3e852b207345dc5e00dc4457a7e6268 /src/script/common/c_converter.h
parent7701e70dc92262c41d68cf1c9f7fbd0c333e5c52 (diff)
downloadminetest-5c248c2d7de3db54e85f7c388743a2eb8e36fee4.tar.xz
Add callback on_mapblocks_changed
Diffstat (limited to 'src/script/common/c_converter.h')
-rw-r--r--src/script/common/c_converter.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h
index 2af726d16..f1e4e47ec 100644
--- a/src/script/common/c_converter.h
+++ b/src/script/common/c_converter.h
@@ -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);
+}