minetest-game-adventuretest/mods/farming_plus/grass.lua

89 lines
2.4 KiB
Lua

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",
waving = 1,
walkable = false,
buildable_to = true,
floodable = true,
drop = {
max_items = 1,
items = {
{items = {'farming_plus:seed_wheat'},rarity = 5},
{items = {'default:grass_1'}},
}
},
groups = {snappy=3,flammable=3,flora=1,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,
})
for i=2,5 do
minetest.register_node(":default:grass_"..i, {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_"..i..".png"},
inventory_image = "default_grass_"..i..".png",
wield_image = "default_grass_"..i..".png",
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
floodable = true,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'farming_plus:seed_wheat'},rarity = 5},
{items = {'default:grass_1'}},
}
},
groups = {snappy=3,flammable=3,flora=1,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},
},
})
end
minetest.register_node(":default:junglegrass", {
description = "Jungle Grass",
drawtype = "plantlike",
visual_scale = 1.3,
tiles = {"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
wield_image = "default_junglegrass.png",
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
floodable = true,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'farming_plus:seed_cotton'},rarity = 8},
{items = {'default:junglegrass'}},
}
},
groups = {snappy=3,flammable=2,flora=1,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},
},
})