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_pistons | |
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_pistons')
-rw-r--r-- | mesecons_pistons/init.lua | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index efc18f3..ee7c228 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -33,7 +33,7 @@ local piston_down_rules = local piston_get_rules = function (node) local rules = piston_rules for i = 1, node.param2 do - rules = mesecon:rotate_rules_left(rules) + rules = mesecon.rotate_rules_left(rules) end return rules end @@ -41,7 +41,7 @@ end piston_facedir_direction = function (node) local rules = {{x = 0, y = 0, z = -1}} for i = 1, node.param2 do - rules = mesecon:rotate_rules_left(rules) + rules = mesecon.rotate_rules_left(rules) end return rules[1] end @@ -57,7 +57,7 @@ end local piston_remove_pusher = function(pos, node) pistonspec = minetest.registered_nodes[node.name].mesecons_piston dir = piston_get_direction(pistonspec.dir, node) - local pusherpos = mesecon:addPosRule(pos, dir) + local pusherpos = mesecon.addPosRule(pos, dir) local pushername = minetest.get_node(pusherpos).name -- make sure there actually is a pusher (for compatibility reasons mainly) @@ -78,8 +78,8 @@ local piston_on = function(pos, node) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston local dir = piston_get_direction(pistonspec.dir, node) - local np = mesecon:addPosRule(pos, dir) - local success, stack, oldstack = mesecon:mvps_push(np, dir, PISTON_MAXIMUM_PUSH) + local np = mesecon.addPosRule(pos, dir) + local success, stack, oldstack = mesecon.mvps_push(np, dir, PISTON_MAXIMUM_PUSH) if success then minetest.add_node(pos, {param2 = node.param2, name = pistonspec.onname}) minetest.add_node(np, {param2 = node.param2, name = pistonspec.pusher}) @@ -88,8 +88,8 @@ local piston_on = function(pos, node) max_hear_distance = 20, gain = 0.3, }) - mesecon:mvps_process_stack (stack) - mesecon:mvps_move_objects (np, dir, oldstack) + mesecon.mvps_process_stack (stack) + mesecon.mvps_move_objects (np, dir, oldstack) end end @@ -100,9 +100,9 @@ local piston_off = function(pos, node) if pistonspec.sticky then dir = piston_get_direction(pistonspec.dir, node) - pullpos = mesecon:addPosRule(pos, dir) - stack = mesecon:mvps_pull_single(pullpos, dir) - mesecon:mvps_process_stack(pos, dir, stack) + pullpos = mesecon.addPosRule(pos, dir) + stack = mesecon.mvps_pull_single(pullpos, dir) + mesecon.mvps_process_stack(pos, dir, stack) end end @@ -693,14 +693,14 @@ local piston_pusher_up_down_get_stopper = function (node, dir, stack, stackid) return true end -mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_normal", piston_pusher_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_sticky", piston_pusher_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_normal", piston_pusher_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_sticky", piston_pusher_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_up_pusher_normal", piston_pusher_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_up_pusher_sticky", piston_pusher_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_up_pusher_normal", piston_pusher_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_up_pusher_sticky", piston_pusher_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_down_pusher_normal", piston_pusher_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_down_pusher_sticky", piston_pusher_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_down_pusher_normal", piston_pusher_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_down_pusher_sticky", piston_pusher_up_down_get_stopper) -- Register pistons as stoppers if they would be seperated from the stopper @@ -717,12 +717,12 @@ end local piston_get_stopper = function (node, dir, stack, stackid) pistonspec = minetest.registered_nodes[node.name].mesecons_piston dir = piston_get_direction(pistonspec.dir, node) - local pusherpos = mesecon:addPosRule(stack[stackid].pos, dir) + local pusherpos = mesecon.addPosRule(stack[stackid].pos, dir) local pushernode = minetest.get_node(pusherpos) if minetest.registered_nodes[node.name].mesecons_piston.pusher == pushernode.name then for _, s in ipairs(stack) do - if mesecon:cmpPos(s.pos, pusherpos) -- pusher is also to be pushed + if mesecon.cmpPos(s.pos, pusherpos) -- pusher is also to be pushed and s.node.param2 == node.param2 then return false end @@ -731,14 +731,14 @@ local piston_get_stopper = function (node, dir, stack, stackid) return true end -mesecon:register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_up_normal_on", piston_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_up_sticky_on", piston_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_up_normal_on", piston_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_up_sticky_on", piston_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_down_normal_on", piston_up_down_get_stopper) -mesecon:register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_down_normal_on", piston_up_down_get_stopper) +mesecon.register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_up_down_get_stopper) --craft recipes minetest.register_craft({ |