mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-27 11:20:26 +01:00
Add option to forego real entities (#26)
This commit is contained in:
parent
37eef73695
commit
97903327a5
@ -27,6 +27,7 @@ local settings = {
|
|||||||
enable_cyclic_mode = true,
|
enable_cyclic_mode = true,
|
||||||
drop_on_routing_fail = false,
|
drop_on_routing_fail = false,
|
||||||
delete_item_on_clearobject = true,
|
delete_item_on_clearobject = true,
|
||||||
|
use_real_entities = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeworks.toggles = {}
|
pipeworks.toggles = {}
|
||||||
|
@ -73,31 +73,43 @@ local function get_blockpos(pos)
|
|||||||
z = math.floor(pos.z / 16)}
|
z = math.floor(pos.z / 16)}
|
||||||
end
|
end
|
||||||
|
|
||||||
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
|
local move_entities_globalstep_part1
|
||||||
|
local is_active
|
||||||
|
|
||||||
local move_entities_globalstep_part1 = function(dtime)
|
if pipeworks.use_real_entities then
|
||||||
local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2
|
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
|
||||||
local new_active_blocks = {}
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local blockpos = get_blockpos(player:get_pos())
|
|
||||||
local minp = vector.subtract(blockpos, active_block_range)
|
|
||||||
local maxp = vector.add(blockpos, active_block_range)
|
|
||||||
|
|
||||||
for x = minp.x, maxp.x do
|
move_entities_globalstep_part1 = function(dtime)
|
||||||
for y = minp.y, maxp.y do
|
local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2
|
||||||
for z = minp.z, maxp.z do
|
local new_active_blocks = {}
|
||||||
local pos = {x = x, y = y, z = z}
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
new_active_blocks[minetest.hash_node_position(pos)] = pos
|
local blockpos = get_blockpos(player:get_pos())
|
||||||
end
|
local minp = vector.subtract(blockpos, active_block_range)
|
||||||
end
|
local maxp = vector.add(blockpos, active_block_range)
|
||||||
|
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
for y = minp.y, maxp.y do
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
local pos = {x = x, y = y, z = z}
|
||||||
|
new_active_blocks[minetest.hash_node_position(pos)] = pos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
active_blocks = new_active_blocks
|
||||||
|
-- todo: callbacks on block load/unload
|
||||||
end
|
end
|
||||||
active_blocks = new_active_blocks
|
|
||||||
-- todo: callbacks on block load/unload
|
|
||||||
end
|
|
||||||
|
|
||||||
local function is_active(pos)
|
is_active = function(pos)
|
||||||
return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
|
return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
move_entities_globalstep_part1 = function()
|
||||||
|
end
|
||||||
|
|
||||||
|
is_active = function()
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local entitydef_default = {
|
local entitydef_default = {
|
||||||
|
@ -75,3 +75,6 @@ pipeworks_drop_on_routing_fail (Drop On Routing Fail) bool false
|
|||||||
|
|
||||||
#Delete item on clearobject.
|
#Delete item on clearobject.
|
||||||
pipeworks_delete_item_on_clearobject (Delete Item On Clearobject) bool true
|
pipeworks_delete_item_on_clearobject (Delete Item On Clearobject) bool true
|
||||||
|
|
||||||
|
#Use real visible entities in tubes within active areas.
|
||||||
|
pipeworks_use_real_entities (Use real entities) bool true
|
||||||
|
Loading…
Reference in New Issue
Block a user