]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/main/nodes.lua
Added sugarcane, paper, sugar. Sugar is food. Books are now made out of paper. Sugarc...
[Crafter.git] / mods / main / nodes.lua
index 4fd856f6710d06c96800e740086751e6b39e9136..d9f6a0c71972319ffa3c5e2c7d4515d102386ba9 100644 (file)
@@ -1,5 +1,3 @@
-print("Initializing nodes")
-
 --ore def with required tool
 local ores = {"coal","iron","gold","diamond"}
 local tool = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"}
@@ -12,11 +10,10 @@ for id,ore in pairs(ores) do
        local drops = {"main:"..ore.."ore"}
        if ore == "diamond" then drops = {"main:diamond"} elseif ore == "coal" then drops = {"main:coal"} end
        
-       
        minetest.register_node("main:"..ore.."ore", {
                description = ore:gsub("^%l", string.upper).." Ore",
                tiles = {"stone.png^"..ore.."ore.png"},
-               groups = {stone = id, hard = id, pickaxe = 1, hand = 4,pathable = 1},
+               groups = {stone = id, pathable = 1},
                sounds = main.stoneSound(),
                --light_source = 14,--debugging ore spawn
                drop = {
@@ -35,7 +32,7 @@ end
 minetest.register_node("main:stone", {
     description = "Stone",
     tiles = {"stone.png"},
-    groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4,pathable = 1},
+    groups = {stone = 1, hand = 1,pathable = 1},
     sounds = main.stoneSound(),
     drop = {
                max_items = 1,
@@ -52,7 +49,7 @@ minetest.register_node("main:stone", {
 minetest.register_node("main:cobble", {
     description = "Cobblestone",
     tiles = {"cobble.png"},
-    groups = {stone = 2, hard = 1, pickaxe = 2, hand = 4,pathable = 1},
+    groups = {stone = 1, pathable = 1},
     sounds = main.stoneSound(),
     drop = {
                max_items = 1,
@@ -71,10 +68,9 @@ minetest.register_node("main:glass", {
     tiles = {"glass.png"},
     drawtype = "glasslike",
        paramtype = "light",
-       --paramtype2 = "glasslikeliquidlevel",
        sunlight_propagates = true,
        is_ground_content = false,
-    groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4,pathable = 1},
+    groups = {glass = 1, pathable = 1},
     sounds = main.stoneSound({
                footstep = {name = "glass_footstep", gain = 0.4},
         dug =  {name = "break_glass", gain = 0.4},
@@ -85,7 +81,7 @@ minetest.register_node("main:glass", {
 minetest.register_node("main:dirt", {
     description = "Dirt",
     tiles = {"dirt.png"},
-    groups = {dirt = 1, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
+    groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
     sounds = main.dirtSound(),
     paramtype = "light",
 })
@@ -93,7 +89,7 @@ minetest.register_node("main:dirt", {
 minetest.register_node("main:grass", {
     description = "Grass",
     tiles = {"grass.png"},
-    groups = {dirt = 1, soft = 1, shovel = 1, hand = 1, soil=1,pathable = 1},
+    groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
     sounds = main.dirtSound(),
     drop="main:dirt",
 })
@@ -101,17 +97,97 @@ minetest.register_node("main:grass", {
 minetest.register_node("main:sand", {
     description = "Sand",
     tiles = {"sand.png"},
-    groups = {sand = 1, soft = 1, shovel = 1, hand = 1, falling_node = 1,pathable = 1},
+    groups = {sand = 1, falling_node = 1,pathable = 1,soil=1},
     sounds = main.sandSound(),
 })
 
+minetest.register_node("main:sugarcane", {
+    description = "Sugarcane",
+    drawtype = "plantlike",
+    inventory_image = "sugarcane.png",
+       waving = 1,
+       walkable = false,
+       paramtype = "light",
+       is_ground_content = false,      
+    tiles = {"sugarcane.png"},
+    buildable_to = false,
+    node_placement_prediction = "",
+    groups = {dig_immediate=1,flammable=1},
+    sounds = main.grassSound(),
+    floodable = true,
+    on_place = function(itemstack, placer, pointed_thing)
+               local n =  minetest.get_node_group(minetest.get_node(pointed_thing.under).name,"soil") > 0
+               if n then
+                       return(minetest.item_place(itemstack, placer, pointed_thing))
+               end
+    end,
+    after_dig_node = function(pos, node, metadata, digger)
+               if digger == nil then return end
+               local np = {x = pos.x, y = pos.y + 1, z = pos.z}
+               local nn = minetest.get_node(np)
+               if nn.name == node.name then
+                       minetest.node_dig(np, nn, digger)
+               end
+       end,
+    on_flood = function(pos, oldnode, newnode)
+               minetest.throw_item(pos, "main:sugarcane")
+       end,
+    selection_box = {
+               type = "fixed",
+               fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}
+       },
+})
+
+minetest.register_node("main:gravel", {
+    description = "Gravel",
+    tiles = {"gravel.png"},
+    groups = {sand = 1, falling_node = 1,pathable = 1},
+    sounds = main.dirtSound(),
+    drop = {
+               max_items = 1,
+               items= {
+                {
+                       -- Only drop if using a tool whose name is identical to one
+                       -- of these.
+                       rarity = 10,
+                       items = {"main:flint"},
+                       -- Whether all items in the dropped item list inherit the
+                       -- hardware coloring palette color from the dug node.
+                       -- Default is 'false'.
+                       --inherit_color = true,
+               },
+               {
+                       -- Only drop if using a tool whose name is identical to one
+                       -- of these.
+                       --tools = {"main:shears"},
+                       rarity = 0,
+                       items = {"main:gravel"},
+                       -- Whether all items in the dropped item list inherit the
+                       -- hardware coloring palette color from the dug node.
+                       -- Default is 'false'.
+                       --inherit_color = true,
+               },
+       }},
+})
+
 minetest.register_node("main:tree", {
     description = "Tree",
     tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
-    groups = {wood = 2, tree = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
+    groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
     sounds = main.woodSound(),
     --set metadata so treecapitator doesn't destroy houses
     on_place = function(itemstack, placer, pointed_thing)
+               if not pointed_thing.type == "node" then
+                       return
+               end
+               
+               local sneak = placer:get_player_control().sneak
+               local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
+               if not sneak and noddef.on_rightclick then
+                       minetest.item_place(itemstack, placer, pointed_thing)
+                       return
+               end
+               
                local pos = pointed_thing.above
                minetest.item_place_node(itemstack, placer, pointed_thing)
                local meta = minetest.get_meta(pos)
@@ -127,8 +203,9 @@ minetest.register_node("main:tree", {
                if not meta:contains("placed") then
                        --remove tree
                        for y = -6,6 do
+                               local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
                                --print(y)
-                               if minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name == "main:tree" then
+                               if name == "main:tree" or name == "redstone:node_activated_tree" then
                                        minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
                                end
                        end
@@ -141,7 +218,7 @@ minetest.register_node("main:tree", {
 minetest.register_node("main:wood", {
     description = "Wood",
     tiles = {"wood.png"},
-    groups = {wood = 1, hard = 1, axe = 1, hand = 3,pathable = 1},
+    groups = {wood = 1, pathable = 1,flammable=1},
     sounds = main.woodSound(),
 })
 
@@ -154,7 +231,7 @@ minetest.register_node("main:leaves", {
        paramtype = "light",
        is_ground_content = false,      
     tiles = {"leaves.png"},
-    groups = {leaves = 1, plant = 1, axe = 1, hand = 0, leafdecay = 1},
+    groups = {leaves = 1, leafdecay = 1,flammable=1},
     sounds = main.grassSound(),
     drop = {
                max_items = 1,
@@ -212,23 +289,23 @@ minetest.register_node("main:water", {
        waving = 3,
        tiles = {
                {
-                       name = "waterSource.png",
+                       name = "water_source.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 2.0,
+                               length = 1,
                        },
                },
                {
-                       name = "waterSource.png",
+                       name = "water_source.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 2.0,
+                               length = 1,
                        },
                },
        },
@@ -248,35 +325,49 @@ minetest.register_node("main:water", {
        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},
        --sounds = default.node_sound_water_defaults(),
+       
+       --water explodes in the nether
+       on_construct = function(pos)
+               if pos.y <= -10033 then
+                       minetest.remove_node(pos)
+                       tnt(pos,10)
+               end
+       end,
 })
 
 minetest.register_node("main:waterflow", {
        description = "Water Flow",
        drawtype = "flowingliquid",
        waving = 3,
-       tiles = {"water.png"},
+       tiles = {"water_static.png"},
        special_tiles = {
                {
-                       name = "waterFlow.png",
+                       name = "water_flow.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 0.8,
+                               length = 0.5,
                        },
                },
                {
-                       name = "waterFlow.png",
+                       name = "water_flow.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 0.8,
+                               length = 0.5,
                        },
                },
        },
+       selection_box = {
+            type = "fixed",
+            fixed = {
+                {0, 0, 0, 0, 0, 0},
+            },
+        },
        alpha = 191,
        paramtype = "light",
        paramtype2 = "flowingliquid",
@@ -296,35 +387,33 @@ minetest.register_node("main:waterflow", {
        --sounds = default.node_sound_water_defaults(),
 })
 
---[[
-
-minetest.register_node("default:lava_source", {
-       description = S("Lava Source"),
+minetest.register_node("main:lava", {
+       description = "Lava",
        drawtype = "liquid",
        tiles = {
                {
-                       name = "default_lava_source_animated.png",
+                       name = "lava_source.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 3.0,
+                               length = 2.0,
                        },
                },
                {
-                       name = "default_lava_source_animated.png",
+                       name = "lava_source.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 3.0,
+                               length = 2.0,
                        },
                },
        },
        paramtype = "light",
-       light_source = default.LIGHT_MAX - 1,
+       light_source = 13,
        walkable = false,
        pointable = false,
        diggable = false,
@@ -333,8 +422,8 @@ minetest.register_node("default:lava_source", {
        drop = "",
        drowning = 1,
        liquidtype = "source",
-       liquid_alternative_flowing = "default:lava_flowing",
-       liquid_alternative_source = "default:lava_source",
+       liquid_alternative_flowing = "main:lavaflow",
+       liquid_alternative_source = "main:lava",
        liquid_viscosity = 7,
        liquid_renewable = false,
        damage_per_second = 4 * 2,
@@ -342,13 +431,13 @@ minetest.register_node("default:lava_source", {
        groups = {lava = 3, liquid = 2, igniter = 1},
 })
 
-minetest.register_node("default:lava_flowing", {
-       description = S("Flowing Lava"),
+minetest.register_node("main:lavaflow", {
+       description = "Flowing Lava",
        drawtype = "flowingliquid",
-       tiles = {"default_lava.png"},
+       tiles = {"lava_flow.png"},
        special_tiles = {
                {
-                       name = "default_lava_flowing_animated.png",
+                       name = "lava_flow.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
@@ -358,7 +447,7 @@ minetest.register_node("default:lava_flowing", {
                        },
                },
                {
-                       name = "default_lava_flowing_animated.png",
+                       name = "lava_flow.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
@@ -368,9 +457,15 @@ minetest.register_node("default:lava_flowing", {
                        },
                },
        },
+       selection_box = {
+            type = "fixed",
+            fixed = {
+                {0, 0, 0, 0, 0, 0},
+            },
+        },
        paramtype = "light",
        paramtype2 = "flowingliquid",
-       light_source = default.LIGHT_MAX - 1,
+       light_source = 13,
        walkable = false,
        pointable = false,
        diggable = false,
@@ -379,18 +474,15 @@ minetest.register_node("default:lava_flowing", {
        drop = "",
        drowning = 1,
        liquidtype = "flowing",
-       liquid_alternative_flowing = "default:lava_flowing",
-       liquid_alternative_source = "default:lava_source",
+       liquid_alternative_flowing = "main:lavaflow",
+       liquid_alternative_source = "main:lava",
        liquid_viscosity = 7,
        liquid_renewable = false,
-       damage_per_second = 4 * 2,
+       damage_per_second = 2,
        post_effect_color = {a = 191, r = 255, g = 64, b = 0},
-       groups = {lava = 3, liquid = 2, igniter = 1,
-               not_in_creative_inventory = 1},
+       groups = {lava = 3, liquid = 2, igniter = 1},
 })
 
-]]--
-
 minetest.register_node("main:ladder", {
        description = "Ladder",
        drawtype = "signlike",
@@ -410,7 +502,7 @@ minetest.register_node("main:ladder", {
                --wall_bottom = = <default>
                --wall_side = = <default>
        },
-       groups = {wood = 2, flammable = 2, attached_node=1},
+       groups = {wood = 1, flammable = 1, attached_node=1},
        sounds = main.woodSound(),
        on_place = function(itemstack, placer, pointed_thing)
                --copy from torch