From b01e0f6174be85b384457f7716f56ab0bff968a7 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Thu, 19 Dec 2024 14:34:00 +0100 Subject: [PATCH] avoid re-calculating node hash in loop --- homedecor_seating/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homedecor_seating/init.lua b/homedecor_seating/init.lua index f787a470..bda43926 100644 --- a/homedecor_seating/init.lua +++ b/homedecor_seating/init.lua @@ -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