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(),
43 items = {"main:cobble"},
49 minetest.register_node("main:cobble", {
50 description = "Cobblestone",
51 tiles = {"cobble.png"},
52 groups = {stone = 1, pathable = 1},
53 sounds = main.stoneSound(),
60 items = {"main:cobble"},
66 minetest.register_node("main:glass", {
67 description = "Glass",
68 tiles = {"glass.png"},
69 drawtype = "glasslike",
71 sunlight_propagates = true,
72 is_ground_content = false,
73 groups = {glass = 1, pathable = 1},
74 sounds = main.stoneSound({
75 footstep = {name = "glass_footstep", gain = 0.4},
76 dug = {name = "break_glass", gain = 0.4},
81 minetest.register_node("main:dirt", {
84 groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
85 sounds = main.dirtSound(),
89 minetest.register_node("main:grass", {
90 description = "Grass",
91 tiles = {"grass.png"},
92 groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
93 sounds = main.dirtSound(),
97 minetest.register_node("main:sand", {
100 groups = {sand = 1, falling_node = 1,pathable = 1},
101 sounds = main.sandSound(),
104 minetest.register_node("main:gravel", {
105 description = "Gravel",
106 tiles = {"gravel.png"},
107 groups = {sand = 1, falling_node = 1,pathable = 1},
108 sounds = main.dirtSound(),
113 -- Only drop if using a tool whose name is identical to one
116 items = {"main:flint"},
117 -- Whether all items in the dropped item list inherit the
118 -- hardware coloring palette color from the dug node.
119 -- Default is 'false'.
120 --inherit_color = true,
123 -- Only drop if using a tool whose name is identical to one
125 --tools = {"main:shears"},
127 items = {"main:gravel"},
128 -- Whether all items in the dropped item list inherit the
129 -- hardware coloring palette color from the dug node.
130 -- Default is 'false'.
131 --inherit_color = true,
136 minetest.register_node("main:tree", {
137 description = "Tree",
138 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
139 groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
140 sounds = main.woodSound(),
141 --set metadata so treecapitator doesn't destroy houses
142 on_place = function(itemstack, placer, pointed_thing)
143 if not pointed_thing.type == "node" then
147 local sneak = placer:get_player_control().sneak
148 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
149 if not sneak and noddef.on_rightclick then
150 minetest.item_place(itemstack, placer, pointed_thing)
154 local pos = pointed_thing.above
155 minetest.item_place_node(itemstack, placer, pointed_thing)
156 local meta = minetest.get_meta(pos)
157 meta:set_string("placed", "true")
160 --treecapitator - move treecapitator into own file using override
161 on_dig = function(pos, node, digger)
163 --check if wielding axe?
165 local meta = minetest.get_meta(pos)
166 if not meta:contains("placed") then
169 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
171 if name == "main:tree" or name == "redstone:node_activated_tree" then
172 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
176 minetest.node_dig(pos, node, digger)
181 minetest.register_node("main:wood", {
182 description = "Wood",
183 tiles = {"wood.png"},
184 groups = {wood = 1, pathable = 1,flammable=1},
185 sounds = main.woodSound(),
188 minetest.register_node("main:leaves", {
189 description = "Leaves",
190 drawtype = "allfaces_optional",
195 is_ground_content = false,
196 tiles = {"leaves.png"},
197 groups = {leaves = 1, leafdecay = 1,flammable=1},
198 sounds = main.grassSound(),
203 -- Only drop if using a tool whose name is identical to one
206 items = {"main:sapling"},
207 -- Whether all items in the dropped item list inherit the
208 -- hardware coloring palette color from the dug node.
209 -- Default is 'false'.
210 --inherit_color = true,
213 -- Only drop if using a tool whose name is identical to one
215 tools = {"main:shears"},
217 items = {"main:leaves"},
218 -- Whether all items in the dropped item list inherit the
219 -- hardware coloring palette color from the dug node.
220 -- Default is 'false'.
221 --inherit_color = true,
224 -- Only drop if using a tool whose name is identical to one
226 tools = {"main:shears"},
228 items = {"main:stick"},
229 -- Whether all items in the dropped item list inherit the
230 -- hardware coloring palette color from the dug node.
231 -- Default is 'false'.
232 --inherit_color = true,
235 -- Only drop if using a tool whose name is identical to one
237 tools = {"main:shears"},
239 items = {"main:apple"},
240 -- Whether all items in the dropped item list inherit the
241 -- hardware coloring palette color from the dug node.
242 -- Default is 'false'.
243 --inherit_color = true,
249 minetest.register_node("main:water", {
250 description = "Water Source",
255 name = "water_source.png",
256 backface_culling = false,
258 type = "vertical_frames",
265 name = "water_source.png",
266 backface_culling = true,
268 type = "vertical_frames",
281 is_ground_content = false,
284 liquidtype = "source",
285 liquid_alternative_flowing = "main:waterflow",
286 liquid_alternative_source = "main:water",
287 liquid_viscosity = 1,
288 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
289 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
290 --sounds = default.node_sound_water_defaults(),
292 --water explodes in the nether
293 on_construct = function(pos)
294 if pos.y <= -10033 then
300 minetest.register_node("main:waterflow", {
301 description = "Water Flow",
302 drawtype = "flowingliquid",
304 tiles = {"water_static.png"},
307 name = "water_flow.png",
308 backface_culling = false,
310 type = "vertical_frames",
317 name = "water_flow.png",
318 backface_culling = true,
320 type = "vertical_frames",
335 paramtype2 = "flowingliquid",
340 is_ground_content = false,
343 liquidtype = "flowing",
344 liquid_alternative_flowing = "main:waterflow",
345 liquid_alternative_source = "main:water",
346 liquid_viscosity = 1,
347 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
348 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
349 --sounds = default.node_sound_water_defaults(),
352 minetest.register_node("main:lava", {
353 description = "Lava",
357 name = "lava_source.png",
358 backface_culling = false,
360 type = "vertical_frames",
367 name = "lava_source.png",
368 backface_culling = true,
370 type = "vertical_frames",
383 is_ground_content = false,
386 liquidtype = "source",
387 liquid_alternative_flowing = "main:lavaflow",
388 liquid_alternative_source = "main:lava",
389 liquid_viscosity = 7,
390 liquid_renewable = false,
391 damage_per_second = 4 * 2,
392 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
393 groups = {lava = 3, liquid = 2, igniter = 1},
396 minetest.register_node("main:lavaflow", {
397 description = "Flowing Lava",
398 drawtype = "flowingliquid",
399 tiles = {"lava_flow.png"},
402 name = "lava_flow.png",
403 backface_culling = false,
405 type = "vertical_frames",
412 name = "lava_flow.png",
413 backface_culling = true,
415 type = "vertical_frames",
429 paramtype2 = "flowingliquid",
435 is_ground_content = false,
438 liquidtype = "flowing",
439 liquid_alternative_flowing = "main:lavaflow",
440 liquid_alternative_source = "main:lava",
441 liquid_viscosity = 7,
442 liquid_renewable = false,
443 damage_per_second = 2,
444 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
445 groups = {lava = 3, liquid = 2, igniter = 1},
448 minetest.register_node("main:ladder", {
449 description = "Ladder",
450 drawtype = "signlike",
451 tiles = {"ladder.png"},
452 inventory_image = "ladder.png",
453 wield_image = "ladder.png",
455 paramtype2 = "wallmounted",
456 sunlight_propagates = true,
459 is_ground_content = false,
460 node_placement_prediction = "",
462 type = "wallmounted",
463 --wall_top = = <default>
464 --wall_bottom = = <default>
465 --wall_side = = <default>
467 groups = {wood = 1, flammable = 1, attached_node=1},
468 sounds = main.woodSound(),
469 on_place = function(itemstack, placer, pointed_thing)
471 if pointed_thing.type ~= "node" then
475 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
477 local fakestack = itemstack
480 retval = fakestack:set_name("main:ladder")
489 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
492 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
495 print(itemstack, retval)
496 itemstack:set_name("main:ladder")