1 --ore def with required tool
2 local ores = {"coal","iron","gold","diamond"}
3 local tool = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"}
4 for id,ore in pairs(ores) do
5 local tool_required = {}
7 table.insert(tool_required, tool[i])
10 local drops = {"main:"..ore.."ore"}
11 if ore == "diamond" then drops = {"main:diamond"} elseif ore == "coal" then drops = {"main:coal"} end
13 minetest.register_node("main:"..ore.."ore", {
14 description = ore:gsub("^%l", string.upper).." Ore",
15 tiles = {"stone.png^"..ore.."ore.png"},
16 groups = {stone = id, pathable = 1},
17 sounds = main.stoneSound(),
18 --light_source = 14,--debugging ore spawn
24 tools = tool_required,
32 minetest.register_node("main:stone", {
33 description = "Stone",
34 tiles = {"stone.png"},
35 groups = {stone = 1, hand = 1,pathable = 1},
36 sounds = main.stoneSound(),
38 redstone_activation = function(pos)
41 redstone_deactivation = function(pos)
42 minetest.set_node(pos,{name="main:cobble"})
51 items = {"main:cobble"},
57 minetest.register_node("main:cobble", {
58 description = "Cobblestone",
59 tiles = {"cobble.png"},
60 groups = {stone = 1, pathable = 1},
61 sounds = main.stoneSound(),
63 redstone_activation = function(pos)
64 minetest.set_node(pos,{name="main:stone"})
66 redstone_deactivation = function(pos)
76 items = {"main:cobble"},
82 minetest.register_node("main:glass", {
83 description = "Glass",
84 tiles = {"glass.png"},
85 drawtype = "glasslike",
87 sunlight_propagates = true,
88 is_ground_content = false,
89 groups = {glass = 1, pathable = 1},
90 sounds = main.stoneSound({
91 footstep = {name = "glass_footstep", gain = 0.4},
92 dug = {name = "break_glass", gain = 0.4},
97 minetest.register_node("main:dirt", {
100 groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
101 sounds = main.dirtSound(),
105 minetest.register_node("main:grass", {
106 description = "Grass",
107 tiles = {"grass.png"},
108 groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
109 sounds = main.dirtSound(),
113 minetest.register_node("main:sand", {
114 description = "Sand",
115 tiles = {"sand.png"},
116 groups = {sand = 1, falling_node = 1,pathable = 1},
117 sounds = main.sandSound(),
120 minetest.register_node("main:gravel", {
121 description = "Gravel",
122 tiles = {"gravel.png"},
123 groups = {sand = 1, falling_node = 1,pathable = 1},
124 sounds = main.dirtSound(),
129 -- Only drop if using a tool whose name is identical to one
132 items = {"main:flint"},
133 -- Whether all items in the dropped item list inherit the
134 -- hardware coloring palette color from the dug node.
135 -- Default is 'false'.
136 --inherit_color = true,
139 -- Only drop if using a tool whose name is identical to one
141 --tools = {"main:shears"},
143 items = {"main:gravel"},
144 -- Whether all items in the dropped item list inherit the
145 -- hardware coloring palette color from the dug node.
146 -- Default is 'false'.
147 --inherit_color = true,
152 minetest.register_node("main:tree", {
153 description = "Tree",
154 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
155 groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
156 sounds = main.woodSound(),
157 --set metadata so treecapitator doesn't destroy houses
158 on_place = function(itemstack, placer, pointed_thing)
159 if not pointed_thing.type == "node" then
163 local sneak = placer:get_player_control().sneak
164 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
165 if not sneak and noddef.on_rightclick then
166 minetest.item_place(itemstack, placer, pointed_thing)
170 local pos = pointed_thing.above
171 minetest.item_place_node(itemstack, placer, pointed_thing)
172 local meta = minetest.get_meta(pos)
173 meta:set_string("placed", "true")
176 --treecapitator - move treecapitator into own file using override
177 on_dig = function(pos, node, digger)
179 --check if wielding axe?
181 local meta = minetest.get_meta(pos)
182 if not meta:contains("placed") then
185 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
187 if name == "main:tree" or name == "redstone:node_activated_tree" then
188 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
192 minetest.node_dig(pos, node, digger)
197 minetest.register_node("main:wood", {
198 description = "Wood",
199 tiles = {"wood.png"},
200 groups = {wood = 1, pathable = 1,flammable=1},
201 sounds = main.woodSound(),
204 minetest.register_node("main:leaves", {
205 description = "Leaves",
206 drawtype = "allfaces_optional",
211 is_ground_content = false,
212 tiles = {"leaves.png"},
213 groups = {leaves = 1, leafdecay = 1,flammable=1},
214 sounds = main.grassSound(),
219 -- Only drop if using a tool whose name is identical to one
222 items = {"main:sapling"},
223 -- Whether all items in the dropped item list inherit the
224 -- hardware coloring palette color from the dug node.
225 -- Default is 'false'.
226 --inherit_color = true,
229 -- Only drop if using a tool whose name is identical to one
231 tools = {"main:shears"},
233 items = {"main:leaves"},
234 -- Whether all items in the dropped item list inherit the
235 -- hardware coloring palette color from the dug node.
236 -- Default is 'false'.
237 --inherit_color = true,
240 -- Only drop if using a tool whose name is identical to one
242 tools = {"main:shears"},
244 items = {"main:stick"},
245 -- Whether all items in the dropped item list inherit the
246 -- hardware coloring palette color from the dug node.
247 -- Default is 'false'.
248 --inherit_color = true,
251 -- Only drop if using a tool whose name is identical to one
253 tools = {"main:shears"},
255 items = {"main:apple"},
256 -- Whether all items in the dropped item list inherit the
257 -- hardware coloring palette color from the dug node.
258 -- Default is 'false'.
259 --inherit_color = true,
265 minetest.register_node("main:water", {
266 description = "Water Source",
271 name = "water_source.png",
272 backface_culling = false,
274 type = "vertical_frames",
281 name = "water_source.png",
282 backface_culling = true,
284 type = "vertical_frames",
297 is_ground_content = false,
300 liquidtype = "source",
301 liquid_alternative_flowing = "main:waterflow",
302 liquid_alternative_source = "main:water",
303 liquid_viscosity = 1,
304 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
305 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
306 --sounds = default.node_sound_water_defaults(),
308 --water explodes in the nether
309 on_construct = function(pos)
310 if pos.y <= -10033 then
316 minetest.register_node("main:waterflow", {
317 description = "Water Flow",
318 drawtype = "flowingliquid",
320 tiles = {"water_static.png"},
323 name = "water_flow.png",
324 backface_culling = false,
326 type = "vertical_frames",
333 name = "water_flow.png",
334 backface_culling = true,
336 type = "vertical_frames",
351 paramtype2 = "flowingliquid",
356 is_ground_content = false,
359 liquidtype = "flowing",
360 liquid_alternative_flowing = "main:waterflow",
361 liquid_alternative_source = "main:water",
362 liquid_viscosity = 1,
363 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
364 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
365 --sounds = default.node_sound_water_defaults(),
368 minetest.register_node("main:lava", {
369 description = "Lava",
373 name = "lava_source.png",
374 backface_culling = false,
376 type = "vertical_frames",
383 name = "lava_source.png",
384 backface_culling = true,
386 type = "vertical_frames",
399 is_ground_content = false,
402 liquidtype = "source",
403 liquid_alternative_flowing = "main:lavaflow",
404 liquid_alternative_source = "main:lava",
405 liquid_viscosity = 7,
406 liquid_renewable = false,
407 damage_per_second = 4 * 2,
408 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
409 groups = {lava = 3, liquid = 2, igniter = 1},
412 minetest.register_node("main:lavaflow", {
413 description = "Flowing Lava",
414 drawtype = "flowingliquid",
415 tiles = {"lava_flow.png"},
418 name = "lava_flow.png",
419 backface_culling = false,
421 type = "vertical_frames",
428 name = "lava_flow.png",
429 backface_culling = true,
431 type = "vertical_frames",
445 paramtype2 = "flowingliquid",
451 is_ground_content = false,
454 liquidtype = "flowing",
455 liquid_alternative_flowing = "main:lavaflow",
456 liquid_alternative_source = "main:lava",
457 liquid_viscosity = 7,
458 liquid_renewable = false,
459 damage_per_second = 2,
460 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
461 groups = {lava = 3, liquid = 2, igniter = 1},
464 minetest.register_node("main:ladder", {
465 description = "Ladder",
466 drawtype = "signlike",
467 tiles = {"ladder.png"},
468 inventory_image = "ladder.png",
469 wield_image = "ladder.png",
471 paramtype2 = "wallmounted",
472 sunlight_propagates = true,
475 is_ground_content = false,
476 node_placement_prediction = "",
478 type = "wallmounted",
479 --wall_top = = <default>
480 --wall_bottom = = <default>
481 --wall_side = = <default>
483 groups = {wood = 1, flammable = 1, attached_node=1},
484 sounds = main.woodSound(),
485 on_place = function(itemstack, placer, pointed_thing)
487 if pointed_thing.type ~= "node" then
491 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
493 local fakestack = itemstack
496 retval = fakestack:set_name("main:ladder")
505 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
508 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
511 print(itemstack, retval)
512 itemstack:set_name("main:ladder")