Make blinkyplants toggleable

This commit is contained in:
qwrwed 2013-11-29 22:06:50 +00:00
parent 9ab0d9deb2
commit 33de6fad55

View File

@ -1,4 +1,24 @@
-- The BLINKY_PLANT -- The BLINKY_PLANT
minetest.register_node("mesecons_blinkyplant:blinky_plant", {
drawtype = "plantlike",
visual_scale = 1,
tiles = {"jeija_blinky_plant_off.png"},
inventory_image = "jeija_blinky_plant_off.png",
walkable = false,
groups = {snappy=3},
description="Deactivated Blinky Plant",
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
},
mesecons = {receptor = {
state = mesecon.state.off
}},
on_punch = function(pos, node, puncher)
minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
end
})
minetest.register_node("mesecons_blinkyplant:blinky_plant_off", { minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
drawtype = "plantlike", drawtype = "plantlike",
@ -7,7 +27,7 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
inventory_image = "jeija_blinky_plant_off.png", inventory_image = "jeija_blinky_plant_off.png",
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
groups = {dig_immediate=3, mesecon = 2}, groups = {snappy=3, mesecon = 2},
description="Blinky Plant", description="Blinky Plant",
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
selection_box = { selection_box = {
@ -16,7 +36,10 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
}, },
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.off state = mesecon.state.off
}} }},
on_punch = function(pos, node, puncher)
minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant"})
end
}) })
minetest.register_node("mesecons_blinkyplant:blinky_plant_on", { minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
@ -26,7 +49,7 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
inventory_image = "jeija_blinky_plant_off.png", inventory_image = "jeija_blinky_plant_off.png",
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
groups = {dig_immediate=3, not_in_creative_inventory=1, mesecon = 2}, groups = {snappy=3, not_in_creative_inventory=1, mesecon = 2},
drop="mesecons_blinkyplant:blinky_plant_off 1", drop="mesecons_blinkyplant:blinky_plant_off 1",
light_source = LIGHT_MAX-7, light_source = LIGHT_MAX-7,
description = "Blinky Plant", description = "Blinky Plant",
@ -37,7 +60,11 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
}, },
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.on state = mesecon.state.on
}} }},
on_punch = function(pos, node, puncher)
mesecon:swap_node(pos, "mesecons_blinkyplant:blinky_plant")
mesecon:receptor_off(pos)
end
}) })
minetest.register_craft({ minetest.register_craft({