]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/main/nodes.lua
remove server debug
[Crafter.git] / mods / main / nodes.lua
index 7f39373f6f40f246198365646a4e34fae5d2f297..28b8b134e220950a21f70504756788e2f57f5c40 100644 (file)
@@ -1,19 +1,73 @@
+local minetest,pairs = minetest,pairs
 --ore def with required tool
-local ores = {"coal","iron","gold","diamond"}
-local tool = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"}
-for id,ore in pairs(ores) do
-       local tool_required = {}
-       for i = id,5 do
-               table.insert(tool_required, tool[i])
-       end
+local tool = {"main:woodpick","main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"}
+local ores = {
+["coal"]={"main:woodpick","main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["iron"]={"main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["lapis"]={"main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["gold"]={"main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["diamond"]={"main:ironpick","main:lapispick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["emerald"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["sapphire"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+["ruby"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
+}
+
+local drops ={
+       ["coal"]={"main:coal"},
+       ["iron"]={"main:ironore"},
+       ["lapis"]={"main:lapis"},
+       ["gold"]={"main:goldore"},
+       ["diamond"]={"main:diamond"},
+       ["emerald"]={"main:emerald"},
+       ["sapphire"]={"main:sapphire"},
+       ["ruby"]={"main:ruby"},
+}
+
+local levels = {
+       ["coal"]=1,
+       ["iron"]=2,
+       ["lapis"]=3,
+       ["gold"]=3,
+       ["diamond"]=4,
+       ["emerald"]=5,
+       ["sapphire"]=6,
+       ["ruby"]=7,
+}
+
+
+local level = 0
+local experience
+for ore,tool_required in pairs(ores) do
+       level = levels[ore]
 
-       local drops = {"main:"..ore.."ore"}
-       if ore == "diamond" then drops = {"main:diamond"} elseif ore == "coal" then drops = {"main:coal"} end
+       if ore == "iron" or ore == "gold" then 
+               experience = 0
+       else
+               experience = level
+       end
        
+       minetest.register_node("main:"..ore.."block", {
+               description = ore:gsub("^%l", string.upper).." Block",
+               tiles = {ore.."block.png"},
+               groups = {stone = level, pathable = 1},
+               sounds = main.stoneSound(),
+               --light_source = 14,--debugging ore spawn
+               drop = {
+                       max_items = 1,
+                       items= {
+                               {
+                                       rarity = 0,
+                                       tools = tool_required,
+                                       items = {"main:"..ore.."block"},
+                               },
+                               },
+                       },
+               })
+
        minetest.register_node("main:"..ore.."ore", {
                description = ore:gsub("^%l", string.upper).." Ore",
                tiles = {"stone.png^"..ore.."ore.png"},
-               groups = {stone = id, pathable = 1,experience=id},
+               groups = {stone = level, pathable = 1,experience=experience},
                sounds = main.stoneSound(),
                --light_source = 14,--debugging ore spawn
                drop = {
@@ -22,11 +76,36 @@ for id,ore in pairs(ores) do
                                {
                                        rarity = 0,
                                        tools = tool_required,
-                                       items = drops,
+                                       items = drops[ore],
                                },
                                },
                        },
                })
+       minetest.register_node(":nether:"..ore.."ore", {
+               description = "Nether "..ore:gsub("^%l", string.upper).." Ore",
+               tiles = {"netherrack.png^"..ore.."ore.png"},
+               groups = {netherrack = level, pathable = 1, experience = experience},
+               sounds = main.stoneSound(),
+               light_source = 7,
+               drop = {
+                       max_items = 1,
+                       items= {
+                               {
+                                       rarity = 0,
+                                       tools = tool_required,
+                                       items = drops[ore],
+                               },
+                               },
+                       },
+               after_destruct = function(pos, oldnode)
+                       if math.random() > 0.95 then
+                               minetest.sound_play("tnt_ignite",{pos=pos,max_hear_distance=64})
+                               minetest.after(1.5, function(pos)
+                                       tnt(pos,5)
+                               end,pos)
+                       end
+               end,
+       })
 end
 
 minetest.register_node("main:stone", {
@@ -186,6 +265,12 @@ minetest.register_node("main:gravel", {
        }},
 })
 
+local acceptable_soil = {
+       ["main:dirt"] = true,
+       ["main:grass"] = true,
+       ["aether:dirt"] = true,
+       ["aether:grass"] = true,
+}
 minetest.register_node("main:tree", {
     description = "Tree",
     tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
@@ -251,7 +336,7 @@ minetest.register_node("main:tree", {
                                        })
                                        
                                        local name2 = minetest.get_node(vector.new(pos.x,pos.y+y-1,pos.z)).name
-                                       if name2 == "main:dirt" or name2 == "main:grass" then
+                                       if acceptable_soil[name2] then
                                                minetest.add_node(vector.new(pos.x,pos.y+y,pos.z),{name="main:sapling"})
                                        end
                                end
@@ -290,11 +375,11 @@ minetest.register_node("main:leaves", {
                        items = {"main:dropped_leaves"},
                },
                {
-                       rarity = 6,
+                       rarity = 25,
                        items = {"main:apple"},
                },
                {
-                       rarity = 10,
+                       rarity = 20,
                        items = {"main:sapling"},
                },
                },
@@ -363,13 +448,12 @@ minetest.register_node("main:water", {
        buildable_to = true,
        is_ground_content = false,
        drop = "",
-       drowning = 1,
        liquidtype = "source",
        liquid_alternative_flowing = "main:waterflow",
        liquid_alternative_source = "main:water",
-       liquid_viscosity = 1,
+       liquid_viscosity = 0,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
-       groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1,disable_fall_damage=1},
+       groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1,disable_fall_damage=1,extinguish=1},
        --sounds = default.node_sound_water_defaults(),
        
        --water explodes in the nether
@@ -427,13 +511,12 @@ minetest.register_node("main:waterflow", {
        buildable_to = true,
        is_ground_content = false,
        drop = "",
-       drowning = 1,
        liquidtype = "flowing",
        liquid_alternative_flowing = "main:waterflow",
        liquid_alternative_source = "main:water",
-       liquid_viscosity = 1,
+       liquid_viscosity = 0,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
-       groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1,disable_fall_damage=1},
+       groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1,disable_fall_damage=1,extinguish=1},
        --sounds = default.node_sound_water_defaults(),
 })
 
@@ -477,7 +560,7 @@ minetest.register_node("main:lava", {
        liquid_viscosity = 7,
        liquid_renewable = false,
        post_effect_color = {a = 191, r = 255, g = 64, b = 0},
-       groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
+       groups = {lava = 3, liquid = 2, igniter = 1, fire=1,hurt_inside=1},
 })
 
 minetest.register_node("main:lavaflow", {
@@ -529,7 +612,7 @@ minetest.register_node("main:lavaflow", {
        liquid_renewable = false,
        liquid_range = 3,
        post_effect_color = {a = 191, r = 255, g = 64, b = 0},
-       groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
+       groups = {lava = 3, liquid = 2, igniter = 1, fire=1,hurt_inside=1},
 })
 
 minetest.register_node("main:ladder", {