diff options
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_converter.h | 9 |
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); +} |