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,soil=1},
101 sounds = main.sandSound(),
104 minetest.register_node("main:sugarcane", {
105 description = "Sugarcane",
106 drawtype = "plantlike",
107 inventory_image = "sugarcane.png",
111 is_ground_content = false,
112 tiles = {"sugarcane.png"},
113 buildable_to = false,
114 node_placement_prediction = "",
115 groups = {dig_immediate=1,flammable=1},
116 sounds = main.grassSound(),
118 on_place = function(itemstack, placer, pointed_thing)
119 local n = minetest.get_node_group(minetest.get_node(pointed_thing.under).name,"soil") > 0
121 return(minetest.item_place(itemstack, placer, pointed_thing))
124 after_dig_node = function(pos, node, metadata, digger)
125 if digger == nil then return end
126 local np = {x = pos.x, y = pos.y + 1, z = pos.z}
127 local nn = minetest.get_node(np)
128 if nn.name == node.name then
129 minetest.node_dig(np, nn, digger)
132 on_flood = function(pos, oldnode, newnode)
133 minetest.throw_item(pos, "main:sugarcane")
137 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}
141 minetest.register_node("main:gravel", {
142 description = "Gravel",
143 tiles = {"gravel.png"},
144 groups = {sand = 1, falling_node = 1,pathable = 1},
145 sounds = main.dirtSound(),
150 -- Only drop if using a tool whose name is identical to one
153 items = {"main:flint"},
154 -- Whether all items in the dropped item list inherit the
155 -- hardware coloring palette color from the dug node.
156 -- Default is 'false'.
157 --inherit_color = true,
160 -- Only drop if using a tool whose name is identical to one
162 --tools = {"main:shears"},
164 items = {"main:gravel"},
165 -- Whether all items in the dropped item list inherit the
166 -- hardware coloring palette color from the dug node.
167 -- Default is 'false'.
168 --inherit_color = true,
173 minetest.register_node("main:tree", {
174 description = "Tree",
175 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
176 groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
177 sounds = main.woodSound(),
178 --set metadata so treecapitator doesn't destroy houses
179 on_place = function(itemstack, placer, pointed_thing)
180 if not pointed_thing.type == "node" then
184 local sneak = placer:get_player_control().sneak
185 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
186 if not sneak and noddef.on_rightclick then
187 minetest.item_place(itemstack, placer, pointed_thing)
191 local pos = pointed_thing.above
192 minetest.item_place_node(itemstack, placer, pointed_thing)
193 local meta = minetest.get_meta(pos)
194 meta:set_string("placed", "true")
197 --treecapitator - move treecapitator into own file using override
198 on_dig = function(pos, node, digger)
200 --check if wielding axe?
202 local meta = minetest.get_meta(pos)
203 if not meta:contains("placed") then
206 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
208 if name == "main:tree" or name == "redstone:node_activated_tree" then
209 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
213 minetest.node_dig(pos, node, digger)
218 minetest.register_node("main:wood", {
219 description = "Wood",
220 tiles = {"wood.png"},
221 groups = {wood = 1, pathable = 1,flammable=1},
222 sounds = main.woodSound(),
225 minetest.register_node("main:leaves", {
226 description = "Leaves",
227 drawtype = "allfaces_optional",
232 is_ground_content = false,
233 tiles = {"leaves.png"},
234 groups = {leaves = 1, leafdecay = 1,flammable=1},
235 sounds = main.grassSound(),
240 -- Only drop if using a tool whose name is identical to one
243 items = {"main:sapling"},
244 -- Whether all items in the dropped item list inherit the
245 -- hardware coloring palette color from the dug node.
246 -- Default is 'false'.
247 --inherit_color = true,
250 -- Only drop if using a tool whose name is identical to one
252 tools = {"main:shears"},
254 items = {"main:leaves"},
255 -- Whether all items in the dropped item list inherit the
256 -- hardware coloring palette color from the dug node.
257 -- Default is 'false'.
258 --inherit_color = true,
261 -- Only drop if using a tool whose name is identical to one
263 tools = {"main:shears"},
265 items = {"main:stick"},
266 -- Whether all items in the dropped item list inherit the
267 -- hardware coloring palette color from the dug node.
268 -- Default is 'false'.
269 --inherit_color = true,
272 -- Only drop if using a tool whose name is identical to one
274 tools = {"main:shears"},
276 items = {"main:apple"},
277 -- Whether all items in the dropped item list inherit the
278 -- hardware coloring palette color from the dug node.
279 -- Default is 'false'.
280 --inherit_color = true,
286 minetest.register_node("main:water", {
287 description = "Water Source",
292 name = "water_source.png",
293 backface_culling = false,
295 type = "vertical_frames",
302 name = "water_source.png",
303 backface_culling = true,
305 type = "vertical_frames",
318 is_ground_content = false,
321 liquidtype = "source",
322 liquid_alternative_flowing = "main:waterflow",
323 liquid_alternative_source = "main:water",
324 liquid_viscosity = 1,
325 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
326 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
327 --sounds = default.node_sound_water_defaults(),
329 --water explodes in the nether
330 on_construct = function(pos)
331 if pos.y <= -10033 then
332 minetest.remove_node(pos)
338 minetest.register_node("main:waterflow", {
339 description = "Water Flow",
340 drawtype = "flowingliquid",
342 tiles = {"water_static.png"},
345 name = "water_flow.png",
346 backface_culling = false,
348 type = "vertical_frames",
355 name = "water_flow.png",
356 backface_culling = true,
358 type = "vertical_frames",
373 paramtype2 = "flowingliquid",
378 is_ground_content = false,
381 liquidtype = "flowing",
382 liquid_alternative_flowing = "main:waterflow",
383 liquid_alternative_source = "main:water",
384 liquid_viscosity = 1,
385 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
386 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
387 --sounds = default.node_sound_water_defaults(),
390 minetest.register_node("main:lava", {
391 description = "Lava",
395 name = "lava_source.png",
396 backface_culling = false,
398 type = "vertical_frames",
405 name = "lava_source.png",
406 backface_culling = true,
408 type = "vertical_frames",
421 is_ground_content = false,
424 liquidtype = "source",
425 liquid_alternative_flowing = "main:lavaflow",
426 liquid_alternative_source = "main:lava",
427 liquid_viscosity = 7,
428 liquid_renewable = false,
429 damage_per_second = 4 * 2,
430 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
431 groups = {lava = 3, liquid = 2, igniter = 1},
434 minetest.register_node("main:lavaflow", {
435 description = "Flowing Lava",
436 drawtype = "flowingliquid",
437 tiles = {"lava_flow.png"},
440 name = "lava_flow.png",
441 backface_culling = false,
443 type = "vertical_frames",
450 name = "lava_flow.png",
451 backface_culling = true,
453 type = "vertical_frames",
467 paramtype2 = "flowingliquid",
473 is_ground_content = false,
476 liquidtype = "flowing",
477 liquid_alternative_flowing = "main:lavaflow",
478 liquid_alternative_source = "main:lava",
479 liquid_viscosity = 7,
480 liquid_renewable = false,
481 damage_per_second = 2,
482 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
483 groups = {lava = 3, liquid = 2, igniter = 1},
486 minetest.register_node("main:ladder", {
487 description = "Ladder",
488 drawtype = "signlike",
489 tiles = {"ladder.png"},
490 inventory_image = "ladder.png",
491 wield_image = "ladder.png",
493 paramtype2 = "wallmounted",
494 sunlight_propagates = true,
497 is_ground_content = false,
498 node_placement_prediction = "",
500 type = "wallmounted",
501 --wall_top = = <default>
502 --wall_bottom = = <default>
503 --wall_side = = <default>
505 groups = {wood = 1, flammable = 1, attached_node=1},
506 sounds = main.woodSound(),
507 on_place = function(itemstack, placer, pointed_thing)
509 if pointed_thing.type ~= "node" then
513 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
515 local fakestack = itemstack
518 retval = fakestack:set_name("main:ladder")
527 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
530 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
533 print(itemstack, retval)
534 itemstack:set_name("main:ladder")