mirror of
				https://github.com/luanti-org/minetest_game.git
				synced 2025-10-30 23:25:33 +01:00 
			
		
		
		
	Update butterflies/init.lua
Updated butterflies/init.lua to solve issues with on_rightclick
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							b9c089474c
						
					
				
				
					commit
					0ee3f67846
				
			| @@ -75,13 +75,19 @@ for i in ipairs (butter_list) do | |||||||
| 		on_place = function(itemstack, placer, pointed_thing) | 		on_place = function(itemstack, placer, pointed_thing) | ||||||
| 			local player_name = placer:get_player_name() | 			local player_name = placer:get_player_name() | ||||||
| 			local pos = pointed_thing.above | 			local pos = pointed_thing.above | ||||||
|  | 			local node = minetest.get_node(pointed_thing.under) | ||||||
|  |  | ||||||
| 			if not minetest.is_protected(pos, player_name) and | 			if not minetest.is_protected(pos, player_name) and | ||||||
| 			not minetest.is_protected(pointed_thing.under, player_name) and | 			not minetest.is_protected(pointed_thing.under, player_name) and | ||||||
| 			minetest.get_node(pos).name == "air" then | 			minetest.get_node(pos).name == "air" then | ||||||
|  | 				if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then | ||||||
|  | 					if placer and placer:get_player_control().sneak then | ||||||
| 						minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name}) | 						minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name}) | ||||||
| 						minetest.get_node_timer(pos):start(1) | 						minetest.get_node_timer(pos):start(1) | ||||||
| 						itemstack:take_item() | 						itemstack:take_item() | ||||||
|  | 					else | ||||||
|  | 						return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) | ||||||
|  | 					end | ||||||
| 				end | 				end | ||||||
| 			return itemstack | 			return itemstack | ||||||
| 		end, | 		end, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user