propagate active_blocks

This commit is contained in:
Hume2 2020-03-23 13:20:29 +01:00
parent f343219cb6
commit 5b00c2a543

View File

@ -68,7 +68,7 @@ local function get_blockpos(pos)
z = math.floor(pos.z / 16)}
end
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
pipeworks.active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
local move_entities_globalstep_part1 = function(dtime)
local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2
@ -87,12 +87,12 @@ local move_entities_globalstep_part1 = function(dtime)
end
end
end
active_blocks = new_active_blocks
pipeworks.active_blocks = new_active_blocks
-- todo: callbacks on block load/unload
end
function pipeworks.is_active(pos)
return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
return pipeworks.active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
end
local entitydef_default = {