forked from minetest-mods/mesecons
		
	Fix most of the namespace pollutions reported in #311
This commit is contained in:
		| @@ -47,7 +47,8 @@ elseif	i == 2 then delaytime = 0.3 | ||||
| elseif	i == 3 then delaytime = 0.5 | ||||
| elseif	i == 4 then delaytime = 1.0 end | ||||
|  | ||||
| boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 },		-- the main slab | ||||
| local boxes = { | ||||
| 	 { -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 },		-- the main slab | ||||
|  | ||||
| 	 { -2/16, -7/16, -4/16, 2/16, -26/64, -3/16 },		-- the jeweled "on" indicator | ||||
| 	 { -3/16, -7/16, -3/16, 3/16, -26/64, -2/16 }, | ||||
| @@ -57,7 +58,8 @@ boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 },		-- the main slab | ||||
|  | ||||
| 	 { -6/16, -7/16, -6/16, -4/16, -27/64, -4/16 },		-- the timer indicator | ||||
| 	 { -8/16, -8/16, -1/16, -6/16, -7/16, 1/16 },		-- the two wire stubs | ||||
| 	 { 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 }} | ||||
| 	 { 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 } | ||||
| } | ||||
|  | ||||
| minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { | ||||
| 	description = "Delayer", | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| function crossover_get_rules(node) | ||||
| local function crossover_get_rules(node) | ||||
| 	return { | ||||
| 		{--first wire | ||||
| 			{x=-1,y=0,z=0}, | ||||
|   | ||||
| @@ -54,7 +54,7 @@ local function update_gate(pos, node, link, newstate) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function register_gate(name, inputnumber, assess, recipe) | ||||
| local function register_gate(name, inputnumber, assess, recipe) | ||||
| 	local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or | ||||
| 		gate_get_input_rules_oneinput | ||||
| 	local description = "Mesecons Logic Gate: "..name | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| function insulated_wire_get_rules(node) | ||||
| local function insulated_wire_get_rules(node) | ||||
| 	local rules = 	{{x = 1,  y = 0,  z = 0}, | ||||
| 			 {x =-1,  y = 0,  z = 0}} | ||||
| 	if node.param2 == 1 or node.param2 == 3 then | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| -- A lamp is "is an electrical device used to create artificial light" (wikipedia) | ||||
| -- guess what? | ||||
|  | ||||
| mesecon_lamp_box = { | ||||
| local mesecon_lamp_box = { | ||||
| 	type = "wallmounted", | ||||
| 	wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125}, | ||||
| 	wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125}, | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| -- Get mesecon rules of pistons | ||||
| piston_rules = | ||||
| {{x=0,  y=0,  z=1}, --everything apart from z- (pusher side) | ||||
| local piston_rules = { | ||||
|  {x=0,  y=0,  z=1}, --everything apart from z- (pusher side) | ||||
|  {x=1,  y=0,  z=0}, | ||||
|  {x=-1, y=0,  z=0}, | ||||
|  {x=1,  y=1,  z=0}, | ||||
| @@ -8,29 +8,32 @@ piston_rules = | ||||
|  {x=-1, y=1,  z=0}, | ||||
|  {x=-1, y=-1, z=0}, | ||||
|  {x=0,  y=1,  z=1}, | ||||
|  {x=0,  y=-1, z=1}} | ||||
|  {x=0,  y=-1, z=1} | ||||
| } | ||||
|  | ||||
| local piston_up_rules = | ||||
| {{x=0,  y=0,  z=-1}, --everything apart from y+ (pusher side) | ||||
| local piston_up_rules = { | ||||
|  {x=0,  y=0,  z=-1}, --everything apart from y+ (pusher side) | ||||
|  {x=1,  y=0,  z=0}, | ||||
|  {x=-1, y=0,  z=0}, | ||||
|  {x=0,  y=0,  z=1}, | ||||
|  {x=1,  y=-1, z=0}, | ||||
|  {x=-1, y=-1, z=0}, | ||||
|  {x=0,  y=-1, z=1}, | ||||
|  {x=0,  y=-1, z=-1}} | ||||
|  {x=0,  y=-1, z=-1} | ||||
| } | ||||
|  | ||||
| local piston_down_rules = | ||||
| {{x=0,  y=0,  z=-1}, --everything apart from y- (pusher side) | ||||
| local piston_down_rules = { | ||||
|  {x=0,  y=0,  z=-1}, --everything apart from y- (pusher side) | ||||
|  {x=1,  y=0,  z=0}, | ||||
|  {x=-1, y=0,  z=0}, | ||||
|  {x=0,  y=0,  z=1}, | ||||
|  {x=1,  y=1, z=0}, | ||||
|  {x=-1, y=1, z=0}, | ||||
|  {x=0,  y=1, z=1}, | ||||
|  {x=0,  y=1, z=-1}} | ||||
|  {x=0,  y=1, z=-1} | ||||
| } | ||||
|  | ||||
| local piston_get_rules = function (node) | ||||
| local function piston_get_rules(node) | ||||
| 	local rules = piston_rules | ||||
| 	for i = 1, node.param2 do | ||||
| 		rules = mesecon.rotate_rules_left(rules) | ||||
| @@ -38,7 +41,7 @@ local piston_get_rules = function (node) | ||||
| 	return rules | ||||
| end | ||||
|  | ||||
| piston_facedir_direction = function (node) | ||||
| local function piston_facedir_direction(node) | ||||
| 	local rules = {{x = 0, y = 0, z = -1}} | ||||
| 	for i = 1, node.param2 do | ||||
| 		rules = mesecon.rotate_rules_left(rules) | ||||
| @@ -46,7 +49,7 @@ piston_facedir_direction = function (node) | ||||
| 	return rules[1] | ||||
| end | ||||
|  | ||||
| piston_get_direction = function(dir, node) | ||||
| local function piston_get_direction(dir, node) | ||||
| 	if type(dir) == "function" then | ||||
| 		return dir(node) | ||||
| 	else | ||||
|   | ||||
| @@ -8,7 +8,7 @@ local pp_box_on = { | ||||
| 	fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 }, | ||||
| } | ||||
|  | ||||
| pp_on_timer = function (pos, elapsed) | ||||
| local function pp_on_timer(pos, elapsed) | ||||
| 	local node = minetest.get_node(pos) | ||||
| 	local basename = minetest.registered_nodes[node.name].pressureplate_basename | ||||
|  | ||||
|   | ||||
| @@ -140,7 +140,7 @@ nid_inc = function (nid) | ||||
| 	return i <= 8 | ||||
| end | ||||
|  | ||||
| register_wires = function() | ||||
| local function register_wires() | ||||
| 	local nid = {} | ||||
| 	while true do | ||||
| 		-- Create group specifiction and nodeid string (see note above for details) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user