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
16 minetest.register_node("main:"..ore.."ore", {
17 description = ore:gsub("^%l", string.upper).." Ore",
18 tiles = {"stone.png^"..ore.."ore.png"},
19 groups = {stone = id, hard = id, pickaxe = 1, hand = 4,pathable = 1},
20 sounds = main.stoneSound(),
21 --light_source = 14,--debugging ore spawn
27 tools = tool_required,
35 minetest.register_node("main:stone", {
36 description = "Stone",
37 tiles = {"stone.png"},
38 groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4,pathable = 1},
39 sounds = main.stoneSound(),
46 items = {"main:cobble"},
52 minetest.register_node("main:cobble", {
53 description = "Cobblestone",
54 tiles = {"cobble.png"},
55 groups = {stone = 2, hard = 1, pickaxe = 2, hand = 4,pathable = 1},
56 sounds = main.stoneSound(),
63 items = {"main:cobble"},
69 minetest.register_node("main:glass", {
70 description = "Glass",
71 tiles = {"glass.png"},
72 drawtype = "glasslike",
74 --paramtype2 = "glasslikeliquidlevel",
75 sunlight_propagates = true,
76 is_ground_content = false,
77 groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4,pathable = 1},
78 sounds = main.stoneSound({
79 footstep = {name = "glass_footstep", gain = 0.4},
80 dug = {name = "break_glass", gain = 0.4},
85 minetest.register_node("main:dirt", {
88 groups = {dirt = 1, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
89 sounds = main.dirtSound(),
93 minetest.register_node("main:grass", {
94 description = "Grass",
95 tiles = {"grass.png"},
96 groups = {dirt = 1, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
97 sounds = main.dirtSound(),
101 minetest.register_node("main:sand", {
102 description = "Sand",
103 tiles = {"sand.png"},
104 groups = {sand = 1, soft = 1, shovel = 1, hand = 1, falling_node = 1,pathable = 1},
105 sounds = main.sandSound(),
108 minetest.register_node("main:tree", {
109 description = "Tree",
110 tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
111 groups = {wood = 2, tree = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
112 sounds = main.woodSound(),
113 --set metadata so treecapitator doesn't destroy houses
114 on_place = function(itemstack, placer, pointed_thing)
115 local pos = pointed_thing.above
116 minetest.item_place_node(itemstack, placer, pointed_thing)
117 local meta = minetest.get_meta(pos)
118 meta:set_string("placed", "true")
121 --treecapitator - move treecapitator into own file using override
122 on_dig = function(pos, node, digger)
124 --check if wielding axe?
126 local meta = minetest.get_meta(pos)
127 if not meta:contains("placed") then
131 if minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name == "main:tree" then
132 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
136 minetest.node_dig(pos, node, digger)
141 minetest.register_node("main:wood", {
142 description = "Wood",
143 tiles = {"wood.png"},
144 groups = {wood = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
145 sounds = main.woodSound(),
148 minetest.register_node("main:leaves", {
149 description = "Leaves",
150 drawtype = "allfaces_optional",
155 is_ground_content = false,
156 tiles = {"leaves.png"},
157 groups = {leaves = 1, plant = 1, axe = 1, hand = 0, leafdecay = 1},
158 sounds = main.grassSound(),
163 -- Only drop if using a tool whose name is identical to one
166 items = {"main:sapling"},
167 -- Whether all items in the dropped item list inherit the
168 -- hardware coloring palette color from the dug node.
169 -- Default is 'false'.
170 --inherit_color = true,
173 -- Only drop if using a tool whose name is identical to one
175 tools = {"main:shears"},
177 items = {"main:leaves"},
178 -- Whether all items in the dropped item list inherit the
179 -- hardware coloring palette color from the dug node.
180 -- Default is 'false'.
181 --inherit_color = true,
184 -- Only drop if using a tool whose name is identical to one
186 tools = {"main:shears"},
188 items = {"main:stick"},
189 -- Whether all items in the dropped item list inherit the
190 -- hardware coloring palette color from the dug node.
191 -- Default is 'false'.
192 --inherit_color = true,
195 -- Only drop if using a tool whose name is identical to one
197 tools = {"main:shears"},
199 items = {"main:apple"},
200 -- Whether all items in the dropped item list inherit the
201 -- hardware coloring palette color from the dug node.
202 -- Default is 'false'.
203 --inherit_color = true,
209 minetest.register_node("main:water", {
210 description = "Water Source",
215 name = "waterSource.png",
216 backface_culling = false,
218 type = "vertical_frames",
225 name = "waterSource.png",
226 backface_culling = true,
228 type = "vertical_frames",
241 is_ground_content = false,
244 liquidtype = "source",
245 liquid_alternative_flowing = "main:waterflow",
246 liquid_alternative_source = "main:water",
247 liquid_viscosity = 1,
248 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
249 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
250 --sounds = default.node_sound_water_defaults(),
253 minetest.register_node("main:waterflow", {
254 description = "Water Flow",
255 drawtype = "flowingliquid",
257 tiles = {"water.png"},
260 name = "waterFlow.png",
261 backface_culling = false,
263 type = "vertical_frames",
270 name = "waterFlow.png",
271 backface_culling = true,
273 type = "vertical_frames",
282 paramtype2 = "flowingliquid",
287 is_ground_content = false,
290 liquidtype = "flowing",
291 liquid_alternative_flowing = "main:waterflow",
292 liquid_alternative_source = "main:water",
293 liquid_viscosity = 1,
294 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
295 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
296 --sounds = default.node_sound_water_defaults(),
301 minetest.register_node("default:lava_source", {
302 description = S("Lava Source"),
306 name = "default_lava_source_animated.png",
307 backface_culling = false,
309 type = "vertical_frames",
316 name = "default_lava_source_animated.png",
317 backface_culling = true,
319 type = "vertical_frames",
327 light_source = default.LIGHT_MAX - 1,
332 is_ground_content = false,
335 liquidtype = "source",
336 liquid_alternative_flowing = "default:lava_flowing",
337 liquid_alternative_source = "default:lava_source",
338 liquid_viscosity = 7,
339 liquid_renewable = false,
340 damage_per_second = 4 * 2,
341 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
342 groups = {lava = 3, liquid = 2, igniter = 1},
345 minetest.register_node("default:lava_flowing", {
346 description = S("Flowing Lava"),
347 drawtype = "flowingliquid",
348 tiles = {"default_lava.png"},
351 name = "default_lava_flowing_animated.png",
352 backface_culling = false,
354 type = "vertical_frames",
361 name = "default_lava_flowing_animated.png",
362 backface_culling = true,
364 type = "vertical_frames",
372 paramtype2 = "flowingliquid",
373 light_source = default.LIGHT_MAX - 1,
378 is_ground_content = false,
381 liquidtype = "flowing",
382 liquid_alternative_flowing = "default:lava_flowing",
383 liquid_alternative_source = "default:lava_source",
384 liquid_viscosity = 7,
385 liquid_renewable = false,
386 damage_per_second = 4 * 2,
387 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
388 groups = {lava = 3, liquid = 2, igniter = 1,
389 not_in_creative_inventory = 1},
394 minetest.register_node("main:ladder", {
395 description = "Ladder",
396 drawtype = "signlike",
397 tiles = {"ladder.png"},
398 inventory_image = "ladder.png",
399 wield_image = "ladder.png",
401 paramtype2 = "wallmounted",
402 sunlight_propagates = true,
405 is_ground_content = false,
406 node_placement_prediction = "",
408 type = "wallmounted",
409 --wall_top = = <default>
410 --wall_bottom = = <default>
411 --wall_side = = <default>
413 groups = {wood = 2, flammable = 2, attached_node=1},
414 sounds = main.woodSound(),
415 on_place = function(itemstack, placer, pointed_thing)
417 if pointed_thing.type ~= "node" then
421 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
423 local fakestack = itemstack
426 retval = fakestack:set_name("main:ladder")
435 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
438 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
441 print(itemstack, retval)
442 itemstack:set_name("main:ladder")