mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Add callback on_mapblocks_changed
This commit is contained in:
@@ -8,10 +8,9 @@
|
||||
-- Misc. API functions
|
||||
--
|
||||
|
||||
-- This must match the implementation in src/script/common/c_converter.h
|
||||
function core.hash_node_position(pos)
|
||||
return (pos.z + 32768) * 65536 * 65536
|
||||
+ (pos.y + 32768) * 65536
|
||||
+ pos.x + 32768
|
||||
return (pos.z + 0x8000) * 0x100000000 + (pos.y + 0x8000) * 0x10000 + (pos.x + 0x8000)
|
||||
end
|
||||
|
||||
|
||||
|
@@ -633,6 +633,17 @@ core.registered_on_player_inventory_actions, core.register_on_player_inventory_a
|
||||
core.registered_allow_player_inventory_actions, core.register_allow_player_inventory_action = make_registration()
|
||||
core.registered_on_rightclickplayers, core.register_on_rightclickplayer = make_registration()
|
||||
core.registered_on_liquid_transformed, core.register_on_liquid_transformed = make_registration()
|
||||
core.registered_on_mapblocks_changed, core.register_on_mapblocks_changed = make_registration()
|
||||
|
||||
core.register_on_mods_loaded(function()
|
||||
core.after(0, function()
|
||||
setmetatable(core.registered_on_mapblocks_changed, {
|
||||
__newindex = function()
|
||||
error("on_mapblocks_changed callbacks must be registered at load time")
|
||||
end,
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
||||
--
|
||||
-- Compatibility for on_mapgen_init()
|
||||
|
Reference in New Issue
Block a user