diff options
author | Jeija <jeija@mesecons.net> | 2014-11-22 15:42:22 +0100 |
---|---|---|
committer | Jeija <jeija@mesecons.net> | 2014-11-22 15:42:22 +0100 |
commit | 5be179bf110b44bdc06df6dbfde4e61487cf0635 (patch) | |
tree | 018eb119344d66d6229ad65607d51360fd006934 /mesecons_luacontroller | |
parent | ffacbfde5a956da910479139f490f8ffa3ae5a85 (diff) |
Replace mesecon:<some_function> with mesecon.<some_function> for greater
flexibility and because it was never inteded to be OOP in the first
place.
mesecon.receptor_on and mesecon.receptor_off are provided by wrappers
(mesecon:receptor_on/off) for compatibility, but will be removed. Mod
programmers that use mesecons: Please update!
Also, fix microcontroller polluting the global namespace and remove some
deprecated stuff.
Diffstat (limited to 'mesecons_luacontroller')
-rw-r--r-- | mesecons_luacontroller/init.lua | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index e4faaad..0887a33 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -38,10 +38,6 @@ function lc_update_real_portstates(pos, rulename, newstate) return end local n = meta:get_int("real_portstates") - 1 - if n < 0 then - legacy_update_ports(pos) - n = meta:get_int("real_portstates") - 1 - end local L = {} for i = 1, 4 do L[i] = n%2 @@ -63,9 +59,6 @@ local get_real_portstates = function(pos) -- determine if ports are powered (by local meta = minetest.get_meta(pos) local L = {} local n = meta:get_int("real_portstates") - 1 - if n < 0 then - return legacy_update_ports(pos) - end for _, index in ipairs({"a", "b", "c", "d"}) do L[index] = ((n%2) == 1) n = math.floor(n/2) @@ -92,9 +85,9 @@ end local setport = function (pos, rule, state) if state then - mesecon:receptor_on(pos, {rule}) + mesecon.receptor_on(pos, {rule}) else - mesecon:receptor_off(pos, {rule}) + mesecon.receptor_off(pos, {rule}) end end @@ -122,7 +115,7 @@ end -------------------- local overheat_off = function(pos) - mesecon:receptor_off(pos, mesecon.rules.flat) + mesecon.receptor_off(pos, mesecon.rules.flat) end ------------------- @@ -484,7 +477,7 @@ minetest.register_node(nodename, { c = c == 1, -- controller powers itself d = d == 1},-- so those that light up after_dig_node = function (pos, node) - mesecon:receptor_off(pos, output_rules) + mesecon.receptor_off(pos, output_rules) end, is_luacontroller = true, }) |