burntime = 10,
})
+minetest.register_craft({
+ type = "fuel",
+ recipe = "default:grass_1",
+ burntime = 2,
+})
+
--
-- Node definitions
--
walkable = false,
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
})
minetest.register_node("default:leaves", {
},
})
+minetest.register_node("default:grass_1", {
+ description = "Grass",
+ drawtype = "plantlike",
+ tiles = {"default_grass_1.png"},
+ -- use a bigger inventory image
+ inventory_image = "default_grass_3.png",
+ wield_image = "default_grass_3.png",
+ paramtype = "light",
+ walkable = false,
+ groups = {snappy=3,flammable=3,attached_node=1},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
+ on_place = function(itemstack, placer, pointed_thing)
+ -- place a random grass node
+ local stack = ItemStack("default:grass_"..math.random(1,5))
+ local ret = minetest.item_place(stack, placer, pointed_thing)
+ return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
+ end,
+})
+
+minetest.register_node("default:grass_2", {
+ description = "Grass",
+ drawtype = "plantlike",
+ tiles = {"default_grass_2.png"},
+ inventory_image = "default_grass_2.png",
+ wield_image = "default_grass_2.png",
+ paramtype = "light",
+ walkable = false,
+ drop = "default:grass_1",
+ groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
+})
+minetest.register_node("default:grass_3", {
+ description = "Grass",
+ drawtype = "plantlike",
+ tiles = {"default_grass_3.png"},
+ inventory_image = "default_grass_3.png",
+ wield_image = "default_grass_3.png",
+ paramtype = "light",
+ walkable = false,
+ drop = "default:grass_1",
+ groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
+})
+
+minetest.register_node("default:grass_4", {
+ description = "Grass",
+ drawtype = "plantlike",
+ tiles = {"default_grass_4.png"},
+ inventory_image = "default_grass_4.png",
+ wield_image = "default_grass_4.png",
+ paramtype = "light",
+ walkable = false,
+ drop = "default:grass_1",
+ groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
+})
+
+minetest.register_node("default:grass_5", {
+ description = "Grass",
+ drawtype = "plantlike",
+ tiles = {"default_grass_5.png"},
+ inventory_image = "default_grass_5.png",
+ wield_image = "default_grass_5.png",
+ paramtype = "light",
+ walkable = false,
+ drop = "default:grass_1",
+ groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
+ },
+})
+
--
-- Crafting items
--
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine grass amount from perlin noise
- local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0)
+ local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
-- Find random positions for grass based on this random
local pr = PseudoRandom(seed+1)
for i=0,grass_amount do
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.env:get_node({x=x,y=ground_y,z=z}).name
- -- If desert sand, make dry shrub
+ -- If desert sand, add dry shrub
if nn == "default:desert_sand" then
minetest.env:set_node(p,{name="default:dry_shrub"})
- -- If grass, make junglegrass
+ -- If dirt with grass, add grass
elseif nn == "default:dirt_with_grass" then
- minetest.env:set_node(p,{name="default:junglegrass"})
+ minetest.env:set_node(p,{name="default:grass_"..pr:next(1, 5)})
end
end
end