Skip to content

Commit

Permalink
avoid re-calculating node hash in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS committed Dec 19, 2024
1 parent b571050 commit b01e0f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion homedecor_seating/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@ function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed
end

function lrfurn.on_seat_movenode(from_pos, to_pos)
local hashed_from_pos = core.hash_node_position(from_pos)
local hashed_to_pos = core.hash_node_position(to_pos)
for name, seatpos in pairs(seated_cache) do
if seatpos == minetest.hash_node_position(from_pos) then
local player = minetest.get_player_by_name(name)
if seatpos == hashed_from_pos then
if player then
local attached_to = player:get_attach()
if attached_to then --check, a stupid clearobjects might have been called, etc
Expand Down

0 comments on commit b01e0f6

Please sign in to comment.