Add labels to all ABMs
[minetest_hades/hades_revisited.git] / mods / mesecons / mesecons_blinkyplant / init.lua
blob99923988f16038f14481f8319f1072ac4462cea6
1 -- The BLINKY_PLANT
2 minetest.register_node("mesecons_blinkyplant:blinky_plant", {
3 drawtype = "plantlike",
4 visual_scale = 1,
5 paramtype = "light",
6 tiles = {"jeija_blinky_plant_off.png"},
7 inventory_image = "jeija_blinky_plant_off.png",
8 walkable = false,
9 groups = {dig_immediate=3, not_in_creative_inventory=1},
10 drop="mesecons_blinkyplant:blinky_plant_off 1",
11 description="Deactivated Blinky Plant",
12 sounds = hades_sounds.node_sound_leaves_defaults(),
13 selection_box = {
14 type = "fixed",
15 fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
17 mesecons = {receptor = {
18 state = mesecon.state.off
19 }},
20 on_rightclick = function(pos, node, clicker)
21 minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
22 end
25 minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
26 drawtype = "plantlike",
27 visual_scale = 1,
28 tiles = {"jeija_blinky_plant_off.png"},
29 inventory_image = "jeija_blinky_plant_off.png",
30 paramtype = "light",
31 walkable = false,
32 groups = {dig_immediate=3, mesecon=2},
33 description="Blinky Plant",
34 sounds = hades_sounds.node_sound_leaves_defaults(),
35 selection_box = {
36 type = "fixed",
37 fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
39 mesecons = {receptor = {
40 state = mesecon.state.off
41 }},
42 on_rightclick = function(pos, node, clicker)
43 minetest.set_node(pos, {name="mesecons_blinkyplant:blinky_plant"})
44 end
47 minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
48 drawtype = "plantlike",
49 visual_scale = 1,
50 tiles = {"jeija_blinky_plant_on.png"},
51 inventory_image = "jeija_blinky_plant_off.png",
52 paramtype = "light",
53 walkable = false,
54 groups = {dig_immediate=3, not_in_creative_inventory=1, mesecon=2},
55 drop="mesecons_blinkyplant:blinky_plant_off 1",
56 light_source = minetest.LIGHT_MAX-7,
57 description = "Blinky Plant",
58 sounds = hades_sounds.node_sound_leaves_defaults(),
59 selection_box = {
60 type = "fixed",
61 fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
63 mesecons = {receptor = {
64 state = mesecon.state.on
65 }},
66 on_rightclick = function(pos, node, clicker)
67 minetest.set_node(pos, {name = "mesecons_blinkyplant:blinky_plant"})
68 mesecon:receptor_off(pos)
69 end
72 minetest.register_craft({
73 output = "mesecons_blinkyplant:blinky_plant_off 1",
74 recipe = {
75 {"","group:mesecon_conductor_craftable",""},
76 {"","group:mesecon_conductor_craftable",""},
77 {"group:sapling","group:sapling","group:sapling"},
81 minetest.register_abm({
82 label = "Blink blinky plant on",
83 nodenames = {"mesecons_blinkyplant:blinky_plant_off"},
84 interval = BLINKY_PLANT_INTERVAL,
85 chance = 1,
86 action = function(pos, node, active_object_count, active_object_count_wider)
87 --minetest.remove_node(pos)
88 minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
89 minetest.check_for_falling(pos)
90 mesecon:receptor_on(pos)
91 end,
94 minetest.register_abm({
95 label = "Blink blinky plant off",
96 nodenames = {"mesecons_blinkyplant:blinky_plant_on"},
97 interval = BLINKY_PLANT_INTERVAL,
98 chance = 1,
99 action = function(pos, node, active_object_count, active_object_count_wider)
100 --minetest.remove_node(pos)
101 minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
102 minetest.check_for_falling(pos)
103 mesecon:receptor_off(pos)
104 end,