From 2947881b1e39802e1691c9a07fd51b3244ca38d3 Mon Sep 17 00:00:00 2001 From: Vitaliy Olkhin Date: Mon, 4 Nov 2024 11:56:30 +0500 Subject: [PATCH] testing --- init.lua | 8 +------- item_transport.lua | 11 ++++++++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 6d85a06..34c9a8e 100644 --- a/init.lua +++ b/init.lua @@ -21,13 +21,7 @@ pipeworks = { } dofile(pipeworks.modpath.."/default_settings.lua") --- Read the external config file if it exists. -local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt" -local worldsettingsfile = io.open(worldsettingspath, "r") -if worldsettingsfile then - worldsettingsfile:close() - dofile(worldsettingspath) -end + if pipeworks.toggles.pipe_mode == "pressure" then minetest.log("warning", "pipeworks pressure logic mode comes with caveats and differences in behaviour, you have been warned!") end diff --git a/item_transport.lua b/item_transport.lua index ddf2a08..83fdeb8 100644 --- a/item_transport.lua +++ b/item_transport.lua @@ -61,9 +61,16 @@ function pipeworks.notvel(tbl, vel) return tbl2 end +local timer = 0 local tube_item_count = {} minetest.register_globalstep(function(dtime) + -- every 5 seconds + if timer > os.time() then + return + end + timer = os.time() + 1 + if not luaentity.entities then return end @@ -71,7 +78,9 @@ minetest.register_globalstep(function(dtime) for _, entity in pairs(luaentity.entities) do if entity.name == "pipeworks:tubed_item" then local h = minetest.hash_node_position(vector.round(entity._pos)) - tube_item_count[h] = (tube_item_count[h] or 0) + 1 + if type(tube_item_count[h]) ~= 'nil' then + tube_item_count[h] = (tube_item_count[h] or 0) + 1 + end end end end)