Skip to content

Commit 2d0ff5e

Browse files
author
VanessaE
committedNov 29, 2013
Merge pull request #124 from qwrwed/master
Make blinkyplants toggleable
2 parents 9ab0d9d + 33de6fa commit 2d0ff5e

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed
 

‎mesecons_blinkyplant/init.lua

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
-- The BLINKY_PLANT
2+
minetest.register_node("mesecons_blinkyplant:blinky_plant", {
3+
drawtype = "plantlike",
4+
visual_scale = 1,
5+
tiles = {"jeija_blinky_plant_off.png"},
6+
inventory_image = "jeija_blinky_plant_off.png",
7+
walkable = false,
8+
groups = {snappy=3},
9+
description="Deactivated Blinky Plant",
10+
sounds = default.node_sound_leaves_defaults(),
11+
selection_box = {
12+
type = "fixed",
13+
fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
14+
},
15+
mesecons = {receptor = {
16+
state = mesecon.state.off
17+
}},
18+
on_punch = function(pos, node, puncher)
19+
minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
20+
end
21+
})
222

323
minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
424
drawtype = "plantlike",
@@ -7,7 +27,7 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
727
inventory_image = "jeija_blinky_plant_off.png",
828
paramtype = "light",
929
walkable = false,
10-
groups = {dig_immediate=3, mesecon = 2},
30+
groups = {snappy=3, mesecon = 2},
1131
description="Blinky Plant",
1232
sounds = default.node_sound_leaves_defaults(),
1333
selection_box = {
@@ -16,7 +36,10 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
1636
},
1737
mesecons = {receptor = {
1838
state = mesecon.state.off
19-
}}
39+
}},
40+
on_punch = function(pos, node, puncher)
41+
minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant"})
42+
end
2043
})
2144

2245
minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
@@ -26,7 +49,7 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
2649
inventory_image = "jeija_blinky_plant_off.png",
2750
paramtype = "light",
2851
walkable = false,
29-
groups = {dig_immediate=3, not_in_creative_inventory=1, mesecon = 2},
52+
groups = {snappy=3, not_in_creative_inventory=1, mesecon = 2},
3053
drop="mesecons_blinkyplant:blinky_plant_off 1",
3154
light_source = LIGHT_MAX-7,
3255
description = "Blinky Plant",
@@ -37,7 +60,11 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
3760
},
3861
mesecons = {receptor = {
3962
state = mesecon.state.on
40-
}}
63+
}},
64+
on_punch = function(pos, node, puncher)
65+
mesecon:swap_node(pos, "mesecons_blinkyplant:blinky_plant")
66+
mesecon:receptor_off(pos)
67+
end
4168
})
4269

4370
minetest.register_craft({

0 commit comments

Comments
 (0)
Please sign in to comment.