grass added

master
Victor Hackeridze 2012-04-23 21:00:51 +06:00
parent 2c3b1b2f14
commit 046f39c46c
3 changed files with 53 additions and 5 deletions

View File

@ -43,7 +43,9 @@ local is_node_in_cube = function(nodenames, node_pos, radius)
return false
end
local grow_blocks_on_surfaces = function(growdelay, grownames, surfaces)
flowers = {}
flowers.grow_blocks_on_surfaces = function(growdelay, grownames, surfaces)
for _, surface in ipairs(surfaces) do
minetest.register_abm({
nodenames = { surface.name },
@ -167,7 +169,7 @@ minetest.register_craft({
})
-- Make it grow !
grow_blocks_on_surfaces(GROWING_DELAY * 2, {
flowers.grow_blocks_on_surfaces(GROWING_DELAY * 2, {
"flowers:flower_rose",
"flowers:flower_dandelion_white",
"flowers:flower_viola",
@ -175,20 +177,20 @@ grow_blocks_on_surfaces(GROWING_DELAY * 2, {
{name = "dirt_with_grass", chance = 4, spacing = 15},
})
grow_blocks_on_surfaces(GROWING_DELAY, {
flowers.grow_blocks_on_surfaces(GROWING_DELAY, {
"flowers:flower_dandelion_yellow",
"flowers:flower_tulip",
}, {
{name = "dirt_with_grass", chance = 2, spacing = 10},
})
grow_blocks_on_surfaces(GROWING_DELAY*3, {
flowers.grow_blocks_on_surfaces(GROWING_DELAY*3, {
"flowers:flower_cotton",
}, {
{name = "dirt_with_grass", chance = 3, spacing = 12},
})
grow_blocks_on_surfaces(GROWING_DELAY / 2, {
flowers.grow_blocks_on_surfaces(GROWING_DELAY / 2, {
"flowers:flower_waterlily",
}, {
{name = "water_source", chance = 1, spacing = 15},

46
rtmg/mods/grass/init.lua Normal file
View File

@ -0,0 +1,46 @@
-- grass mod
minetest.register_node("grass:grass", {
tile_images = {"grass_grass.png"},
inventory_image = "grass_grass.png",
visual_scale = PLANTS_VISUAL_SCALE,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -0.3, 1/2},
},
description = "Grass",
drawtype = "plantlike",
visual_scale = 1.19,
wield_image = "grass_grass.png",
paramtype = "light",
walkable = false,
groups = {snappy=3,flammable=2},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 1,
items = {
{
items = {'wheat:wheat_seeds'},
rarity = 1,
},
}
},
stack_max = 128,
})
minetest.register_abm({
nodenames = { "default:dirt_with_grass" },
interval = 160,
chance = 50,
action = function(pos, node, active_object_count, active_object_count_wider)
local p_top = {
x = pos.x,
y = pos.y + 1,
z = pos.z
}
local n_top = minetest.env:get_node(p_top)
if (n_top.name == "air") then
minetest.env:add_node(p_top, { name = "grass:grass" })
end
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B