Flowerpot: improve and cleanup

This commit is contained in:
MoNTE48 2020-03-16 18:56:40 +01:00
parent 388959dc5a
commit 70a88c27ce
6 changed files with 341 additions and 170 deletions

View File

@ -15,6 +15,12 @@ http://www.gnu.org/licenses/lgpl-3.0.html
License of model
----------------
Copyright (C) 2015-2017 Auke Kok <sofar@foo-projects.org>
Copyright (C) 2015-2017 Auke Kok <sofar@foo-projects.org> (CC-BY-SA-3.0)
Copyright (C) 2020 MultiCraft Development Team (CC-BY-SA-3.0)
CC-BY-SA-3.0
License of textures
-------------------
Copyright (C) 2020 MultiCraft Development Team
Graphics in this mod is NOT free and can only be used as part of the official MultiCraft build.
Allowed to be used in non-official builds ONLY for personal use.

View File

@ -60,80 +60,98 @@ end
local function get_tile(def)
local tile = def.tiles[1]
if type (tile) == "table" then
return tile.name
if type(tile) == "table" then
tile = tile.name
end
return tile
local tiles = {"flowerpot.png"}
if def.drawtype == "plantlike" then
tiles[2] = tile
tiles[3] = "blank.png"
else
tiles[2] = "blank.png"
tiles[3] = tile
end
return tiles
end
local pot = {
drawtype = "mesh",
paramtype = "light",
sunlight_propagates = true,
sounds = default.node_sound_defaults(),
groups = {falling_node = 1, oddly_breakable_by_hand = 3, cracky = 1}
}
local collision_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}
}
function flowerpot.register_node(nodename)
local nodedef = minetest.registered_nodes[nodename]
local name = nodedef.name:gsub(":", "_")
local plantlike = nodedef.drawtype == "plantlike" and true or false
minetest.register_node("flowerpot:" .. name, {
drawtype = "mesh",
mesh = "flowerpot.obj",
tiles = {
{name = "flowerpot.png"},
{name = plantlike and get_tile(nodedef) or "blank.png"},
{name = not plantlike and get_tile(nodedef) or "blank.png"}
},
paramtype = "light",
sunlight_propagates = true,
collision_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, -1/8, 1/4}
},
selection_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, 7/16, 1/4}
},
sounds = default.node_sound_defaults(),
groups = {attached_node = 1, oddly_breakable_by_hand = 1, snappy = 3, not_in_creative_inventory = 1},
drop = {
items = {
{items = {"flowerpot:empty", nodename}}
}
},
local node = table.copy(pot)
node.mesh = "flowerpot.obj"
node.tiles = get_tile(nodedef)
node.collision_box = collision_box
node.selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25}
}
node.groups.not_in_creative_inventory = 1
node.drop = {items = {{items = {"flowerpot:pot", nodename}}}}
node.flowerpot_plantname = nodename
node.on_punch = flowerpot_on_punch
flowerpot_plantname = nodename,
on_punch = flowerpot_on_punch
})
minetest.register_node("flowerpot:" .. name, node)
end
-- Empty Flowerpot
minetest.register_node("flowerpot:empty", {
description = "Flowerpot",
drawtype = "mesh",
mesh = "flowerpot.obj",
inventory_image = "flowerpot_item.png",
wield_image = "flowerpot_item.png",
tiles = {
{name = "flowerpot.png"},
{name = "blank.png"},
{name = "blank.png"}
},
paramtype = "light",
sunlight_propagates = true,
collision_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, -1/8, 1/4}
},
selection_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, -1/16, 1/4}
},
sounds = default.node_sound_defaults(),
groups = {attached_node = 1, oddly_breakable_by_hand = 3, cracky = 1},
on_rightclick = flowerpot_on_rightclick
})
local empty = table.copy(pot)
empty.description = "Flowerpot"
empty.mesh = "flowerpot.obj"
empty.tiles = {"flowerpot.png", "blank.png", "blank.png"}
empty.collision_box = collision_box
empty.selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, -0.0625, 0.25}
}
empty.groups.not_in_creative_inventory = 1
empty.drop = "flowerpot:pot"
empty.on_rightclick = flowerpot_on_rightclick
minetest.register_node("flowerpot:empty", empty)
-- Inventory Flowerpot
local inv = table.copy(pot)
inv.description = "Flowerpot"
inv.mesh = "flowerpot_inv.obj"
inv.tiles = {"flowerpot.png"}
inv.node_placement_prediction = ""
inv.on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local node_def = minetest.registered_nodes[node.name]
if node_def and node_def.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return node_def.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
itemstack = minetest.item_place(ItemStack("flowerpot:empty"), placer, pointed_thing)
itemstack:set_name("flowerpot:pot")
return itemstack
end
minetest.register_node("flowerpot:pot", inv)
-- Craft
minetest.register_craft({
output = "flowerpot:empty",
output = "flowerpot:pot",
recipe = {
{"default:clay_brick", "", "default:clay_brick"},
{"", "default:clay_brick", ""}

View File

@ -1,57 +1,53 @@
# Blender v2.78 (sub 0) OBJ File: 'flowerpot.blend'
# www.blender.org
mtllib flowerpot.mtl
o Cube
v 0.187500 -0.437500 -0.187500
v 0.187500 -0.437500 0.187500
v -0.187500 -0.437500 0.187500
v -0.187500 -0.437500 -0.187500
v 0.187500 -0.125000 -0.187500
v 0.187500 -0.125000 0.187500
v -0.187500 -0.125000 0.187500
v -0.187500 -0.125000 -0.187500
v -0.125000 -0.125000 -0.125000
v 0.125000 -0.125000 0.125000
v 0.125000 -0.125000 -0.125000
v -0.125000 -0.125000 -0.125000
v 0.187500 -0.125000 0.125000
v 0.125000 -0.187500 -0.125000
v 0.125000 -0.187500 0.125000
v -0.187500 -0.125000 -0.125000
v 0.187500 -0.125000 -0.125000
v -0.125000 -0.187500 -0.125000
v -0.125000 -0.187500 0.125000
v -0.187500 -0.125000 0.125000
v 0.125000 -0.125000 0.125000
v -0.125000 -0.125000 -0.125000
v -0.125000 -0.125000 0.125000
v -0.125000 -0.125000 -0.125000
v 0.125000 -0.125000 -0.125000
v 0.125000 -0.125000 0.125000
v -0.125000 -0.125000 0.125000
v -0.125000 -0.125000 0.125000
v 0.125000 -0.125000 -0.125000
v 0.125000 -0.125000 0.125000
v 0.125000 -0.125000 -0.125000
v -0.125000 -0.125000 0.125000
v 0.1875 -0.4375 -0.1875
v 0.1875 -0.4375 0.1875
v -0.1875 -0.4375 0.1875
v -0.1875 -0.4375 -0.1875
v 0.1875 -0.125 -0.1875
v 0.1875 -0.125 0.1875
v -0.1875 -0.125 0.1875
v -0.1875 -0.125 -0.1875
v -0.125 -0.125 -0.125
v 0.125 -0.125 0.125
v 0.125 -0.125 -0.125
v -0.125 -0.125 -0.125
v 0.1875 -0.125 0.125
v 0.125 -0.1875 -0.125
v 0.125 -0.1875 0.125
v -0.1875 -0.125 -0.125
v 0.1875 -0.125 -0.125
v -0.125 -0.1875 -0.125
v -0.125 -0.1875 0.125
v -0.1875 -0.125 0.125
v 0.125 -0.125 0.125
v -0.125 -0.125 -0.125
v -0.125 -0.125 0.125
v -0.125 -0.125 -0.125
v 0.125 -0.125 -0.125
v 0.125 -0.125 0.125
v -0.125 -0.125 0.125
v -0.125 -0.125 0.125
v 0.125 -0.125 -0.125
v 0.125 -0.125 0.125
v 0.125 -0.125 -0.125
v -0.125 -0.125 0.125
v -0.172986 -0.104281 -0.179133
v 0.172986 -0.187289 0.179132
v 0.172986 -0.104282 0.179132
v 0.230648 -0.104282 0.238843
v -0.238843 0.476773 0.230648
v 0.238843 0.476773 -0.230648
v -0.125000 -0.500000 0.125000
v -0.125000 -0.500000 -0.125000
v 0.187500 -0.437500 0.125000
v 0.125000 -0.500000 -0.125000
v -0.187500 -0.437500 -0.125000
v 0.187500 -0.437500 -0.125000
v 0.125000 -0.500000 0.125000
v -0.187500 -0.437500 0.125000
v 0.125000 -0.437500 0.125000
v 0.125000 -0.437500 -0.125000
v -0.125000 -0.437500 -0.125000
v -0.125000 -0.437500 0.125000
v -0.125 -0.5 0.125
v -0.125 -0.5 -0.125
v 0.1875 -0.4375 0.125
v 0.125 -0.5 -0.125
v -0.1875 -0.4375 -0.125
v 0.1875 -0.4375 -0.125
v 0.125 -0.5 0.125
v -0.1875 -0.4375 0.125
v 0.125 -0.4375 0.125
v 0.125 -0.4375 -0.125
v -0.125 -0.4375 -0.125
v -0.125 -0.4375 0.125
v -0.230648 0.476773 -0.238843
v -0.230648 -0.104281 -0.238843
v -0.172986 -0.187289 -0.179133
@ -70,12 +66,12 @@ v 0.132812 0.476682 0.132813
v -0.132813 0.476682 0.132812
v -0.132812 0.476682 -0.132812
v 0.132813 0.476682 -0.132812
vt 0.6250 0.5000
vt 0.6250 0.7500
vt 0.3750 0.7500
vt 0.3750 0.5000
vt 1.0000 0.5625
vt 1.0000 0.8750
vt 0.6250 0.5
vt 0.6250 0.75
vt 0.3750 0.75
vt 0.3750 0.5
vt 1 0.5625
vt 1 0.8750
vt 0.9375 0.8750
vt 0.6875 0.8750
vt 0.6250 0.8750
@ -83,8 +79,8 @@ vt 0.6250 0.5625
vt 0.6875 0.5625
vt 0.9375 0.5625
vt 0.3750 0.9375
vt 0.0000 0.9375
vt 0.0000 0.8750
vt 0 0.9375
vt 0 0.8750
vt 0.3750 0.8750
vt 0.9375 0.9375
vt 0.6875 0.9375
@ -93,52 +89,52 @@ vt 0.9375 0.8750
vt 0.9375 0.9375
vt 0.3125 0.9375
vt 0.0625 0.9375
vt -0.0000 0.9375
vt -0.0000 0.8750
vt 0 0.9375
vt 0 0.8750
vt 0.3750 0.8750
vt 0.3750 0.9375
vt 0.0000 0.5625
vt 0 0.5625
vt 0.3750 0.5625
vt 0.3125 1.0000
vt 0.0625 1.0000
vt 0.3125 1
vt 0.0625 1
vt 0.9375 0.9375
vt 0.6875 0.9375
vt 0.6875 0.9375
vt 0.9375 0.9375
vt 1.0000 0.5625
vt 1.0000 0.8750
vt 0.6250 0.8750
vt 1 0.5625
vt 1 0.8750
vt 0.6250 0.875
vt 0.6250 0.5625
vt 0.6875 0.5625
vt 0.9375 0.5625
vt 0.3750 0.5625
vt 0.0000 0.5625
vt 0 0.5625
vt 0.0625 0.9375
vt 0.3125 0.9375
vt 0.3125 1.0000
vt 0.0625 1.0000
vt 0.9375 1.0000
vt 0.6875 1.0000
vt 0.9375 1.0000
vt 0.6875 1.0000
vt 0.0000 0.5000
vt 0.0625 0.5000
vt 0.3125 0.5000
vt 0.3750 0.5000
vt 0.3125 0.5000
vt 0.0625 0.5000
vt 0.3125 1
vt 0.0625 1
vt 0.9375 1
vt 0.6875 1
vt 0.9375 1
vt 0.6875 1
vt 0 0.5
vt 0.0625 0.5
vt 0.3125 0.5
vt 0.3750 0.5
vt 0.3125 0.5
vt 0.0625 0.5
vt 0.0625 0.4375
vt 0.3125 0.4375
vt 0.3750 0.5000
vt 0.0000 0.5000
vt 0.6875 0.5000
vt 0.9375 0.5000
vt 0.6875 0.5000
vt 0.9375 0.5000
vt 0.3750 1.0000
vt 0.3750 0.7500
vt 0.6250 0.7500
vt 0.6250 1.0000
vt 0.3750 0.5
vt 0 0.5
vt 0.6875 0.5
vt 0.9375 0.5
vt 0.6875 0.5
vt 0.9375 0.5
vt 0.3750 1
vt 0.3750 0.75
vt 0.6250 0.75
vt 0.6250 1
vt 0.6875 0.4375
vt 0.9375 0.4375
vt 0.0625 0.4375
@ -165,29 +161,29 @@ 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.0625 0
vt 0.3125 0
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.25 0
vt 0.5 0
vt 0.5 0.6250
vt 0.25 0.6250
vt 0.75 0
vt 0.75 0.6250
vt 0.9375 0
vt 0.6875 0
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
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 -1.0000 -0.0000
vn 0.7193 0.0000 -0.6947
vn 0.6947 -0.0000 0.7193
g Cube_Cube_pot
vn 0 1 0
vn 1 0 0
vn 0 0 1
vn -1 0 0
vn 0 0 -1
vn 0 -1 0
vn 0.7193 0 -0.6947
vn 0.6947 0 0.7193
g pot
usemtl pot
s off
f 18/1/1 19/2/1 15/3/1 14/4/1
@ -212,11 +208,11 @@ f 40/66/6 42/67/6 45/68/6 39/69/6
f 48/65/2 47/64/2 45/70/2 42/71/2
f 47/54/3 50/53/3 39/72/3 45/73/3
f 50/63/4 49/62/4 40/74/4 39/75/4
g Cube_Cube_plant
g 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
g 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

View File

@ -0,0 +1,151 @@
v -0.25264 0.06405 -0.25264
v -0.25264 0.06405 0.25264
v 0.25264 0.06405 0.25264
v 0.25264 0.06405 -0.25264
v 0.37897 -0.44124 -0.378972
v 0.37897 0.19038 -0.37897
v 0.37897 0.19038 -0.25264
v 0.37897 0.19038 0.25264
v 0.37897 0.19038 0.37897
v 0.37897 -0.44124 0.37897
v 0.37897 -0.44124 0.252647
v 0.37897 -0.44124 -0.25264
v -0.37897 0.19038 0.25264
v -0.37897 0.19038 0.37897
v -0.25264 0.19038 0.25264
v -0.37897 0.19038 -0.25264
v -0.37897 0.19038 -0.37897
v -0.37897 -0.44124 0.37897
v -0.37897 -0.44124 -0.378972
v -0.37897 -0.44124 -0.25264
v -0.37897 -0.44124 0.252647
v -0.25264 -0.44124 0.252647
v 0.25264 -0.44124 0.252647
v -0.25264 -0.44124 -0.25264
v 0.25264 -0.44124 -0.25264
v 0.25264 -0.56756 -0.25264
v -0.25264 -0.56756 -0.25264
v 0.25264 -0.56756 0.252647
v -0.25264 -0.56756 0.252647
v 0.34963 0.06448 0.36206
v -0.34963 0.06448 -0.36206
v -0.36206 0.06448 0.34963
v 0.36206 0.06448 -0.34963
v -0.26844 0.06448 -0.26844
v -0.26844 0.06448 0.26844
v 0.26844 0.06448 0.26844
v 0.26844 0.06448 -0.26844
v -0.25264 0.19038 -0.25264
v 0.25264 0.19038 -0.25264
v 0.25264 0.19038 0.25264
vt 0.625 0.5
vt 0.625 0.75
vt 0.375 0.75
vt 0.375 0.5
vt 1. 0.5625
vt 1. 0.875
vt 0.9375 0.875
vt 0.687500 0.875
vt 0.625 0.875
vt 0.625 0.5625
vt 0.687500 0.5625
vt 0.9375 0.5625
vt 0.375 0.9375
vt 0 0.9375
vt 0 0.875
vt 0.375 0.875
vt 0.9375 0.9375
vt 0.687500 0.9375
vt 0.687500 0.875
vt 0.9375 0.875
vt 0.312500 0.9375
vt 0.0625 0.9375
vt -0 0.9375
vt -0 0.875
vt 0.375 0.875
vt 0.375 0.9375
vt 0 0.5625
vt 0.375 0.5625
vt 0.312500 1.
vt 0.0625 1.
vt 0.9375 0.9375
vt 0.687500 0.9375
vt 1. 0.5625
vt 1. 0.875
vt 0.625 0.875
vt 0.625 0.5625
vt 0.687500 0.5625
vt 0.9375 0.5625
vt 0.375 0.5625
vt 0 0.5625
vt 0.0625 0.9375
vt 0.312500 0.9375
vt 0.312500 1
vt 0.0625 1
vt 0.9375 1
vt 0.687500 1
vt 0.9375 1
vt 0.687500 1
vt 0 0.5
vt 0.0625 0.5
vt 0.312500 0.5
vt 0.375 0.5
vt 0.312500 0.5
vt 0.0625 0.5
vt 0.0625 0.4375
vt 0.312500 0.4375
vt 0.375 0.5
vt 0 0.5
vt 0.687500 0.5
vt 0.9375 0.5
vt 0.687500 0.5
vt 0.9375 0.5
vt 0.375 1
vt 0.375 0.75
vt 0.625 0.75
vt 0.625 1
vt 0.687500 0.4375
vt 0.9375 0.4375
vt 0.0625 0.4375
vt 0.312500 0.4375
vt 0.687500 0.4375
vt 0.9375 0.4375
vn 0 1 0
vn 1 0 0
vn 0 0 1
vn -0.7071 0 0.7071
vn 0.7071 0 0.7071
vn -1.0 0 0
vn 0 0 -1
vn 0.7071 0 -0.7071
vn -0.7071 0 -0.7071
vn 0 -1 0
s 1
f 1/1/1 2/2/1 3/3/1 4/4/1
f 5/5/2 6/6/2 7/7/2 8/8/2 9/9/2 10/10/2 11/11/2 12/12/2
f 8/13/1 13/14/1 14/15/1 9/16/1
f 15/17/1 38/18/1 16/19/1 13/20/1
f 38/21/1 39/22/1 7/23/1 6/24/1 17/25/1 16/26/1
f 18/27/3 10/28/3 9/16/3 14/15/3
f 39/22/4 38/21/5 1/29/5 4/30/4
f 39/31/1 40/32/1 8/8/1 7/7/1
f 18/33/6 14/34/6 13/20/6 16/19/6 17/35/6 19/36/6 20/37/6 21/38/6
f 19/39/7 17/25/7 6/24/7 5/40/7
f 15/41/8 40/42/9 3/43/9 2/44/8
f 40/32/9 39/31/4 4/45/4 3/46/9
f 38/18/5 15/17/8 2/47/8 1/48/5
f 10/28/10 18/27/10 21/49/10 22/50/10 23/51/10 11/52/10
f 24/53/7 25/54/7 26/55/7 27/56/7
f 25/54/10 24/53/10 20/57/10 19/39/10 5/40/10 12/58/10
f 24/59/10 22/60/10 21/38/10 20/37/10
f 12/12/10 11/11/10 23/61/10 25/62/10
f 27/63/10 26/64/10 28/65/10 29/66/10
f 25/62/2 23/61/2 28/67/2 26/68/2
f 23/51/3 22/50/3 29/69/3 28/70/3
f 22/60/6 24/59/6 27/71/6 29/72/6
l 30 31
l 32 33
l 34 35
l 35 36
l 36 37
l 34 37

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB