mt-mods / pipeworks

Pipeworks is a mod for Minetest allowing the crafting and usage of pipes and tubes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cleanup tp tubes a bit

S-S-X opened this issue · comments

commented

Remove:

pipeworks/teleport_tube.lua

Lines 124 to 136 in 8c25180

-- we haven't found any tp tube to update, so lets add it
-- but sanity check that the hash has not already been inserted.
-- if so, complain very loudly and refuse the update so the player knows something is amiss.
-- to catch regressions of https://github.com/minetest-mods/pipeworks/issues/166
local existing = tp_tube_db[hash]
if existing ~= nil then
local e = "error"
minetest.log(e, "pipeworks teleport tube update refused due to position hash collision")
minetest.log(e, "collided hash: "..hash)
minetest.log(e, "tried-to-place tube: "..fmt(pos))
minetest.log(e, "existing tube: "..fmt(existing))
return
end

Also remove these everywhere and just use direct tp_tube_db, just load db during mod loading stage instead. No real reason for deferred db read:

local tubes = tp_tube_db or read_tube_db()

Tp tube table tp_tube_db is local to file, recreating local for function scope in most cases also isn't helping with performance but instead just add unnecessary LoC.