testing
Some checks are pending
luacheck / luacheck (push) Waiting to run

This commit is contained in:
Vitaliy Olkhin 2024-11-04 11:56:30 +05:00
parent 222a865e17
commit 2947881b1e
2 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -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)