1 print("Initializing nodes")
3 --ore def with required tool
4 local ores = {"coal","iron","gold","diamond"}
5 local tool = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"}
6 for id,ore in pairs(ores) do
7 local tool_required = {}
9 table.insert(tool_required, tool[i])
12 local drops = {"main:"..ore.."ore"}
13 if ore == "diamond" then drops = {"main:diamond"} elseif ore == "coal" then drops = {"main:coal"} end
15 minetest.register_node("main:"..ore.."ore", {
16 description = ore:gsub("^%l", string.upper).." Ore",
17 tiles = {"stone.png^"..ore.."ore.png"},
18 groups = {stone = id, pathable = 1},
19 sounds = main.stoneSound(),
20 --light_source = 14,--debugging ore spawn
26 tools = tool_required,
34 minetest.register_node("main:stone", {
35 description = "Stone",
36 tiles = {"stone.png"},
37 groups = {stone = 1, hand = 1,pathable = 1},
38 sounds = main.stoneSound(),
40 redstone_activation = function(pos)
43 redstone_deactivation = function(pos)
44 minetest.set_node(pos,{name="main:cobble"})
53 items = {"main:cobble"},
59 minetest.register_node("main:cobble", {
60 description = "Cobblestone",
61 tiles = {"cobble.png"},
62 groups = {stone = 1, pathable = 1},
63 sounds = main.stoneSound(),
65 redstone_activation = function(pos)
66 minetest.set_node(pos,{name="main:stone"})
68 redstone_deactivation = function(pos)
78 items = {"main:cobble"},
84 minetest.register_node("main:glass", {
85 description = "Glass",
86 tiles = {"glass.png"},
87 drawtype = "glasslike",
89 sunlight_propagates = true,
90 is_ground_content = false,
91 groups = {glass = 1, pathable = 1},
92 sounds = main.stoneSound({
93 footstep = {name = "glass_footstep", gain = 0.4},
94 dug = {name = "break_glass", gain = 0.4},
99 minetest.register_node("main:dirt", {
100 description = "Dirt",
101 tiles = {"dirt.png"},
102 groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
103 sounds = main.dirtSound(),
107 minetest.register_node("main:grass", {
108 description = "Grass",
109 tiles = {"grass.png"},
110 groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
111 sounds = main.dirtSound(),
115 minetest.register_node("main:sand", {
116 description = "Sand",
117 tiles = {"sand.png"},
118 groups = {sand = 1, falling_node = 1,pathable = 1},
119 sounds = main.sandSound(),
122 minetest.register_node("main:tree", {
123 description = "Tree",
124 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
125 groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
126 sounds = main.woodSound(),
127 --set metadata so treecapitator doesn't destroy houses
128 on_place = function(itemstack, placer, pointed_thing)
129 if not pointed_thing.type == "node" then
133 local sneak = placer:get_player_control().sneak
134 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
135 if not sneak and noddef.on_rightclick then
136 minetest.item_place(itemstack, placer, pointed_thing)
140 local pos = pointed_thing.above
141 minetest.item_place_node(itemstack, placer, pointed_thing)
142 local meta = minetest.get_meta(pos)
143 meta:set_string("placed", "true")
146 --treecapitator - move treecapitator into own file using override
147 on_dig = function(pos, node, digger)
149 --check if wielding axe?
151 local meta = minetest.get_meta(pos)
152 if not meta:contains("placed") then
155 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
157 if name == "main:tree" or name == "redstone:node_activated_tree" then
158 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
162 minetest.node_dig(pos, node, digger)
167 minetest.register_node("main:wood", {
168 description = "Wood",
169 tiles = {"wood.png"},
170 groups = {wood = 1, pathable = 1,flammable=1},
171 sounds = main.woodSound(),
174 minetest.register_node("main:leaves", {
175 description = "Leaves",
176 drawtype = "allfaces_optional",
181 is_ground_content = false,
182 tiles = {"leaves.png"},
183 groups = {leaves = 1, leafdecay = 1,flammable=1},
184 sounds = main.grassSound(),
189 -- Only drop if using a tool whose name is identical to one
192 items = {"main:sapling"},
193 -- Whether all items in the dropped item list inherit the
194 -- hardware coloring palette color from the dug node.
195 -- Default is 'false'.
196 --inherit_color = true,
199 -- Only drop if using a tool whose name is identical to one
201 tools = {"main:shears"},
203 items = {"main:leaves"},
204 -- Whether all items in the dropped item list inherit the
205 -- hardware coloring palette color from the dug node.
206 -- Default is 'false'.
207 --inherit_color = true,
210 -- Only drop if using a tool whose name is identical to one
212 tools = {"main:shears"},
214 items = {"main:stick"},
215 -- Whether all items in the dropped item list inherit the
216 -- hardware coloring palette color from the dug node.
217 -- Default is 'false'.
218 --inherit_color = true,
221 -- Only drop if using a tool whose name is identical to one
223 tools = {"main:shears"},
225 items = {"main:apple"},
226 -- Whether all items in the dropped item list inherit the
227 -- hardware coloring palette color from the dug node.
228 -- Default is 'false'.
229 --inherit_color = true,
235 minetest.register_node("main:water", {
236 description = "Water Source",
241 name = "water_source.png",
242 backface_culling = false,
244 type = "vertical_frames",
251 name = "water_source.png",
252 backface_culling = true,
254 type = "vertical_frames",
267 is_ground_content = false,
270 liquidtype = "source",
271 liquid_alternative_flowing = "main:waterflow",
272 liquid_alternative_source = "main:water",
273 liquid_viscosity = 1,
274 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
275 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
276 --sounds = default.node_sound_water_defaults(),
278 --water explodes in the nether
279 on_construct = function(pos)
280 if pos.y <= -10033 then
286 minetest.register_node("main:waterflow", {
287 description = "Water Flow",
288 drawtype = "flowingliquid",
290 tiles = {"water_static.png"},
293 name = "water_flow.png",
294 backface_culling = false,
296 type = "vertical_frames",
303 name = "water_flow.png",
304 backface_culling = true,
306 type = "vertical_frames",
315 paramtype2 = "flowingliquid",
320 is_ground_content = false,
323 liquidtype = "flowing",
324 liquid_alternative_flowing = "main:waterflow",
325 liquid_alternative_source = "main:water",
326 liquid_viscosity = 1,
327 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
328 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
329 --sounds = default.node_sound_water_defaults(),
332 minetest.register_node("main:lava", {
333 description = "Lava",
337 name = "lava_source.png",
338 backface_culling = false,
340 type = "vertical_frames",
347 name = "lava_source.png",
348 backface_culling = true,
350 type = "vertical_frames",
363 is_ground_content = false,
366 liquidtype = "source",
367 liquid_alternative_flowing = "main:lavaflow",
368 liquid_alternative_source = "main:lava",
369 liquid_viscosity = 7,
370 liquid_renewable = false,
371 damage_per_second = 4 * 2,
372 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
373 groups = {lava = 3, liquid = 2, igniter = 1},
376 minetest.register_node("main:lavaflow", {
377 description = "Flowing Lava",
378 drawtype = "flowingliquid",
379 tiles = {"lava_flow.png"},
382 name = "lava_flow.png",
383 backface_culling = false,
385 type = "vertical_frames",
392 name = "lava_flow.png",
393 backface_culling = true,
395 type = "vertical_frames",
403 paramtype2 = "flowingliquid",
409 is_ground_content = false,
412 liquidtype = "flowing",
413 liquid_alternative_flowing = "main:lavaflow",
414 liquid_alternative_source = "main:lava",
415 liquid_viscosity = 7,
416 liquid_renewable = false,
417 damage_per_second = 2,
418 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
419 groups = {lava = 3, liquid = 2, igniter = 1},
422 minetest.register_node("main:ladder", {
423 description = "Ladder",
424 drawtype = "signlike",
425 tiles = {"ladder.png"},
426 inventory_image = "ladder.png",
427 wield_image = "ladder.png",
429 paramtype2 = "wallmounted",
430 sunlight_propagates = true,
433 is_ground_content = false,
434 node_placement_prediction = "",
436 type = "wallmounted",
437 --wall_top = = <default>
438 --wall_bottom = = <default>
439 --wall_side = = <default>
441 groups = {wood = 1, flammable = 1, attached_node=1},
442 sounds = main.woodSound(),
443 on_place = function(itemstack, placer, pointed_thing)
445 if pointed_thing.type ~= "node" then
449 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
451 local fakestack = itemstack
454 retval = fakestack:set_name("main:ladder")
463 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
466 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
469 print(itemstack, retval)
470 itemstack:set_name("main:ladder")