forked from nalc/nalc_game
		
	Screwdriver: disallow rotation with on_rotate = false
				
					
				
			Other screwdriver mods, or mods that cause rotation, might operate without the screwdriver mod loaded and have `screwdriver.disallow` unavailable. This allows nodes to default to full-disallow rather than full-rotation in such a situation.
This commit is contained in:
		@@ -348,7 +348,7 @@ To use it, add the `on_screwdriver` function to the node definition.
 | 
				
			|||||||
 * `new_param2` the new value of param2 that would have been set if on_rotate wasn't there
 | 
					 * `new_param2` the new value of param2 that would have been set if on_rotate wasn't there
 | 
				
			||||||
 * return value: false to disallow rotation, nil to keep default behaviour, true to allow
 | 
					 * return value: false to disallow rotation, nil to keep default behaviour, true to allow
 | 
				
			||||||
 	it but to indicate that changed have already been made (so the screwdriver will wear out)
 | 
					 	it but to indicate that changed have already been made (so the screwdriver will wear out)
 | 
				
			||||||
 * use `on_rotate = screwdriver.disallow` to always disallow rotation
 | 
					 * use `on_rotate = false` to always disallow rotation
 | 
				
			||||||
 * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
 | 
					 * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,6 +64,7 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
 | 
				
			|||||||
		end
 | 
							end
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		if not ndef or not ndef.paramtype2 == "facedir" or
 | 
							if not ndef or not ndef.paramtype2 == "facedir" or
 | 
				
			||||||
 | 
									ndef.on_rotate == false or
 | 
				
			||||||
				(ndef.drawtype == "nodebox" and
 | 
									(ndef.drawtype == "nodebox" and
 | 
				
			||||||
				not ndef.node_box.type == "fixed") or
 | 
									not ndef.node_box.type == "fixed") or
 | 
				
			||||||
				node.param2 == nil then
 | 
									node.param2 == nil then
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user