Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tp tubes a bit #47

Closed
S-S-X opened this issue Oct 8, 2022 · 0 comments · Fixed by #49
Closed

Cleanup tp tubes a bit #47

S-S-X opened this issue Oct 8, 2022 · 0 comments · Fixed by #49
Assignees
Labels
enhancement New feature or request

Comments

@S-S-X
Copy link
Member

S-S-X commented Oct 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants