diff options
Diffstat (limited to 'mesecons_microcontroller')
| -rw-r--r-- | mesecons_microcontroller/init.lua | 16 | 
1 files changed, 11 insertions, 5 deletions
| diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index 1d47710..faa9ffd 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -1,3 +1,9 @@ +mesecon:add_rules("microcontroller_all", { --flat rules (looks better with nodebox wires connection) +{x = 1, y = 0, z = 0 }, +{x = 0, y = 0, z = 1 }, +{x = -1, y = 0, z = 0}, +{x = 0, y = 0, z = -1}}) +  EEPROM_SIZE = 255  for a = 0, 1 do @@ -6,9 +12,9 @@ for c = 0, 1 do  for d = 0, 1 do  local nodename = "mesecons_microcontroller:microcontroller"..tostring(d)..tostring(c)..tostring(b)..tostring(a)  if tostring(d)..tostring(c)..tostring(b)..tostring(a) ~= "0000" then -	groups = {dig_immediate=2, not_in_creative_inventory=1, mesecon_effector_on = 1, mesecon_effector_off = 0, mesecon = 2} +	groups = {dig_immediate=2, not_in_creative_inventory=1, mesecon = 3}  else -	groups = {dig_immediate=2, mesecon_effector_on = 1, mesecon_effector_off = 0, mesecon = 2} +	groups = {dig_immediate=2, mesecon = 3}  end  minetest.register_node(nodename, {  	description = "Microcontroller", @@ -17,7 +23,6 @@ minetest.register_node(nodename, {  		"jeija_microcontroller_top_"..tostring(d)..tostring(c)..tostring(b)..tostring(a)..".png",  		"jeija_microcontroller_sides.png",  		}, -	--inventory_image = "jeija_microcontroller_top_0000.png",  	sunlight_propagates = true,  	paramtype = "light", @@ -88,16 +93,17 @@ minetest.register_node(nodename, {  		update_yc(pos)  	end,  }) +  local rules={}  if (a == 1) then table.insert(rules, {x = -1, y = 0, z =  0}) end  if (b == 1) then table.insert(rules, {x =  0, y = 0, z =  1}) end  if (c == 1) then table.insert(rules, {x =  1, y = 0, z =  0}) end  if (d == 1) then table.insert(rules, {x =  0, y = 0, z = -1}) end  mesecon:add_rules(nodename, rules) + +mesecon:register_effector(nodename, nodename, mesecon:get_rules("microcontroller_all"))  if nodename ~= "mesecons_microcontroller:microcontroller0000" then  	mesecon:add_receptor_node(nodename, rules) -else -	mesecon:add_receptor_node_off(nodename)  end  end  end | 
