forked from minetest-mods/mesecons
		
	Consolidate horizontal rules getters (#602)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							58305f52bc
						
					
				
				
					commit
					0a4a88b1b9
				
			| @@ -11,25 +11,14 @@ local nodebox = { | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| local function gate_rotate_rules(node, rules) | ||||
| 	for rotations = 0, node.param2 - 1 do | ||||
| 		rules = mesecon.rotate_rules_left(rules) | ||||
| 	end | ||||
| 	return rules | ||||
| end | ||||
| local gate_get_output_rules = mesecon.horiz_rules_getter({{x = 1, y = 0, z = 0}}) | ||||
|  | ||||
| local function gate_get_output_rules(node) | ||||
| 	return gate_rotate_rules(node, {{x=1, y=0, z=0}}) | ||||
| end | ||||
| local gate_get_input_rules_oneinput = mesecon.horiz_rules_getter({{x =-1, y = 0, z = 0}}) | ||||
|  | ||||
| local function gate_get_input_rules_oneinput(node) | ||||
| 	return gate_rotate_rules(node, {{x=-1, y=0, z=0}}) | ||||
| end | ||||
|  | ||||
| local function gate_get_input_rules_twoinputs(node) | ||||
| 	return gate_rotate_rules(node, {{x=0, y=0, z=1, name="input1"}, | ||||
| 		{x=0, y=0, z=-1, name="input2"}}) | ||||
| end | ||||
| local gate_get_input_rules_twoinputs = mesecon.horiz_rules_getter({ | ||||
| 	{x = 0, y = 0, z = 1, name = "input1"}, | ||||
| 	{x = 0, y = 0, z = -1, name = "input2"}, | ||||
| }) | ||||
|  | ||||
| local function set_gate(pos, node, state) | ||||
| 	local gate = minetest.registered_nodes[node.name] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user