summaryrefslogtreecommitdiff
path: root/mesecons_pistons/init.lua
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2012-12-11 19:49:55 +0100
committerJeija <norrepli@gmail.com>2012-12-11 19:49:55 +0100
commitde46729b971b5e59394834b8a01d4a7005318114 (patch)
tree5a2cf1f18b485ddefa8e255ac6d6a600ef2e2e12 /mesecons_pistons/init.lua
parent31f3c99288355193dc68a6e83dfc63140fd02fa0 (diff)
parent5540fcbcb31eb32003fa0391113ed3b1dea25e47 (diff)
downloadmesecons-de46729b971b5e59394834b8a01d4a7005318114.tar
mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.gz
mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.bz2
mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.xz
mesecons-de46729b971b5e59394834b8a01d4a7005318114.zip
Merge branch 'mesecons_in_nodedef'
Conflicts: mesecons/internal.lua
Diffstat (limited to 'mesecons_pistons/init.lua')
-rw-r--r--mesecons_pistons/init.lua26
1 files changed, 12 insertions, 14 deletions
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua
index 935ca66..dd3f599 100644
--- a/mesecons_pistons/init.lua
+++ b/mesecons_pistons/init.lua
@@ -1,5 +1,11 @@
--PISTONS
+local update = function(pos, node)
+ local timer = minetest.env:get_node_timer(pos)
+ timer:stop()
+ timer:start(0)
+end
+
minetest.register_node("mesecons_pistons:piston_normal", {
description = "Piston",
tiles = {"jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_side.png"},
@@ -25,8 +31,10 @@ minetest.register_node("mesecons_pistons:piston_normal", {
end
return false
end,
+ mesecons = {effector={
+ action_change = update
+ }}
})
-mesecon:register_effector("mesecons_pistons:piston_normal", "mesecons_pistons:piston_normal")
minetest.register_node("mesecons_pistons:piston_sticky", {
description = "Sticky Piston",
@@ -53,8 +61,10 @@ minetest.register_node("mesecons_pistons:piston_sticky", {
end
return false
end,
+ mesecons = {effector={
+ action_change = update
+ }}
})
-mesecon:register_effector("mesecons_pistons:piston_sticky", "mesecons_pistons:piston_sticky")
minetest.register_craft({
output = '"mesecons_pistons:piston_normal" 2',
@@ -127,18 +137,6 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", {
mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_normal")
mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_sticky")
-local update = function(pos, node)
- if node.name ~= "mesecons_pistons:piston_normal" and node.name ~= "mesecons_pistons:piston_sticky" then
- return
- end
-
- local timer = minetest.env:get_node_timer(pos)
- timer:stop()
- timer:start(0)
-end
-mesecon:register_on_signal_on(update) --push action
-mesecon:register_on_signal_off(update) --pull action
-
function mesecon:piston_push(pos)
local node = minetest.env:get_node(pos)
local dir = mesecon:piston_get_direction(node)