mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add callback on_mapblocks_changed
This commit is contained in:
parent
7701e70dc9
commit
5c248c2d7d
10 changed files with 141 additions and 6 deletions
|
@ -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()
|
||||
|
|
|
@ -43,6 +43,7 @@ local register_functions = {
|
|||
register_on_item_eat = 0,
|
||||
register_on_punchplayer = 0,
|
||||
register_on_player_hpchange = 0,
|
||||
register_on_mapblocks_changed = 0,
|
||||
}
|
||||
|
||||
---
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue