2017-01-20 15:49:29 +01:00
|
|
|
|
2017-01-21 08:25:41 +10:00
|
|
|
local flowers = {
|
2017-01-22 08:47:48 +10:00
|
|
|
{"lavender", "mapgen:lavender_flower", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"rose", "flowers:rose", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"tulip", "flowers:tulip", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"geranium", "flowers:geranium", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"viola", "flowers:viola", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"dandelion_yellow", "flowers:dandelion_yellow", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"dandelion_white", "flowers:dandelion_white", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"flame_lily", "mapgen:flame_lily", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"mushroom_brown", "flowers:mushroom_brown", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"mushroom_red", "flowers:mushroom_red", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"grass", "default:grass_1", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"dry_grass", "default:dry_grass_1", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"dry_shrub", "default:dry_shrub", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"papyrus", "default:papyrus", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"purple_allium", "mapgen:purple_allium", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"small_cactus", "mapgen:small_cactus", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"small_cactus_1", "mapgen:small_cactus_1", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"oxeye_daisy", "mapgen:oxeye_daisy", "flowerpot_with_Xflower.obj"},
|
2017-01-22 08:51:34 +10:00
|
|
|
{"dead_grass", "mapgen:dead_grass_5", "flowerpot_with_Xflower.obj"},
|
|
|
|
{"jungle_grass", "mapgen:jungle_grass_5", "flowerpot_with_Xflower.obj"},
|
2017-01-21 08:25:41 +10:00
|
|
|
}
|
|
|
|
|
2017-01-20 15:49:29 +01:00
|
|
|
minetest.register_node("flowerpots:flower_pot", {
|
|
|
|
description = "Flower Pot",
|
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "flowerpot.obj",
|
|
|
|
tiles = {
|
|
|
|
"flowerpot.png",
|
|
|
|
},
|
|
|
|
visual_scale = 0.5,
|
|
|
|
wield_image = "flowerpot_item.png",
|
|
|
|
wield_scale = {x=1.0, y=1.0, z=1.0},
|
|
|
|
paramtype = "light",
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
|
|
|
},
|
|
|
|
collision_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
|
|
|
},
|
|
|
|
inventory_image = "flowerpot_item.png",
|
|
|
|
groups = {cracky = 2, stone = 1},
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2017-01-21 08:25:41 +10:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack)
|
|
|
|
local item = clicker:get_wielded_item():get_name()
|
|
|
|
for _, row in ipairs(flowers) do
|
|
|
|
local flower = row[1]
|
|
|
|
local flower_node = row[2]
|
|
|
|
if item == flower_node then
|
|
|
|
minetest.env:set_node(pos, {name="flowerpots:flower_pot_"..flower})
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
2017-01-20 15:49:29 +01:00
|
|
|
})
|
|
|
|
|
2017-01-21 08:25:41 +10:00
|
|
|
for _, row in ipairs(flowers) do
|
|
|
|
local flower = row[1]
|
2017-01-21 09:44:03 +10:00
|
|
|
local flower_node = row[2]
|
2017-01-22 08:47:48 +10:00
|
|
|
local model = row[3]
|
2017-01-21 08:25:41 +10:00
|
|
|
minetest.register_node("flowerpots:flower_pot_"..flower, {
|
|
|
|
description = "Flower Pot With "..flower.." Flower",
|
2017-01-20 15:49:29 +01:00
|
|
|
drawtype = "mesh",
|
2017-01-22 08:47:48 +10:00
|
|
|
mesh = model,
|
2017-01-20 15:49:29 +01:00
|
|
|
tiles = {
|
2017-01-21 08:25:41 +10:00
|
|
|
"flowerpot_"..flower..".png",
|
2017-01-20 15:49:29 +01:00
|
|
|
},
|
|
|
|
visual_scale = 0.5,
|
|
|
|
wield_image = "flowerpot_item.png",
|
|
|
|
wield_scale = {x=1.0, y=1.0, z=1.0},
|
|
|
|
paramtype = "light",
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
|
|
|
},
|
|
|
|
collision_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
|
|
|
},
|
|
|
|
inventory_image = "flowerpot_item.png",
|
|
|
|
groups = {cracky = 2, stone = 1},
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2017-01-21 09:44:03 +10:00
|
|
|
on_rightclick = function(pos, item, clicker)
|
|
|
|
minetest.env:add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, flower_node)
|
|
|
|
minetest.env:set_node(pos, {name="flowerpots:flower_pot"})
|
|
|
|
end,
|
2017-01-21 08:25:41 +10:00
|
|
|
})
|
|
|
|
end
|