Merge branch 'master' into luacontroller

This commit is contained in:
Jeija 2013-02-11 08:03:08 +01:00
commit 10ea3c971b
8 changed files with 81 additions and 33 deletions

View File

@ -128,6 +128,10 @@ for zmy=0, 1 do
description = "Wire ID:"..nodeid,
drawtype = "nodebox",
tiles = tiles_on,
-- inventory_image = "wires_inv.png",
-- wield_image = "wires_inv.png",
inventory_image = "jeija_mesecon_off.png",
wield_image = "jeija_mesecon_off.png",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,

View File

@ -1 +1,2 @@
mesecons
doors

View File

@ -43,7 +43,7 @@ function doors:register_door(name, def)
end
end
local function on_punch(pos, dir, check_name, replace, replace_dir, params)
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir
if not minetest.env:get_node(pos).name == check_name then
return
@ -62,11 +62,11 @@ function doors:register_door(name, def)
end
local function on_mesecons_signal_open (pos, node)
on_punch(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end
local function on_mesecons_signal_close (pos, node)
on_punch(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end
local function check_player_priv(pos, player)
@ -99,9 +99,9 @@ function doors:register_door(name, def)
after_dig_node(pos, name.."_t_1")
end,
on_punch = function(pos, node, puncher)
on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then
on_punch(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end
end,
@ -133,9 +133,9 @@ function doors:register_door(name, def)
after_dig_node(pos, name.."_t_2")
end,
on_punch = function(pos, node, puncher)
on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then
on_punch(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end
end,

View File

@ -10,8 +10,8 @@ local tbox = {
local bbox = {
type = "fixed",
fixed = {{ -.5, -.5, -.5, .5, -.5+1/16, .5},
{-1/16, -.5, -1/16, 1/16, .5 , 1/16}}
fixed = {{ -.5, -.5 , -.5, .5, -.5+1/16, .5},
{-1/16, -.5+1/16, -1/16, 1/16, .5 , 1/16}}
}
local vrules =

View File

@ -20,6 +20,7 @@ end
function mesecon:mvps_process_stack(stack)
-- update mesecons for placed nodes ( has to be done after all nodes have been added )
for _, n in ipairs(stack) do
nodeupdate(n.pos)
mesecon.on_placenode(n.pos, minetest.env:get_node(n.pos))
mesecon:update_autoconnect(n.pos)
end
@ -57,7 +58,6 @@ function mesecon:mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio
-- remove all nodes
for _, n in ipairs(nodes) do
minetest.env:remove_node(n.pos)
nodeupdate(n.pos)
end
-- update mesecons for removed nodes ( has to be done after all nodes have been removed )
@ -70,7 +70,6 @@ function mesecon:mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio
for _, n in ipairs(nodes) do
np = mesecon:addPosRule(n.pos, dir)
minetest.env:add_node(np, n.node)
nodeupdate(np)
end
for i in ipairs(nodes) do

View File

@ -153,10 +153,12 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
"mesecons_piston_back.png",
"mesecons_piston_on_front.png"
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher,
node_box = piston_on_box,
selection_box = piston_on_box,
@ -230,10 +232,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
"mesecons_piston_back.png",
"mesecons_piston_on_front.png"
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher,
node_box = piston_on_box,
selection_box = piston_on_box,
@ -303,9 +307,11 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
"mesecons_piston_bottom.png",
"mesecons_piston_top.png^[transformR180",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_up,
mesecons = {effector={
action_on = piston_on,
@ -323,10 +329,12 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
"mesecons_piston_bottom.png",
"mesecons_piston_top.png^[transformR180",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher,
node_box = piston_up_on_box,
selection_box = piston_up_on_box,
@ -379,9 +387,11 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
"mesecons_piston_top.png^[transformR180",
"mesecons_piston_tb.png"
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"},
drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_up,
mesecons = {effector={
action_on = piston_on,
@ -399,10 +409,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
"mesecons_piston_bottom.png",
"mesecons_piston_top.png^[transformR180",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher,
node_box = piston_up_on_box,
selection_box = piston_up_on_box,
@ -473,9 +485,11 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", {
"mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_top.png",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_down,
mesecons = {effector={
action_on = piston_on,
@ -493,10 +507,12 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
"mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_top.png",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher,
node_box = piston_down_on_box,
selection_box = piston_down_on_box,
@ -545,9 +561,11 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
"mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_top.png",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"},
drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_down,
mesecons = {effector={
action_on = piston_on,
@ -565,10 +583,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
"mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_top.png",
},
inventory_image = "mesecons_piston_top.png",
wield_image = "mesecons_piston_top.png",
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"},
drop = "mesecons_pistons:piston_sticky_off",
after_dig_node = piston_remove_pusher,
node_box = piston_down_on_box,
selection_box = piston_down_on_box,
@ -670,7 +690,7 @@ mesecon:register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_u
--craft recipes
minetest.register_craft({
output = '"mesecons_pistons:piston_normal" 2',
output = 'mesecons_pistons:piston_normal_off 2',
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:cobble", "default:steel_ingot", "default:cobble"},
@ -679,9 +699,9 @@ minetest.register_craft({
})
minetest.register_craft({
output = "mesecons_pistons:piston_sticky",
output = "mesecons_pistons:piston_sticky_off",
recipe = {
{"mesecons_materials:glue"},
{"mesecons_pistons:piston_normal"},
{"mesecons_pistons:piston_normal_off"},
}
})

View File

@ -31,10 +31,17 @@ minetest.register_node("mesecons_random:ghoststone", {
inventory_image = minetest.inventorycube("jeija_ghoststone_inv.png"),
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
mesecons = {effector = {
action_on = function (pos, node)
minetest.env:add_node(pos, {name="mesecons_random:ghoststone_active"})
end
mesecons = {conductor = {
state = mesecon.state.off,
rules = { --axes
{x = -1, y = 0, z = 0},
{x = 1, y = 0, z = 0},
{x = 0, y = -1, z = 0},
{x = 0, y = 1, z = 0},
{x = 0, y = 0, z = -1},
{x = 0, y = 0, z = 1},
},
onstate = "mesecons_random:ghoststone_active"
}}
})
@ -44,11 +51,26 @@ minetest.register_node("mesecons_random:ghoststone_active", {
walkable = false,
diggable = false,
sunlight_propagates = true,
mesecons = {effector = {
action_off = function (pos, node)
minetest.env:add_node(pos, {name="mesecons_random:ghoststone"})
paramtype = "light",
mesecons = {conductor = {
state = mesecon.state.on,
rules = {
{x = -1, y = 0, z = 0},
{x = 1, y = 0, z = 0},
{x = 0, y = -1, z = 0},
{x = 0, y = 1, z = 0},
{x = 0, y = 0, z = -1},
{x = 0, y = 0, z = 1},
},
offstate = "mesecons_random:ghoststone"
}},
on_construct = function(pos)
--remove shadow
pos2 = {x = pos.x, y = pos.y + 1, z = pos.z}
if ( minetest.env:get_node(pos2).name == "air" ) then
minetest.env:dig_node(pos2)
end
}}
end
})

View File

@ -128,8 +128,10 @@ function mesecon:receiver_remove(rcpt_pos, dugnode)
local nn = minetest.env:get_node(pos)
if string.find(nn.name, "mesecons_receiver:receiver_") ~=nil then
minetest.env:dig_node(pos)
minetest.env:place_node(pos, {name = "mesecons:wire_00000000_off"})
local node = {name = "mesecons:wire_00000000_off"}
minetest.env:add_node(pos, node)
mesecon:update_autoconnect(pos)
mesecon.on_placenode(pos, node)
end
end