2017-01-20 15:49:29 +01:00
|
|
|
|
2017-01-21 08:25:41 +10:00
|
|
|
local flowers = {
|
2017-02-19 02:02:29 +01:00
|
|
|
{"lavender", "mapgen:lavender_flower", "Lavender"},
|
|
|
|
{"rose", "flowers:rose", "Rose"},
|
|
|
|
{"tulip", "flowers:tulip", "Tulip"},
|
|
|
|
{"geranium", "flowers:geranium", "Geranium"},
|
|
|
|
{"viola", "flowers:viola", "Viola"},
|
|
|
|
{"dandelion_yellow", "flowers:dandelion_yellow", "Yellow Dandelion"},
|
|
|
|
{"dandelion_white", "flowers:dandelion_white", "White Dandelion"},
|
|
|
|
{"flame_lily", "mapgen:flame_lily", "Flame Lily"},
|
|
|
|
{"mushroom_brown", "flowers:mushroom_brown", "Brown Mushroom"},
|
|
|
|
{"mushroom_red", "flowers:mushroom_red", "Red Mushroom"},
|
|
|
|
{"grass", "default:grass_1", "Grass"},
|
|
|
|
{"dry_grass", "default:dry_grass_1", "Dry Grass"},
|
|
|
|
{"dry_shrub", "default:dry_shrub", "Dry Shrub"},
|
|
|
|
{"papyrus", "default:papyrus", "Papyrus"},
|
|
|
|
{"small_cactus", "mapgen:small_cactus", "Small Cactus"},
|
|
|
|
{"small_cactus_1", "mapgen:small_cactus_1", "Small Cactus1"},
|
|
|
|
{"oxeye_daisy", "mapgen:oxeye_daisy", "Oxeye Daisy"},
|
|
|
|
{"dead_grass", "mapgen:dead_grass_5", "Dead Grass"},
|
|
|
|
{"jungle_grass", "mapgen:jungle_grass_5", "Jungle Grass"},
|
|
|
|
{"sapling", "default:sapling", "Sapling"},
|
|
|
|
{"acacia_sapling", "default:acacia_sapling", "Acacia Sapling"},
|
|
|
|
{"aspen_sapling", "default:aspen_sapling", "Aspen Sapling"},
|
|
|
|
{"junglesapling", "default:junglesapling", "Jungle Sapling"},
|
|
|
|
{"pine_sapling", "default:pine_sapling", "Pine Sapling"},
|
|
|
|
{"junglegrass", "default:junglegrass", "junglegrass"},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
local cubes = {
|
|
|
|
{"cactus", "default:cactus", "Cactus"},
|
|
|
|
{"leaves", "default:leaves", "Leaves"},
|
|
|
|
{"aspen_leaves", "default:aspen_leaves", "Aspen Leaves"},
|
|
|
|
{"pine_needles", "default:pine_needles", "Pine Needles"},
|
|
|
|
{"jungleleaves", "default:jungleleaves", "Jungle Leaves"},
|
|
|
|
{"acacia_leaves", "default:acacia_leaves", "Acacia Leaves"},
|
|
|
|
{"bush_leaves", "default:bush_leaves", "Bush Leaves"},
|
|
|
|
{"acacia_bush_leaves", "default:acacia_bush_leaves", "Acacia Bush Leaves"},
|
|
|
|
{"willow_leaves", "mapgen:willow_leaves", "Willow Leaves"},
|
|
|
|
{"baobab_leaves", "mapgen:baobab_leaves", "Baobab Leaves"},
|
|
|
|
{"yellow_ipe_leaves", "mapgen:yellow_ipe_leaves", "Yellow Ipe Leaves"},
|
|
|
|
{"palm_leaves", "mapgen:palm_leaves", "Palm Leaves"},
|
|
|
|
|
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_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}
|
|
|
|
},
|
2017-02-19 02:02:29 +01:00
|
|
|
groups = {cracky = 1, oddly_breakable_by_hand = 1, attached_node=1},
|
2017-01-20 15:49:29 +01:00
|
|
|
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
|
2017-02-19 02:02:29 +01:00
|
|
|
minetest.set_node(pos, {name="flowerpots:flower_pot_"..flower})
|
|
|
|
if not minetest.setting_getbool("creative") then
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _, row in ipairs(cubes) do
|
|
|
|
local flower = row[1]
|
|
|
|
local flower_node = row[2]
|
|
|
|
if item == flower_node then
|
|
|
|
minetest.set_node(pos, {name="flowerpots:flower_pot_"..flower})
|
|
|
|
if not minetest.setting_getbool("creative") then
|
2017-01-21 08:25:41 +10:00
|
|
|
itemstack:take_item()
|
2017-02-19 02:02:29 +01:00
|
|
|
end
|
2017-01-21 08:25:41 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
2017-01-20 15:49:29 +01:00
|
|
|
})
|
|
|
|
|
2017-02-19 02:02:29 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'flowerpots:flower_pot',
|
|
|
|
recipe = {
|
|
|
|
{'default:clay', 'default:dirt', 'default:clay'},
|
|
|
|
{'', 'default:clay', ''},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
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-02-19 02:02:29 +01:00
|
|
|
local desc = row[3]
|
|
|
|
local texture = minetest.registered_nodes[flower_node]["tiles"]
|
2017-01-21 08:25:41 +10:00
|
|
|
minetest.register_node("flowerpots:flower_pot_"..flower, {
|
2017-02-19 02:02:29 +01:00
|
|
|
description = "Flower Pot With "..desc.."",
|
2017-01-20 15:49:29 +01:00
|
|
|
drawtype = "mesh",
|
2017-02-19 02:02:29 +01:00
|
|
|
mesh = "flowerpot.obj",
|
|
|
|
tiles = {
|
|
|
|
"[combine:32x32:0,0=flowerpot.png:0,0="..texture[1],
|
|
|
|
},
|
|
|
|
visual_scale = 0.5,
|
|
|
|
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}
|
|
|
|
},
|
|
|
|
groups = {cracky = 1, oddly_breakable_by_hand = 1, not_in_creative_inventory=1, attached_node=1},
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
on_rightclick = function(pos, item, clicker)
|
|
|
|
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, flower_node)
|
|
|
|
minetest.set_node(pos, {name="flowerpots:flower_pot"})
|
|
|
|
end,
|
|
|
|
drop = {
|
|
|
|
max_items = 2,items = {{items = {"flowerpots:flower_pot", flower_node},rarity = 1,},},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
for _, row in ipairs(cubes) do
|
|
|
|
local flower = row[1]
|
|
|
|
local flower_node = row[2]
|
|
|
|
local desc = row[3]
|
|
|
|
minetest.register_node("flowerpots:flower_pot_"..flower, {
|
|
|
|
description = "Flower Pot With "..desc.."",
|
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "flowerpot_with_long_cube.obj",
|
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_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}
|
|
|
|
},
|
2017-02-19 02:02:29 +01:00
|
|
|
groups = {cracky = 1, oddly_breakable_by_hand = 1, not_in_creative_inventory=1, attached_node=1},
|
2017-01-20 15:49:29 +01:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2017-01-21 09:44:03 +10:00
|
|
|
on_rightclick = function(pos, item, clicker)
|
2017-02-19 02:02:29 +01:00
|
|
|
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, flower_node)
|
|
|
|
minetest.set_node(pos, {name="flowerpots:flower_pot"})
|
2017-01-21 09:44:03 +10:00
|
|
|
end,
|
2017-02-19 02:02:29 +01:00
|
|
|
drop = {
|
|
|
|
max_items = 2,items = {{items = {"flowerpots:flower_pot", flower_node},rarity = 1,},},
|
|
|
|
},
|
2017-01-21 08:25:41 +10:00
|
|
|
})
|
|
|
|
end
|