Saplings: Reduce grow time to ABM equivalent
[oweals/minetest_game.git] / mods / default / nodes.lua
index f14e8b215f5816e91d706421a2fe61a38e8ed6a3..701e70b644fef46f1b8c98c9972a0036cbe0aff6 100644 (file)
@@ -608,7 +608,7 @@ minetest.register_node("default:sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(2400,4800))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -742,7 +742,7 @@ minetest.register_node("default:junglesapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(2400,4800))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -821,7 +821,7 @@ minetest.register_node("default:pine_sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(2400,4800))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -901,7 +901,7 @@ minetest.register_node("default:acacia_sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(2400,4800))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -979,7 +979,7 @@ minetest.register_node("default:aspen_sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(2400,4800))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -1362,7 +1362,7 @@ minetest.register_node("default:bush_sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(1200, 2400))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -1433,7 +1433,7 @@ minetest.register_node("default:acacia_bush_sapling", {
        sounds = default.node_sound_leaves_defaults(),
 
        on_construct = function(pos)
-               minetest.get_node_timer(pos):start(math.random(1200, 2400))
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
        end,
 
        on_place = function(itemstack, placer, pointed_thing)
@@ -1783,13 +1783,14 @@ local function get_chest_formspec(pos)
 end
 
 local function chest_lid_obstructed(pos)
-       local above = { x = pos.x, y = pos.y + 1, z = pos.z }
+       local above = {x = pos.x, y = pos.y + 1, z = pos.z}
        local def = minetest.registered_nodes[minetest.get_node(above).name]
        -- allow ladders, signs, wallmounted things and torches to not obstruct
-       if def.drawtype == "airlike" or
+       if def and
+                       (def.drawtype == "airlike" or
                        def.drawtype == "signlike" or
                        def.drawtype == "torchlike" or
-                       (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
+                       (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
                return false
        end
        return true
@@ -1989,12 +1990,19 @@ function default.register_chest(name, d)
        local def_closed = table.copy(def)
 
        def_opened.mesh = "chest_open.obj"
+       for i = 1, #def_opened.tiles do
+               if type(def_opened.tiles[i]) == "string" then
+                       def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
+               elseif def_opened.tiles[i].backface_culling == nil then
+                       def_opened.tiles[i].backface_culling = true
+               end
+       end
        def_opened.drop = "default:" .. name
        def_opened.groups.not_in_creative_inventory = 1
        def_opened.selection_box = {
                type = "fixed",
                fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
-               }
+       }
        def_opened.can_dig = function()
                return false
        end