mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-26 19:00:24 +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,
|
||||
drop_on_routing_fail = false,
|
||||
delete_item_on_clearobject = true,
|
||||
use_real_entities = true,
|
||||
}
|
||||
|
||||
pipeworks.toggles = {}
|
||||
|
@ -73,9 +73,13 @@ 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)
|
||||
local move_entities_globalstep_part1
|
||||
local is_active
|
||||
|
||||
local move_entities_globalstep_part1 = function(dtime)
|
||||
if pipeworks.use_real_entities then
|
||||
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
|
||||
|
||||
move_entities_globalstep_part1 = function(dtime)
|
||||
local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2
|
||||
local new_active_blocks = {}
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
@ -94,10 +98,18 @@ local move_entities_globalstep_part1 = function(dtime)
|
||||
end
|
||||
active_blocks = new_active_blocks
|
||||
-- todo: callbacks on block load/unload
|
||||
end
|
||||
end
|
||||
|
||||
local function is_active(pos)
|
||||
is_active = function(pos)
|
||||
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
|
||||
|
||||
local entitydef_default = {
|
||||
|
@ -75,3 +75,6 @@ pipeworks_drop_on_routing_fail (Drop On Routing Fail) bool false
|
||||
|
||||
#Delete item on clearobject.
|
||||
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