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(),
41 redstone_activation = function(pos)
44 redstone_deactivation = function(pos)
45 minetest.set_node(pos,{name="main:cobble"})
54 items = {"main:cobble"},
60 minetest.register_node("main:cobble", {
61 description = "Cobblestone",
62 tiles = {"cobble.png"},
63 groups = {stone = 2, hard = 1, pickaxe = 2, hand = 4,pathable = 1},
64 sounds = main.stoneSound(),
66 redstone_activation = function(pos)
67 minetest.set_node(pos,{name="main:stone"})
69 redstone_deactivation = function(pos)
79 items = {"main:cobble"},
85 minetest.register_node("main:glass", {
86 description = "Glass",
87 tiles = {"glass.png"},
88 drawtype = "glasslike",
90 --paramtype2 = "glasslikeliquidlevel",
91 sunlight_propagates = true,
92 is_ground_content = false,
93 groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4,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, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
105 sounds = main.dirtSound(),
109 minetest.register_node("main:grass", {
110 description = "Grass",
111 tiles = {"grass.png"},
112 groups = {dirt = 1, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
113 sounds = main.dirtSound(),
117 minetest.register_node("main:sand", {
118 description = "Sand",
119 tiles = {"sand.png"},
120 groups = {sand = 1, soft = 1, shovel = 1, hand = 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 = 2, tree = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
128 sounds = main.woodSound(),
129 --set metadata so treecapitator doesn't destroy houses
130 on_place = function(itemstack, placer, pointed_thing)
131 local pos = pointed_thing.above
132 minetest.item_place_node(itemstack, placer, pointed_thing)
133 local meta = minetest.get_meta(pos)
134 meta:set_string("placed", "true")
137 --treecapitator - move treecapitator into own file using override
138 on_dig = function(pos, node, digger)
140 --check if wielding axe?
142 local meta = minetest.get_meta(pos)
143 if not meta:contains("placed") then
147 if minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name == "main:tree" then
148 minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
152 minetest.node_dig(pos, node, digger)
157 minetest.register_node("main:wood", {
158 description = "Wood",
159 tiles = {"wood.png"},
160 groups = {wood = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
161 sounds = main.woodSound(),
164 minetest.register_node("main:leaves", {
165 description = "Leaves",
166 drawtype = "allfaces_optional",
171 is_ground_content = false,
172 tiles = {"leaves.png"},
173 groups = {leaves = 1, plant = 1, axe = 1, hand = 0, leafdecay = 1},
174 sounds = main.grassSound(),
179 -- Only drop if using a tool whose name is identical to one
182 items = {"main:sapling"},
183 -- Whether all items in the dropped item list inherit the
184 -- hardware coloring palette color from the dug node.
185 -- Default is 'false'.
186 --inherit_color = true,
189 -- Only drop if using a tool whose name is identical to one
191 tools = {"main:shears"},
193 items = {"main:leaves"},
194 -- Whether all items in the dropped item list inherit the
195 -- hardware coloring palette color from the dug node.
196 -- Default is 'false'.
197 --inherit_color = true,
200 -- Only drop if using a tool whose name is identical to one
202 tools = {"main:shears"},
204 items = {"main:stick"},
205 -- Whether all items in the dropped item list inherit the
206 -- hardware coloring palette color from the dug node.
207 -- Default is 'false'.
208 --inherit_color = true,
211 -- Only drop if using a tool whose name is identical to one
213 tools = {"main:shears"},
215 items = {"main:apple"},
216 -- Whether all items in the dropped item list inherit the
217 -- hardware coloring palette color from the dug node.
218 -- Default is 'false'.
219 --inherit_color = true,
225 minetest.register_node("main:water", {
226 description = "Water Source",
231 name = "waterSource.png",
232 backface_culling = false,
234 type = "vertical_frames",
241 name = "waterSource.png",
242 backface_culling = true,
244 type = "vertical_frames",
257 is_ground_content = false,
260 liquidtype = "source",
261 liquid_alternative_flowing = "main:waterflow",
262 liquid_alternative_source = "main:water",
263 liquid_viscosity = 1,
264 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
265 groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1},
266 --sounds = default.node_sound_water_defaults(),
269 minetest.register_node("main:waterflow", {
270 description = "Water Flow",
271 drawtype = "flowingliquid",
273 tiles = {"water.png"},
276 name = "waterFlow.png",
277 backface_culling = false,
279 type = "vertical_frames",
286 name = "waterFlow.png",
287 backface_culling = true,
289 type = "vertical_frames",
298 paramtype2 = "flowingliquid",
303 is_ground_content = false,
306 liquidtype = "flowing",
307 liquid_alternative_flowing = "main:waterflow",
308 liquid_alternative_source = "main:water",
309 liquid_viscosity = 1,
310 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
311 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
312 --sounds = default.node_sound_water_defaults(),
317 minetest.register_node("default:lava_source", {
318 description = S("Lava Source"),
322 name = "default_lava_source_animated.png",
323 backface_culling = false,
325 type = "vertical_frames",
332 name = "default_lava_source_animated.png",
333 backface_culling = true,
335 type = "vertical_frames",
343 light_source = default.LIGHT_MAX - 1,
348 is_ground_content = false,
351 liquidtype = "source",
352 liquid_alternative_flowing = "default:lava_flowing",
353 liquid_alternative_source = "default:lava_source",
354 liquid_viscosity = 7,
355 liquid_renewable = false,
356 damage_per_second = 4 * 2,
357 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
358 groups = {lava = 3, liquid = 2, igniter = 1},
361 minetest.register_node("default:lava_flowing", {
362 description = S("Flowing Lava"),
363 drawtype = "flowingliquid",
364 tiles = {"default_lava.png"},
367 name = "default_lava_flowing_animated.png",
368 backface_culling = false,
370 type = "vertical_frames",
377 name = "default_lava_flowing_animated.png",
378 backface_culling = true,
380 type = "vertical_frames",
388 paramtype2 = "flowingliquid",
389 light_source = default.LIGHT_MAX - 1,
394 is_ground_content = false,
397 liquidtype = "flowing",
398 liquid_alternative_flowing = "default:lava_flowing",
399 liquid_alternative_source = "default:lava_source",
400 liquid_viscosity = 7,
401 liquid_renewable = false,
402 damage_per_second = 4 * 2,
403 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
404 groups = {lava = 3, liquid = 2, igniter = 1,
405 not_in_creative_inventory = 1},
410 minetest.register_node("main:ladder", {
411 description = "Ladder",
412 drawtype = "signlike",
413 tiles = {"ladder.png"},
414 inventory_image = "ladder.png",
415 wield_image = "ladder.png",
417 paramtype2 = "wallmounted",
418 sunlight_propagates = true,
421 is_ground_content = false,
422 node_placement_prediction = "",
424 type = "wallmounted",
425 --wall_top = = <default>
426 --wall_bottom = = <default>
427 --wall_side = = <default>
429 groups = {wood = 2, flammable = 2, attached_node=1},
430 sounds = main.woodSound(),
431 on_place = function(itemstack, placer, pointed_thing)
433 if pointed_thing.type ~= "node" then
437 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
439 local fakestack = itemstack
442 retval = fakestack:set_name("main:ladder")
451 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
454 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
457 print(itemstack, retval)
458 itemstack:set_name("main:ladder")