Add timer blocks
[minetest_pseudonodes.git] / init.lua
blob867bb8ee29b3b21485a1a6d38752610d6959b6ce
1 minetest.register_node("pseudonodes:pseudo_block", {
2 description = "pseudo-block",
3 drawtype = "glasslike",
4 paramtype = "light",
5 tiles = { "pseudonodes_pseudo_block.png" },
6 inventory_image = minetest.inventorycube("pseudonodes_pseudo_block.png"),
7 groups = { pseudo = 1 },
8 sunlight_propagates = true,
9 walkable = false,
10 sounds = { dig = { name="", gain = 0 } },
11 alpha = 0
13 minetest.register_node("pseudonodes:replacable_pseudo_block", {
14 description = "replacable fixed pseudo-block",
15 drawtype = "glasslike",
16 paramtype = "light",
17 tiles = { "pseudonodes_replacable_pseudo_block.png" },
18 inventory_image = minetest.inventorycube("pseudonodes_replacable_pseudo_block.png"),
19 groups = { pseudo = 1 },
20 sunlight_propagates = true,
21 walkable = false,
22 sounds = { dig = { name="", gain = 0 } },
23 alpha = 0,
24 buildable_to = true
27 minetest.register_node("pseudonodes:pseudo_block_timer", {
28 description = "timed pseudo-block",
29 drawtype = "glasslike",
30 paramtype = "light",
31 tiles = {
33 image="pseudonodes_pseudo_block_timer_animated.png",
34 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
37 inventory_image = minetest.inventorycube("pseudonodes_pseudo_block_timer.png"),
38 groups = { pseudo = 1 },
39 sunlight_propagates = true,
40 walkable = false,
41 sounds = { dig = { name="", gain = 0 } },
42 alpha = 0,
43 on_construct = function(pos)
44 local timer = minetest.get_node_timer(pos)
45 timer:start(5)
46 end,
47 on_timer = function(pos,elapsed)
48 minetest.remove_node(pos)
49 end,
52 minetest.register_node("pseudonodes:replacable_pseudo_block_timer", {
53 description = "replacable timed pseudo-block",
54 drawtype = "glasslike",
55 paramtype = "light",
56 tiles = {
58 image="pseudonodes_replacable_pseudo_block_timer_animated.png",
59 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
62 inventory_image = minetest.inventorycube("pseudonodes_replacable_pseudo_block_timer.png"),
63 groups = { pseudo = 1 },
64 sunlight_propagates = true,
65 walkable = false,
66 sounds = { dig = { name="", gain = 0 } },
67 alpha = 0,
68 buildable_to = true,
69 on_construct = function(pos)
70 local timer = minetest.get_node_timer(pos)
71 timer:start(5)
72 end,
73 on_timer = function(pos,elapsed)
74 minetest.remove_node(pos)
75 end,
78 minetest.register_node("pseudonodes:switch_block_off", {
79 description = "switch block (off)",
80 drawtype = "glasslike",
81 paramtype = "light",
82 tiles = { "pseudonodes_switch_block_off.png" },
83 inventory_image = minetest.inventorycube("pseudonodes_switch_block_off.png"),
84 sunlight_propagates = true,
85 walkable = false,
86 sounds = { dig = { name="", gain = 0 } },
87 groups = { pseudo = 1 },
88 alpha = 0,
89 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
90 local newnode = node
91 newnode.name = "pseudonodes:switch_block_on"
92 minetest.swap_node(pos, newnode)
93 return itemstack
94 end,
97 minetest.register_node("pseudonodes:switch_block_on", {
98 description = "switch block (on)",
99 tiles = { "pseudonodes_switch_block_on.png" },
100 inventory_image = minetest.inventorycube("pseudonodes_switch_block_on.png"),
101 groups = { pseudo = 1 },
102 diggable = true,
103 walkable = true,
104 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
105 local newnode = node
106 newnode.name = "pseudonodes:switch_block_off"
107 minetest.swap_node(pos, newnode)
108 return itemstack
109 end,
112 minetest.register_node("pseudonodes:ladder", {
113 description = "pseudo-ladder",
114 drawtype = "glasslike",
115 paramtype = "light",
116 tiles = { "pseudonodes_ladder.png" },
117 inventory_image = minetest.inventorycube("pseudonodes_ladder.png"),
118 groups = { pseudo = 1 },
119 sunlight_propagates = true,
120 walkable = false,
121 climbable = true,
122 sounds = { dig = { name="", gain = 0 } },
123 alpha = 0
127 minetest.register_tool("pseudonodes:pick", {
128 description = "pseudo-pick",
129 inventory_image = "pseudonodes_pick.png",
130 tool_capabilities = {
131 groupcaps = { pseudo = { times = {[1]=0}, maxlevel=1, maxwear=0 }},