Skip to content

Commit b4654ce

Browse files
committedDec 1, 2013
Compat shim for minetest.swap_node, lightstone conducts from the bottom.
1 parent 3105ae7 commit b4654ce

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed
 

‎mesecons/legacy.lua

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
minetest.swap_node = minetest.swap_node or function(pos, node)
2+
local data = minetest.get_meta(pos):to_table()
3+
minetest.add_node(pos, node)
4+
minetest.get_meta(pos):from_table(data)
5+
end

‎mesecons_lightstone/init.lua

+29-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
1+
local lightstone_rules = {
2+
{x=0, y=0, z=-1},
3+
{x=1, y=0, z=0},
4+
{x=-1, y=0, z=0},
5+
{x=0, y=0, z=1},
6+
{x=1, y=1, z=0},
7+
{x=1, y=-1, z=0},
8+
{x=-1, y=1, z=0},
9+
{x=-1, y=-1, z=0},
10+
{x=0, y=1, z=1},
11+
{x=0, y=-1, z=1},
12+
{x=0, y=1, z=-1},
13+
{x=0, y=-1, z=-1},
14+
{x=0, y=-1, z=0},
15+
}
16+
117
function mesecon:lightstone_add(name, base_item, texture_off, texture_on)
218
minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_off", {
3-
tiles = {texture_off},
4-
groups = {cracky=2, mesecon_effector_off = 1, mesecon = 2},
5-
description=name.." Lightstone",
6-
sounds = default.node_sound_stone_defaults(),
7-
mesecons = {effector = {
8-
action_on = function (pos, node)
9-
minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_on", param2 = node.param2})
10-
end
11-
}}
12-
})
19+
tiles = {texture_off},
20+
groups = {cracky=2, mesecon_effector_off = 1, mesecon = 2},
21+
description=name.." Lightstone",
22+
sounds = default.node_sound_stone_defaults(),
23+
mesecons = {effector = {
24+
rules = lightstone_rules,
25+
action_on = function (pos, node)
26+
minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_on", param2 = node.param2})
27+
end,
28+
}}
29+
})
1330
minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_on", {
1431
tiles = {texture_on},
1532
groups = {cracky=2,not_in_creative_inventory=1, mesecon = 2},
1633
drop = "mesecons_lightstone:lightstone_" .. name .. "_off",
1734
light_source = LIGHT_MAX-2,
1835
sounds = default.node_sound_stone_defaults(),
1936
mesecons = {effector = {
37+
rules = lightstone_rules,
2038
action_off = function (pos, node)
2139
minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_off", param2 = node.param2})
22-
end
40+
end,
2341
}}
2442
})
2543

0 commit comments

Comments
 (0)