diff options
author | Jeija <jeija@mesecons.net> | 2014-11-22 11:37:47 +0100 |
---|---|---|
committer | Jeija <jeija@mesecons.net> | 2014-11-22 11:40:58 +0100 |
commit | 194155fff8e848750dc716fd920045b3c340310d (patch) | |
tree | 5717748611bf2483e68a1eba908381fb7b064f19 /mesecons_microcontroller | |
parent | 87bfbb4de9b447eb3f69decc68a7695c070c99af (diff) |
Rewrite mesecon wires. This should increase the efficiency and speed of
large machines.
It also makes the wires.lua code easier to understand and more
maintainable. In case any other mod depends on
mesecon:update_autoconnect, please update it to use
mesecon.update_autoconnect. This should also fix some other minor bugs.
Please report bugs if this commit creates new ones.
This commit changes wire looks and removes some unneccesary textures.
Diffstat (limited to 'mesecons_microcontroller')
-rw-r--r-- | mesecons_microcontroller/init.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index 8c9f3b8..9883b85 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -1,5 +1,7 @@ EEPROM_SIZE = 255 +local microc_rules = {} + for a = 0, 1 do for b = 0, 1 do for c = 0, 1 do @@ -34,7 +36,7 @@ if (a == 0) then table.insert(input_rules, {x = -1, y = 0, z = 0, name = "A"}) if (b == 0) then table.insert(input_rules, {x = 0, y = 0, z = 1, name = "B"}) end if (c == 0) then table.insert(input_rules, {x = 1, y = 0, z = 0, name = "C"}) end if (d == 0) then table.insert(input_rules, {x = 0, y = 0, z = -1, name = "D"}) end -mesecon:add_rules(nodename, rules) +microc_rules[nodename] = rules local mesecons = {effector = { @@ -131,7 +133,7 @@ minetest.register_node(nodename, { sounds = default.node_sound_stone_defaults(), mesecons = mesecons, after_dig_node = function (pos, node) - rules = mesecon:get_rules(node.name) + rules = microc_rules[node.name] mesecon:receptor_off(pos, rules) end, }) @@ -600,22 +602,22 @@ function yc_action_setports(pos, L, Lv) local name = "mesecons_microcontroller:microcontroller" local rules if Lv.a ~= L.a then - rules = mesecon:get_rules(name.."0001") + rules = microc_rules[name.."0001"] if L.a == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.b ~= L.b then - rules = mesecon:get_rules(name.."0010") + rules = microc_rules[name.."0010"] if L.b == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.c ~= L.c then - rules = mesecon:get_rules(name.."0100") + rules = microc_rules[name.."0100"] if L.c == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.d ~= L.d then - rules = mesecon:get_rules(name.."1000") + rules = microc_rules[name.."1000"] if L.d == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end |