Support cactus in flowerpot.

This commit is contained in:
Auke Kok 2017-02-10 18:08:32 -08:00
parent d018f699db
commit 8d7073d5a6
2 changed files with 58 additions and 7 deletions

View File

@ -59,6 +59,14 @@ local function flowerpot_on_rightclick(pos, node, clicker, itemstack, pointed_th
return itemstack
end
local function get_tile(def)
local tile = def.tiles[1]
if type (tile) == "table" then
return tile.name
end
return tile
end
function flowerpot.register_node(nodename)
assert(nodename, "no nodename passed")
local nodedef = minetest.registered_nodes[nodename]
@ -66,19 +74,27 @@ function flowerpot.register_node(nodename)
local desc = nodedef.description
local name = nodedef.name:gsub(":", "_")
local tile = nodedef.tiles[1]
if type(tile) == "table" then
tile = tile.name
local tiles = {}
if nodedef.drawtype == "plantlike" then
tiles = {
{name = "flowerpot.png"},
{name = get_tile(nodedef)},
{name = "doors_blank.png"},
}
else
tiles = {
{name = "flowerpot.png"},
{name = "doors_blank.png"},
{name = get_tile(nodedef)},
}
end
minetest.register_node("flowerpot:" .. name, {
description = "Flowerpot with " .. desc,
drawtype = "mesh",
mesh = "flowerpot.obj",
tiles = {
{name = "flowerpot.png"},
{name = tile},
},
tiles = tiles,
paramtype = "light",
sunlight_propagates = true,
collision_box = {
@ -104,6 +120,7 @@ minetest.register_node("flowerpot:empty", {
tiles = {
{name = "flowerpot.png"},
{name = "doors_blank.png"},
{name = "doors_blank.png"},
},
paramtype = "light",
sunlight_propagates = true,
@ -151,6 +168,7 @@ for _, node in pairs({
"default:bush_stem",
"default:acacia_bush_stem",
"default:papyrus",
"default:cactus",
"flowers:rose",
"flowers:tulip",
"flowers:dandelion_yellow",

View File

@ -62,6 +62,14 @@ v -0.224794 -0.109375 0.217081
v 0.168595 -0.187500 -0.162811
v -0.168595 -0.109375 0.162811
v 0.168595 -0.109375 -0.162811
v 0.125000 -0.187500 -0.125000
v 0.125000 -0.187500 0.125000
v -0.125000 -0.187500 -0.125000
v -0.125000 -0.187500 0.125000
v 0.125000 0.437415 0.125000
v -0.125000 0.437415 0.125000
v -0.125000 0.437415 -0.125000
v 0.125000 0.437415 -0.125000
vt 0.6250 0.5000
vt 0.6250 0.7500
vt 0.3750 0.7500
@ -153,6 +161,24 @@ vt 0.8735 0.0020
vt 0.1265 0.0020
vt 0.1265 0.1265
vt 0.0020 0.1265
vt 0.1875 0.8750
vt 0.1875 0.6250
vt 0.4375 0.6250
vt 0.4375 0.8750
vt 0.0625 -0.0000
vt 0.3125 -0.0000
vt 0.3125 0.6250
vt 0.0625 0.6250
vt 0.2500 -0.0000
vt 0.5000 -0.0000
vt 0.5000 0.6250
vt 0.2500 0.6250
vt 0.7500 -0.0000
vt 0.7500 0.6250
vt 0.9375 0.0000
vt 0.6875 -0.0000
vt 0.6875 0.6250
vt 0.9375 0.6250
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
@ -190,6 +216,13 @@ g Cube_Cube_plant
usemtl plant
f 54/76/7 36/77/7 35/78/7 34/79/7 53/80/7 33/81/7 52/82/7 51/83/7
f 38/84/8 37/85/8 57/86/8 59/87/8 55/88/8 58/89/8 60/90/8 56/91/8
g Cube_Cube_block
usemtl block
f 67/92/1 66/93/1 65/94/1 68/95/1
f 63/96/4 64/97/4 66/98/4 67/99/4
f 64/100/3 62/101/3 65/102/3 66/103/3
f 62/101/2 61/104/2 68/105/2 65/102/2
f 61/106/5 63/107/5 67/108/5 68/109/5
l 28 23
l 22 9
l 11 31