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
17 minetest.register_node("main:"..ore.."ore", {
18 description = ore:gsub("^%l", string.upper).." Ore",
19 tiles = {"stone.png^"..ore.."ore.png"},
20 groups = {stone = id, pathable = 1},
21 sounds = main.stoneSound(),
22 --light_source = 14,--debugging ore spawn
28 tools = tool_required,
36 minetest.register_node("main:stone", {
37 description = "Stone",
38 tiles = {"stone.png"},
39 groups = {stone = 1, hand = 1,pathable = 1},
40 sounds = main.stoneSound(),
42 redstone_activation = function(pos)
45 redstone_deactivation = function(pos)
46 minetest.set_node(pos,{name="main:cobble"})
55 items = {"main:cobble"},
61 minetest.register_node("main:cobble", {
62 description = "Cobblestone",
63 tiles = {"cobble.png"},
64 groups = {stone = 1, pathable = 1},
65 sounds = main.stoneSound(),
67 redstone_activation = function(pos)
68 minetest.set_node(pos,{name="main:stone"})
70 redstone_deactivation = function(pos)
80 items = {"main:cobble"},
86 minetest.register_node("main:glass", {
87 description = "Glass",
88 tiles = {"glass.png"},
89 drawtype = "glasslike",
91 sunlight_propagates = true,
92 is_ground_content = false,
93 groups = {glass = 1, pathable = 1},
94 sounds = main.stoneSound({
95 footstep = {name = "glass_footstep", gain = 0.4},
96 dug = {name = "break_glass", gain = 0.4},
101 minetest.register_node("main:dirt", {
102 description = "Dirt",
103 tiles = {"dirt.png"},
104 groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
105 sounds = main.dirtSound(),
109 minetest.register_node("main:grass", {
110 description = "Grass",
111 tiles = {"grass.png"},
112 groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
113 sounds = main.dirtSound(),
117 minetest.register_node("main:sand", {
118 description = "Sand",
119 tiles = {"sand.png"},
120 groups = {sand = 1, falling_node = 1,pathable = 1},
121 sounds = main.sandSound(),
124 minetest.register_node("main:tree", {
125 description = "Tree",
126 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
127 groups = {wood = 1, tree = 1, pathable = 1},
128 sounds = main.woodSound(),
129 --set metadata so treecapitator doesn't destroy houses
130 on_place = function(itemstack, placer, pointed_thing)
131 if not pointed_thing.type == "node" then
135 local sneak = placer:get_player_control().sneak
136 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
137 if not sneak and noddef.on_rightclick then
138 minetest.item_place(itemstack, placer, pointed_thing)
142 local pos = pointed_thing.above
143 minetest.item_place_node(itemstack, placer, pointed_thing)
144 local meta = minetest.get_meta(pos)
145 meta:set_string("placed", "true")
148 --treecapitator - move treecapitator into own file using override
149 on_dig = function(pos, node, digger)
151 --check if wielding axe?
153 local meta = minetest.get_meta(pos)
154 if not meta:contains("placed") then
157 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
159 if name == "main:tree" or name == "redstone:node_activated_tree" then
160 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
164 minetest.node_dig(pos, node, digger)
169 minetest.register_node("main:wood", {
170 description = "Wood",
171 tiles = {"wood.png"},
172 groups = {wood = 1, pathable = 1},
173 sounds = main.woodSound(),
176 minetest.register_node("main:leaves", {
177 description = "Leaves",
178 drawtype = "allfaces_optional",
183 is_ground_content = false,
184 tiles = {"leaves.png"},
185 groups = {leaves = 1, leafdecay = 1},
186 sounds = main.grassSound(),
191 -- Only drop if using a tool whose name is identical to one
194 items = {"main:sapling"},
195 -- Whether all items in the dropped item list inherit the
196 -- hardware coloring palette color from the dug node.
197 -- Default is 'false'.
198 --inherit_color = true,
201 -- Only drop if using a tool whose name is identical to one
203 tools = {"main:shears"},
205 items = {"main:leaves"},
206 -- Whether all items in the dropped item list inherit the
207 -- hardware coloring palette color from the dug node.
208 -- Default is 'false'.
209 --inherit_color = true,
212 -- Only drop if using a tool whose name is identical to one
214 tools = {"main:shears"},
216 items = {"main:stick"},
217 -- Whether all items in the dropped item list inherit the
218 -- hardware coloring palette color from the dug node.
219 -- Default is 'false'.
220 --inherit_color = true,
223 -- Only drop if using a tool whose name is identical to one
225 tools = {"main:shears"},
227 items = {"main:apple"},
228 -- Whether all items in the dropped item list inherit the
229 -- hardware coloring palette color from the dug node.
230 -- Default is 'false'.
231 --inherit_color = true,
237 minetest.register_node("main:water", {
238 description = "Water Source",
243 name = "water_source.png",
244 backface_culling = false,
246 type = "vertical_frames",
253 name = "water_source.png",
254 backface_culling = true,
256 type = "vertical_frames",
269 is_ground_content = false,
272 liquidtype = "source",
273 liquid_alternative_flowing = "main:waterflow",
274 liquid_alternative_source = "main:water",
275 liquid_viscosity = 1,
276 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
277 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
278 --sounds = default.node_sound_water_defaults(),
280 --water explodes in the nether
281 on_construct = function(pos)
282 if pos.y <= -10033 then
288 minetest.register_node("main:waterflow", {
289 description = "Water Flow",
290 drawtype = "flowingliquid",
292 tiles = {"water_static.png"},
295 name = "water_flow.png",
296 backface_culling = false,
298 type = "vertical_frames",
305 name = "water_flow.png",
306 backface_culling = true,
308 type = "vertical_frames",
317 paramtype2 = "flowingliquid",
322 is_ground_content = false,
325 liquidtype = "flowing",
326 liquid_alternative_flowing = "main:waterflow",
327 liquid_alternative_source = "main:water",
328 liquid_viscosity = 1,
329 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
330 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
331 --sounds = default.node_sound_water_defaults(),
334 minetest.register_node("main:lava", {
335 description = "Lava",
339 name = "lava_source.png",
340 backface_culling = false,
342 type = "vertical_frames",
349 name = "lava_source.png",
350 backface_culling = true,
352 type = "vertical_frames",
365 is_ground_content = false,
368 liquidtype = "source",
369 liquid_alternative_flowing = "main:lavaflow",
370 liquid_alternative_source = "main:lava",
371 liquid_viscosity = 7,
372 liquid_renewable = false,
373 damage_per_second = 4 * 2,
374 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
375 groups = {lava = 3, liquid = 2, igniter = 1},
378 minetest.register_node("main:lavaflow", {
379 description = "Flowing Lava",
380 drawtype = "flowingliquid",
381 tiles = {"lava_flow.png"},
384 name = "lava_flow.png",
385 backface_culling = false,
387 type = "vertical_frames",
394 name = "lava_flow.png",
395 backface_culling = true,
397 type = "vertical_frames",
405 paramtype2 = "flowingliquid",
411 is_ground_content = false,
414 liquidtype = "flowing",
415 liquid_alternative_flowing = "main:lavaflow",
416 liquid_alternative_source = "main:lava",
417 liquid_viscosity = 7,
418 liquid_renewable = false,
419 damage_per_second = 2,
420 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
421 groups = {lava = 3, liquid = 2, igniter = 1},
424 minetest.register_node("main:ladder", {
425 description = "Ladder",
426 drawtype = "signlike",
427 tiles = {"ladder.png"},
428 inventory_image = "ladder.png",
429 wield_image = "ladder.png",
431 paramtype2 = "wallmounted",
432 sunlight_propagates = true,
435 is_ground_content = false,
436 node_placement_prediction = "",
438 type = "wallmounted",
439 --wall_top = = <default>
440 --wall_bottom = = <default>
441 --wall_side = = <default>
443 groups = {wood = 1, flammable = 1, attached_node=1},
444 sounds = main.woodSound(),
445 on_place = function(itemstack, placer, pointed_thing)
447 if pointed_thing.type ~= "node" then
451 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
453 local fakestack = itemstack
456 retval = fakestack:set_name("main:ladder")
465 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
468 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
471 print(itemstack, retval)
472 itemstack:set_name("main:ladder")