mirror of
				https://github.com/mt-mods/homedecor_modpack.git
				synced 2025-10-31 18:15:24 +01:00 
			
		
		
		
	avoid re-calculating node hash in loop
This commit is contained in:
		| @@ -222,9 +222,11 @@ function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed | |||||||
| end | end | ||||||
|  |  | ||||||
| function lrfurn.on_seat_movenode(from_pos, to_pos) | 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 | 	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) | 			local player = minetest.get_player_by_name(name) | ||||||
|  | 		if seatpos == hashed_from_pos then | ||||||
| 			if player then | 			if player then | ||||||
| 				local attached_to = player:get_attach() | 				local attached_to = player:get_attach() | ||||||
| 				if attached_to then --check, a stupid clearobjects might have been called, etc | 				if attached_to then --check, a stupid clearobjects might have been called, etc | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user