File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ mesecon.noteblock_play = function(pos, param2)
6262	pos .y  =  pos .y - 1 
6363	local  nodeunder  =  minetest .get_node (pos ).name 
6464	local  soundname  =  node_sounds [nodeunder ]
65+ 	local  use_pitch  =  true 
6566	local  pitch 
6667	--  Special sounds
6768	if  not  soundname  then 
@@ -74,15 +75,6 @@ mesecon.noteblock_play = function(pos, param2)
7475		end 
7576	end 
7677	--  Piano
77- 	if  not  soundname  then 
78- 		for  k ,v  in  pairs (node_sounds_group ) do 
79- 			local  g  =  minetest .get_item_group (nodeunder , k )
80- 			if  g  ~=  0  then 
81- 				soundname  =  v 
82- 				break 
83- 			end 
84- 		end 
85- 	end 
8678	if  not  soundname  then 
8779		soundname  =  soundnames [param2 ]
8880		if  not  soundname  then 
@@ -92,16 +84,15 @@ mesecon.noteblock_play = function(pos, param2)
9284		if  nodeunder  ==  " default:steelblock"  then 
9385			soundname  =  soundname ..  2 
9486		end 
95- 		pitch  =  false 
87+ 		use_pitch  =  false 
9688	end 
9789	--  Disable pitch for fire and explode because they'd sound too odd
9890	if  soundname  ==  " fire_fire"  or  soundname  ==  " tnt_explode"  then 
99- 		pitch  =  false 
91+ 		use_pitch  =  false 
10092	end 
101- 	if  pitch  ==  false  then 
102- 		pitch  =  nil 
103- 	else 
93+ 	if  use_pitch  then 
10494		--  Calculate pitch
95+ 		--  Adding 1 to param2 because param2=11 is *lowest* pitch sound
10596		local  val  =  (param2 + 1 )% 12 
10697		--  All semitones from C to B (analog to piano mode)
10798		pitch  =  2 ^ ((val - 6 )/ 12 )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments