summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2012-12-21 16:22:25 +0100
committerJeija <norrepli@gmail.com>2012-12-21 16:22:25 +0100
commit23bebfc054008d2b6796e3f10d3bc67bee8b31ed (patch)
tree72b8a71d75b16cf0a8b5d82758d3269beedf50d9
parent9019a4aff7a59bf5d6b4bc1efa177ffd45f6d125 (diff)
parent973a9c650f72ce694bd31dfbc5d6030751ff7c05 (diff)
downloadmesecons-23bebfc054008d2b6796e3f10d3bc67bee8b31ed.tar
mesecons-23bebfc054008d2b6796e3f10d3bc67bee8b31ed.tar.gz
mesecons-23bebfc054008d2b6796e3f10d3bc67bee8b31ed.tar.bz2
mesecons-23bebfc054008d2b6796e3f10d3bc67bee8b31ed.tar.xz
mesecons-23bebfc054008d2b6796e3f10d3bc67bee8b31ed.zip
Merge branch 'master' into nextgen
Conflicts: mesecons/internal.lua mesecons/wires.lua mesecons_pistons/init.lua
-rw-r--r--mesecons/internal.lua1
-rw-r--r--mesecons/wires.lua6
-rw-r--r--mesecons_extrawires/vertical.lua9
-rw-r--r--mesecons_pistons/init.lua57
4 files changed, 27 insertions, 46 deletions
diff --git a/mesecons/internal.lua b/mesecons/internal.lua
index 96e407e..3f2ceb3 100644
--- a/mesecons/internal.lua
+++ b/mesecons/internal.lua
@@ -134,6 +134,7 @@ function mesecon:receptor_get_rules(node)
return rules
end
end
+
return mesecon.rules.default
end
diff --git a/mesecons/wires.lua b/mesecons/wires.lua
index 6c5f6ef..d753120 100644
--- a/mesecons/wires.lua
+++ b/mesecons/wires.lua
@@ -243,3 +243,9 @@ minetest.register_craft({
{'"default:mese"'},
}
})
+
+minetest.register_craft({
+ type = "cooking",
+ output = '"mesecons:wire_00000000_off" 16',
+ recipe = "default:mese_crystal",
+})
diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua
index 652205d..b21ccb7 100644
--- a/mesecons_extrawires/vertical.lua
+++ b/mesecons_extrawires/vertical.lua
@@ -35,8 +35,8 @@ local brules =
local vertical_updatepos = function (pos)
local node = minetest.env:get_node(pos)
if minetest.registered_nodes[node.name].is_vertical_conductor then
- local node_above = minetest.env:get_node(addPosRule(pos, vrules[1]))
- local node_below = minetest.env:get_node(addPosRule(pos, vrules[2]))
+ local node_above = minetest.env:get_node(mesecon:addPosRule(pos, vrules[1]))
+ local node_below = minetest.env:get_node(mesecon:addPosRule(pos, vrules[2]))
local namestate = minetest.registered_nodes[node.name].vertical_conductor_state
-- above and below: vertical mesecon
@@ -64,10 +64,9 @@ local vertical_updatepos = function (pos)
end
local vertical_update = function (pos, node)
- print("update")
vertical_updatepos(pos) -- this one
- vertical_updatepos(addPosRule(pos, vrules[1])) -- above
- vertical_updatepos(addPosRule(pos, vrules[2])) -- below
+ vertical_updatepos(mesecon:addPosRule(pos, vrules[1])) -- above
+ vertical_updatepos(mesecon:addPosRule(pos, vrules[2])) -- below
end
-- Vertical wire
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua
index 028eb54..e5228d4 100644
--- a/mesecons_pistons/init.lua
+++ b/mesecons_pistons/init.lua
@@ -192,28 +192,16 @@ minetest.register_node("mesecons_pistons:piston_normal", {
paramtype2 = "facedir",
after_destruct = destruct,
on_timer = timer,
- on_place = function(itemstack, placer, pointed_thing)
- if pointed_thing.type ~= "node" then --can be placed only on nodes
- return itemstack
- end
- if not placer then
- return minetest.item_place(itemstack, placer, pointed_thing)
+ after_place_node = function(pos, placer)
+ if not placer then --not placed by player
+ return
end
- local dir = placer:get_look_dir()
- if math.abs(dir.y) > math.sqrt(dir.x ^ 2 + dir.z ^ 2) then --vertical look direction is most significant
- local fakestack
- if dir.y > 0 then
- fakestack = ItemStack("mesecons_pistons:piston_down_normal")
- else
- fakestack = ItemStack("mesecons_pistons:piston_up_normal")
- end
- local ret = minetest.item_place(fakestack, placer, pointed_thing)
- if ret:is_empty() then
- itemstack:take_item()
- return itemstack
- end
+ local pitch = placer:get_look_pitch() * (180 / math.pi) --placer pitch in degrees
+ if pitch > 45 then --looking upwards
+ minetest.env:add_node(pos, {name="mesecons_pistons:piston_down_normal"})
+ elseif pitch < -45 then --looking downwards
+ minetest.env:add_node(pos, {name="mesecons_pistons:piston_up_normal"})
end
- return minetest.item_place(itemstack, placer, pointed_thing) --place piston normally
end,
mesecons = {effector={
action_change = update,
@@ -228,29 +216,16 @@ minetest.register_node("mesecons_pistons:piston_sticky", {
paramtype2 = "facedir",
after_destruct = destruct,
on_timer = timer,
- is_sticky_piston = true,
- on_place = function(itemstack, placer, pointed_thing)
- if pointed_thing.type ~= "node" then --can be placed only on nodes
- return itemstack
- end
- if not placer then
- return minetest.item_place(itemstack, placer, pointed_thing)
+ after_place_node = function(pos, placer)
+ if not placer then --not placed by player
+ return
end
- local dir = placer:get_look_dir()
- if math.abs(dir.y) > math.sqrt(dir.x ^ 2 + dir.z ^ 2) then --vertical look direction is most significant
- local fakestack
- if dir.y > 0 then
- fakestack = ItemStack("mesecons_pistons:piston_down_sticky")
- else
- fakestack = ItemStack("mesecons_pistons:piston_up_sticky")
- end
- local ret = minetest.item_place(fakestack, placer, pointed_thing)
- if ret:is_empty() then
- itemstack:take_item()
- return itemstack
- end
+ local pitch = placer:get_look_pitch() * (180 / math.pi) --placer pitch in degrees
+ if pitch > 45 then --looking upwards
+ minetest.env:add_node(pos, {name="mesecons_pistons:piston_down_sticky"})
+ elseif pitch < -45 then --looking downwards
+ minetest.env:add_node(pos, {name="mesecons_pistons:piston_up_sticky"})
end
- return minetest.item_place(itemstack, placer, pointed_thing) --place piston normally
end,
mesecons = {effector={
action_change = update,