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(),
281 minetest.register_node("main:waterflow", {
282 description = "Water Flow",
283 drawtype = "flowingliquid",
285 tiles = {"water_static.png"},
288 name = "water_flow.png",
289 backface_culling = false,
291 type = "vertical_frames",
298 name = "water_flow.png",
299 backface_culling = true,
301 type = "vertical_frames",
310 paramtype2 = "flowingliquid",
315 is_ground_content = false,
318 liquidtype = "flowing",
319 liquid_alternative_flowing = "main:waterflow",
320 liquid_alternative_source = "main:water",
321 liquid_viscosity = 1,
322 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
323 groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1},
324 --sounds = default.node_sound_water_defaults(),
329 minetest.register_node("default:lava_source", {
330 description = S("Lava Source"),
334 name = "default_lava_source_animated.png",
335 backface_culling = false,
337 type = "vertical_frames",
344 name = "default_lava_source_animated.png",
345 backface_culling = true,
347 type = "vertical_frames",
355 light_source = default.LIGHT_MAX - 1,
360 is_ground_content = false,
363 liquidtype = "source",
364 liquid_alternative_flowing = "default:lava_flowing",
365 liquid_alternative_source = "default:lava_source",
366 liquid_viscosity = 7,
367 liquid_renewable = false,
368 damage_per_second = 4 * 2,
369 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
370 groups = {lava = 3, liquid = 2, igniter = 1},
373 minetest.register_node("default:lava_flowing", {
374 description = S("Flowing Lava"),
375 drawtype = "flowingliquid",
376 tiles = {"default_lava.png"},
379 name = "default_lava_flowing_animated.png",
380 backface_culling = false,
382 type = "vertical_frames",
389 name = "default_lava_flowing_animated.png",
390 backface_culling = true,
392 type = "vertical_frames",
400 paramtype2 = "flowingliquid",
401 light_source = default.LIGHT_MAX - 1,
406 is_ground_content = false,
409 liquidtype = "flowing",
410 liquid_alternative_flowing = "default:lava_flowing",
411 liquid_alternative_source = "default:lava_source",
412 liquid_viscosity = 7,
413 liquid_renewable = false,
414 damage_per_second = 4 * 2,
415 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
416 groups = {lava = 3, liquid = 2, igniter = 1,
417 not_in_creative_inventory = 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")