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_pressureplates | |
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_pressureplates')
-rw-r--r-- | mesecons_pressureplates/init.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua index 788dd95..e9fdf7f 100644 --- a/mesecons_pressureplates/init.lua +++ b/mesecons_pressureplates/init.lua @@ -17,23 +17,23 @@ pp_on_timer = function (pos, elapsed) if not basename then return end local objs = minetest.get_objects_inside_radius(pos, 1) - local two_below = mesecon:addPosRule(pos, {x = 0, y = -2, z = 0}) + local two_below = mesecon.addPosRule(pos, {x = 0, y = -2, z = 0}) if objs[1] == nil and node.name == basename .. "_on" then minetest.add_node(pos, {name = basename .. "_off"}) - mesecon:receptor_off(pos, mesecon.rules.pplate) + mesecon.receptor_off(pos, mesecon.rules.pplate) -- force deactivation of mesecon two blocks below (hacky) - if not mesecon:connected_to_receptor(two_below) then - mesecon:turnoff(two_below) + if not mesecon.connected_to_receptor(two_below) then + mesecon.turnoff(two_below) end else for k, obj in pairs(objs) do local objpos = obj:getpos() if objpos.y > pos.y-1 and objpos.y < pos.y then minetest.add_node(pos, {name = basename .. "_on"}) - mesecon:receptor_on(pos, mesecon.rules.pplate ) + mesecon.receptor_on(pos, mesecon.rules.pplate ) -- force activation of mesecon two blocks below (hacky) - mesecon:turnon(two_below) + mesecon.turnon(two_below) end end end @@ -49,7 +49,7 @@ end -- image: inventory and wield image of the pressure plate -- recipe: crafting recipe of the pressure plate -function mesecon:register_pressure_plate(basename, description, textures_off, textures_on, image_w, image_i, recipe) +function mesecon.register_pressure_plate(basename, description, textures_off, textures_on, image_w, image_i, recipe) mesecon.register_node(basename, { drawtype = "nodebox", inventory_image = image_i, @@ -81,7 +81,7 @@ function mesecon:register_pressure_plate(basename, description, textures_off, te }) end -mesecon:register_pressure_plate( +mesecon.register_pressure_plate( "mesecons_pressureplates:pressure_plate_wood", "Wooden Pressure Plate", {"jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off_edges.png"}, @@ -90,7 +90,7 @@ mesecon:register_pressure_plate( "jeija_pressure_plate_wood_inv.png", {{"group:wood", "group:wood"}}) -mesecon:register_pressure_plate( +mesecon.register_pressure_plate( "mesecons_pressureplates:pressure_plate_stone", "Stone Pressure Plate", {"jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off_edges.png"}, |