From 6757c09a15e9f1ecc8e4935bdff202eb8b9638a7 Mon Sep 17 00:00:00 2001 From: Singularis Date: Mon, 15 Aug 2022 19:27:57 +0200 Subject: [PATCH] use mesh models instead of nodeboxes --- init.lua | 33 +++------ models/bushy_leaves_cheap_model.obj | 80 ++++++++++++++++++++++ models/bushy_leaves_full_model.obj | 100 ++++++++++++++++++++++++++++ models/license.txt | 4 ++ 4 files changed, 192 insertions(+), 25 deletions(-) create mode 100644 models/bushy_leaves_cheap_model.obj create mode 100644 models/bushy_leaves_full_model.obj create mode 100644 models/license.txt diff --git a/init.lua b/init.lua index 8366240..543ec31 100644 --- a/init.lua +++ b/init.lua @@ -15,48 +15,31 @@ Codezeilen und schreibe das auch nicht dran. ]]-- -local node_box_bushy_leaves = { - type = "fixed", - fixed = { - { 0/16, -4/16,-12/16, 0/16, 4/16, 12/16 }, - { 0/16, -8/16, -8/16, 0/16, 8/16, 8/16 }, - { 0/16,-12/16, -4/16, 0/16, 12/16, 4/16 }, - - {-12/16, 0/16, -4/16, 12/16, 0/16, 4/16 }, - { -8/16, 0/16, -8/16, 8/16, 0/16, 8/16 }, - { -4/16, 0/16,-12/16, 4/16, 0/16, 12/16 }, - - {-12/16, -4/16, 0/16, 12/16, 4/16, 0/16 }, - { -8/16, -8/16, 0/16, 8/16, 8/16, 0/16 }, - { -4/16,-12/16, 0/16, 4/16, 12/16, 0/16 }, - }, -} - local node_box_full_node = { type = "fixed", fixed = { -8/16, -8/16, -8/16, 8/16, 8/16, 8/16 }, } -local get_node_box = function(node_name, node_def) - local node_box +local get_mesh = function(node_name, node_def) + local mesh if ( string.match(node_name, "leaves") or string.match(node_name, "needles") ) then - node_box = node_box_bushy_leaves + mesh = "bushy_leaves_full_model.obj" end - return node_box + return mesh end local add_bushy_leaves = function() for node_name, node_def in pairs(minetest.registered_nodes) do - local node_box = get_node_box(node_name, node_def) - if nil ~= node_box then + local mesh = get_mesh(node_name, node_def) + if nil ~= mesh then minetest.override_item( node_name, { - drawtype = "nodebox", - node_box = node_box, + drawtype = "mesh", + mesh = mesh, collision_box = node_box_full_node, } ) diff --git a/models/bushy_leaves_cheap_model.obj b/models/bushy_leaves_cheap_model.obj new file mode 100644 index 0000000..f48c68a --- /dev/null +++ b/models/bushy_leaves_cheap_model.obj @@ -0,0 +1,80 @@ +g bushy +v 0.000000 -0.250000 0.500000 +v 0.000000 0.250000 0.500000 +v 0.000000 0.250000 0.750000 +v 0.000000 -0.250000 0.750000 +v 0.000000 -0.500000 0.250000 +v 0.000000 0.500000 0.250000 +v 0.000000 0.500000 0.500000 +v 0.000000 -0.500000 0.500000 +v 0.000000 -0.750000 -0.250000 +v 0.000000 0.750000 -0.250000 +v 0.000000 0.750000 0.250000 +v 0.000000 -0.750000 0.250000 +v 0.000000 -0.500000 -0.500000 +v 0.000000 0.500000 -0.500000 +v 0.000000 0.500000 -0.250000 +v 0.000000 -0.500000 -0.250000 +v 0.000000 -0.250000 -0.750000 +v 0.000000 0.250000 -0.750000 +v 0.000000 0.250000 -0.500000 +v 0.000000 -0.250000 -0.500000 +v -0.500000 0.000000 -0.500000 +v 0.500000 0.000000 -0.500000 +v 0.500000 0.000000 0.500000 +v -0.500000 0.000000 0.500000 +v -0.250000 0.500000 0.000000 +v 0.250000 0.500000 0.000000 +v 0.250000 0.750000 0.000000 +v -0.250000 0.750000 0.000000 +v -0.500000 0.250000 0.000000 +v 0.500000 0.250000 0.000000 +v 0.500000 0.500000 0.000000 +v -0.500000 0.500000 0.000000 +v -0.750000 -0.250000 0.000000 +v 0.750000 -0.250000 0.000000 +v 0.750000 0.250000 0.000000 +v -0.750000 0.250000 0.000000 +v -0.500000 -0.500000 0.000000 +v 0.500000 -0.500000 0.000000 +v 0.500000 -0.250000 0.000000 +v -0.500000 -0.250000 0.000000 +v -0.250000 -0.750000 0.000000 +v 0.250000 -0.750000 0.000000 +v 0.250000 -0.500000 0.000000 +v -0.250000 -0.500000 0.000000 +vt -0.2500 0.5000 +vt 0.2500 0.5000 +vt 0.2500 0.7500 +vt -0.2500 0.7500 +vt -0.5000 0.2500 +vt 0.5000 0.2500 +vt 0.5000 0.5000 +vt -0.5000 0.5000 +vt -0.7500 -0.2500 +vt 0.7500 -0.2500 +vt 0.7500 0.2500 +vt -0.7500 0.2500 +vt -0.5000 -0.5000 +vt 0.5000 -0.5000 +vt 0.5000 -0.2500 +vt -0.5000 -0.2500 +vt -0.2500 -0.7500 +vt 0.2500 -0.7500 +vt 0.2500 -0.5000 +vt -0.2500 -0.5000 +vn 1.0000 0.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.0000 1.0000 +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 5/5/1 6/6/1 7/7/1 8/8/1 +f 9/9/1 10/10/1 11/11/1 12/12/1 +f 13/13/1 14/14/1 15/15/1 16/16/1 +f 17/17/1 18/18/1 19/19/1 20/20/1 +f 21/13/2 22/14/2 23/7/2 24/8/2 +f 25/1/3 26/2/3 27/3/3 28/4/3 +f 29/5/3 30/6/3 31/7/3 32/8/3 +f 33/9/3 34/10/3 35/11/3 36/12/3 +f 37/13/3 38/14/3 39/15/3 40/16/3 +f 41/17/3 42/18/3 43/19/3 44/20/3 diff --git a/models/bushy_leaves_full_model.obj b/models/bushy_leaves_full_model.obj new file mode 100644 index 0000000..f86703d --- /dev/null +++ b/models/bushy_leaves_full_model.obj @@ -0,0 +1,100 @@ +g skupa +v 0.000000 -0.250000 0.500000 +v 0.000000 0.250000 0.500000 +v 0.000000 0.250000 0.750000 +v 0.000000 -0.250000 0.750000 +v 0.000000 -0.500000 0.250000 +v 0.000000 0.500000 0.250000 +v 0.000000 0.500000 0.500000 +v 0.000000 -0.500000 0.500000 +v 0.000000 -0.750000 -0.250000 +v 0.000000 0.750000 -0.250000 +v 0.000000 0.750000 0.250000 +v 0.000000 -0.750000 0.250000 +v 0.000000 -0.500000 -0.500000 +v 0.000000 0.500000 -0.500000 +v 0.000000 0.500000 -0.250000 +v 0.000000 -0.500000 -0.250000 +v 0.000000 -0.250000 -0.750000 +v 0.000000 0.250000 -0.750000 +v 0.000000 0.250000 -0.500000 +v 0.000000 -0.250000 -0.500000 +v -0.250000 0.000000 0.500000 +v 0.250000 0.000000 0.500000 +v 0.250000 0.000000 0.750000 +v -0.250000 0.000000 0.750000 +v -0.500000 0.000000 0.250000 +v 0.500000 0.000000 0.250000 +v 0.500000 0.000000 0.500000 +v -0.500000 0.000000 0.500000 +v -0.750000 0.000000 -0.250000 +v 0.750000 0.000000 -0.250000 +v 0.750000 0.000000 0.250000 +v -0.750000 0.000000 0.250000 +v -0.500000 0.000000 -0.500000 +v 0.500000 0.000000 -0.500000 +v 0.500000 0.000000 -0.250000 +v -0.500000 0.000000 -0.250000 +v -0.250000 0.000000 -0.750000 +v 0.250000 0.000000 -0.750000 +v 0.250000 0.000000 -0.500000 +v -0.250000 0.000000 -0.500000 +v -0.250000 0.500000 0.000000 +v 0.250000 0.500000 0.000000 +v 0.250000 0.750000 0.000000 +v -0.250000 0.750000 0.000000 +v -0.500000 0.250000 0.000000 +v 0.500000 0.250000 0.000000 +v 0.500000 0.500000 0.000000 +v -0.500000 0.500000 0.000000 +v -0.750000 -0.250000 0.000000 +v 0.750000 -0.250000 0.000000 +v 0.750000 0.250000 0.000000 +v -0.750000 0.250000 0.000000 +v -0.500000 -0.500000 0.000000 +v 0.500000 -0.500000 0.000000 +v 0.500000 -0.250000 0.000000 +v -0.500000 -0.250000 0.000000 +v -0.250000 -0.750000 0.000000 +v 0.250000 -0.750000 0.000000 +v 0.250000 -0.500000 0.000000 +v -0.250000 -0.500000 0.000000 +vt -0.2500 0.5000 +vt 0.2500 0.5000 +vt 0.2500 0.7500 +vt -0.2500 0.7500 +vt -0.5000 0.2500 +vt 0.5000 0.2500 +vt 0.5000 0.5000 +vt -0.5000 0.5000 +vt -0.7500 -0.2500 +vt 0.7500 -0.2500 +vt 0.7500 0.2500 +vt -0.7500 0.2500 +vt -0.5000 -0.5000 +vt 0.5000 -0.5000 +vt 0.5000 -0.2500 +vt -0.5000 -0.2500 +vt -0.2500 -0.7500 +vt 0.2500 -0.7500 +vt 0.2500 -0.5000 +vt -0.2500 -0.5000 +vn 1.0000 0.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.0000 1.0000 +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 5/5/1 6/6/1 7/7/1 8/8/1 +f 9/9/1 10/10/1 11/11/1 12/12/1 +f 13/13/1 14/14/1 15/15/1 16/16/1 +f 17/17/1 18/18/1 19/19/1 20/20/1 +f 21/1/2 22/2/2 23/3/2 24/4/2 +f 25/5/2 26/6/2 27/7/2 28/8/2 +f 29/9/2 30/10/2 31/11/2 32/12/2 +f 33/13/2 34/14/2 35/15/2 36/16/2 +f 37/17/2 38/18/2 39/19/2 40/20/2 +f 41/1/3 42/2/3 43/3/3 44/4/3 +f 45/5/3 46/6/3 47/7/3 48/8/3 +f 49/9/3 50/10/3 51/11/3 52/12/3 +f 53/13/3 54/14/3 55/15/3 56/16/3 +f 57/17/3 58/18/3 59/19/3 60/20/3 diff --git a/models/license.txt b/models/license.txt new file mode 100644 index 0000000..780c557 --- /dev/null +++ b/models/license.txt @@ -0,0 +1,4 @@ +Models: +(c) 2022 Singularis +License: GNU Affero General Public License 3.0 +Models are based on the original node boxes of Bushy Leaves mod. -- 2.40.1