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,experience=id},
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:mossy_cobble", {
67 description = "Mossy Cobblestone",
68 tiles = {"mossy_cobble.png"},
69 groups = {stone = 1, pathable = 1},
70 sounds = main.stoneSound(),
77 items = {"main:mossy_cobble"},
83 minetest.register_node("main:glass", {
84 description = "Glass",
85 tiles = {"glass.png"},
86 drawtype = "glasslike",
88 sunlight_propagates = true,
89 is_ground_content = false,
90 groups = {glass = 1, pathable = 1},
91 sounds = main.stoneSound({
92 footstep = {name = "glass_footstep", gain = 0.4},
93 dug = {name = "break_glass", gain = 0.4},
98 minetest.register_node("main:ice", {
101 drawtype = "glasslike",
103 sunlight_propagates = true,
104 sunlight_propagates = true,
105 is_ground_content = false,
106 groups = {glass = 1, pathable = 1,slippery=3},
107 sounds = main.stoneSound({
108 footstep = {name = "glass_footstep", gain = 0.4},
109 dug = {name = "break_glass", gain = 0.4},
111 use_texture_alpha = false,
114 after_destruct = function(pos, oldnode)
115 minetest.set_node(pos, {name="main:water"})
118 minetest.register_node("main:ice_mapgen", {
122 sunlight_propagates = true,
123 sunlight_propagates = true,
124 is_ground_content = false,
125 groups = {glass = 1, pathable = 1,slippery=3},
126 sounds = main.stoneSound({
127 footstep = {name = "glass_footstep", gain = 0.4},
128 dug = {name = "break_glass", gain = 0.4},
130 use_texture_alpha = false,
134 minetest.register_node("main:dirt", {
135 description = "Dirt",
136 tiles = {"dirt.png"},
137 groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
138 sounds = main.dirtSound(),
142 minetest.register_node("main:grass", {
143 description = "Grass",
144 tiles = {"grass.png"},
145 groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
146 sounds = main.dirtSound(),
150 minetest.register_node("main:sand", {
151 description = "Sand",
152 tiles = {"sand.png"},
153 groups = {sand = 1, falling_node = 1,pathable = 1,soil=1},
154 sounds = main.sandSound(),
157 minetest.register_node("main:gravel", {
158 description = "Gravel",
159 tiles = {"gravel.png"},
160 groups = {sand = 1, falling_node = 1,pathable = 1},
161 sounds = main.dirtSound(),
166 -- Only drop if using a tool whose name is identical to one
169 items = {"main:flint"},
170 -- Whether all items in the dropped item list inherit the
171 -- hardware coloring palette color from the dug node.
172 -- Default is 'false'.
173 --inherit_color = true,
176 -- Only drop if using a tool whose name is identical to one
178 --tools = {"main:shears"},
180 items = {"main:gravel"},
181 -- Whether all items in the dropped item list inherit the
182 -- hardware coloring palette color from the dug node.
183 -- Default is 'false'.
184 --inherit_color = true,
189 minetest.register_node("main:tree", {
190 description = "Tree",
191 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
192 groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
193 sounds = main.woodSound(),
194 --set metadata so treecapitator doesn't destroy houses
195 on_place = function(itemstack, placer, pointed_thing)
196 if not pointed_thing.type == "node" then
200 local sneak = placer:get_player_control().sneak
201 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
202 if not sneak and noddef.on_rightclick then
203 minetest.item_place(itemstack, placer, pointed_thing)
207 local pos = pointed_thing.above
208 minetest.item_place_node(itemstack, placer, pointed_thing)
209 local meta = minetest.get_meta(pos)
210 meta:set_string("placed", "true")
213 --treecapitator - move treecapitator into own file using override
214 on_dig = function(pos, node, digger)
215 --bvav_create_vessel(pos,minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(digger:get_look_horizontal()+(math.pi/2)))))
216 --check if wielding axe?
217 --turn treecapitator into an enchantment?
218 local meta = minetest.get_meta(pos)
219 --local tool_meta = digger:get_wielded_item():get_meta()
220 --if tool_meta:get_int("treecapitator") > 0 then
221 if not meta:contains("placed") and string.match(digger:get_wielded_item():get_name(), "axe") then
222 local tool_capabilities = digger:get_wielded_item():get_tool_capabilities()
224 local wear = minetest.get_dig_params({wood=1}, tool_capabilities).wear
226 local wield_stack = digger:get_wielded_item()
230 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
232 if name == "main:tree" or name == "redstone:node_activated_tree" then
233 wield_stack:add_wear(wear)
234 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
235 local name2 = minetest.get_node(vector.new(pos.x,pos.y+y-1,pos.z)).name
236 if name2 == "main:dirt" or name2 == "main:grass" then
237 minetest.add_node(vector.new(pos.x,pos.y+y,pos.z),{name="main:sapling"})
241 digger:set_wielded_item(wield_stack)
243 minetest.node_dig(pos, node, digger)
249 minetest.register_node("main:wood", {
250 description = "Wood",
251 tiles = {"wood.png"},
252 groups = {wood = 1, pathable = 1,flammable=1},
253 sounds = main.woodSound(),
256 minetest.register_node("main:leaves", {
257 description = "Leaves",
258 drawtype = "allfaces_optional",
263 is_ground_content = false,
264 tiles = {"leaves.png"},
265 groups = {leaves = 1, leafdecay = 1,flammable=1},
266 sounds = main.grassSound(),
271 tools = {"main:shears"},
272 items = {"main:dropped_leaves"},
276 items = {"main:apple"},
280 items = {"main:sapling"},
287 minetest.register_node("main:dropped_leaves", {
288 description = "Leaves",
289 drawtype = "allfaces_optional",
294 is_ground_content = false,
295 tiles = {"leaves.png"},
296 groups = {leaves = 1, flammable=1},
297 sounds = main.grassSound(),
302 tools = {"main:shears"},
303 items = {"main:dropped_leaves"},
314 minetest.register_node("main:water", {
315 description = "Water Source",
320 name = "water_source.png",
321 backface_culling = false,
323 type = "vertical_frames",
330 name = "water_source.png",
331 backface_culling = true,
333 type = "vertical_frames",
346 is_ground_content = false,
349 liquidtype = "source",
350 liquid_alternative_flowing = "main:waterflow",
351 liquid_alternative_source = "main:water",
352 liquid_viscosity = 1,
353 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
354 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1,disable_fall_damage=1},
355 --sounds = default.node_sound_water_defaults(),
357 --water explodes in the nether
358 on_construct = function(pos)
359 local under = minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name
360 if under == "nether:glowstone" then
361 minetest.remove_node(pos)
362 create_aether_portal(pos)
363 elseif pos.y <= -10033 then
364 minetest.remove_node(pos)
370 minetest.register_node("main:waterflow", {
371 description = "Water Flow",
372 drawtype = "flowingliquid",
374 tiles = {"water_static.png"},
377 name = "water_flow.png",
378 backface_culling = false,
380 type = "vertical_frames",
387 name = "water_flow.png",
388 backface_culling = true,
390 type = "vertical_frames",
405 paramtype2 = "flowingliquid",
410 is_ground_content = false,
413 liquidtype = "flowing",
414 liquid_alternative_flowing = "main:waterflow",
415 liquid_alternative_source = "main:water",
416 liquid_viscosity = 1,
417 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
418 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1,disable_fall_damage=1},
419 --sounds = default.node_sound_water_defaults(),
422 minetest.register_node("main:lava", {
423 description = "Lava",
427 name = "lava_source.png",
428 backface_culling = false,
430 type = "vertical_frames",
437 name = "lava_source.png",
438 backface_culling = true,
440 type = "vertical_frames",
453 is_ground_content = false,
456 liquidtype = "source",
457 liquid_alternative_flowing = "main:lavaflow",
458 liquid_alternative_source = "main:lava",
459 liquid_viscosity = 7,
460 liquid_renewable = false,
461 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
462 groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
465 minetest.register_node("main:lavaflow", {
466 description = "Flowing Lava",
467 drawtype = "flowingliquid",
468 tiles = {"lava_flow.png"},
471 name = "lava_flow.png",
472 backface_culling = false,
474 type = "vertical_frames",
481 name = "lava_flow.png",
482 backface_culling = true,
484 type = "vertical_frames",
498 paramtype2 = "flowingliquid",
504 is_ground_content = false,
507 liquidtype = "flowing",
508 liquid_alternative_flowing = "main:lavaflow",
509 liquid_alternative_source = "main:lava",
510 liquid_viscosity = 7,
511 liquid_renewable = false,
513 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
514 groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
517 minetest.register_node("main:ladder", {
518 description = "Ladder",
519 drawtype = "signlike",
520 tiles = {"ladder.png"},
521 inventory_image = "ladder.png",
522 wield_image = "ladder.png",
524 paramtype2 = "wallmounted",
525 sunlight_propagates = true,
528 is_ground_content = false,
529 node_placement_prediction = "",
531 type = "wallmounted",
532 --wall_top = = <default>
533 --wall_bottom = = <default>
534 --wall_side = = <default>
536 groups = {wood = 1, flammable = 1, attached_node=1},
537 sounds = main.woodSound(),
538 on_place = function(itemstack, placer, pointed_thing)
540 if pointed_thing.type ~= "node" then
544 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
546 local fakestack = itemstack
549 retval = fakestack:set_name("main:ladder")
558 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
561 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
564 print(itemstack, retval)
565 itemstack:set_name("main:ladder")