From ff3c34cb2f380e78c51cc81098d552f07cbada54 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 18 Oct 2016 14:09:34 -0700 Subject: Convert to meshoptions plantlike. - remove custom model for corn! - corn model stays the same shape, param2 = 3 - tomato now is + shaped, not x, param2 = 1 --- corn.lua | 63 +++++++++++++++++---------------------- models/crops_orthogonal_plant.obj | 31 ------------------- potato.lua | 8 +++-- tomato.lua | 14 +++++---- 4 files changed, 42 insertions(+), 74 deletions(-) delete mode 100644 models/crops_orthogonal_plant.obj diff --git a/corn.lua b/corn.lua index cd0e272..7ef9f4c 100644 --- a/corn.lua +++ b/corn.lua @@ -18,10 +18,9 @@ minetest.register_node("crops:corn", { inventory_image = "crops_corn.png", wield_image = "crops_corn.png", tiles = { "crops_corn_base_seed.png" }, - drawtype = "mesh", - visual = "mesh", + drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, - mesh = "crops_orthogonal_plant.obj", sunlight_propagates = true, use_texture_alpha = true, walkable = true, @@ -36,7 +35,7 @@ minetest.register_node("crops:corn", { if minetest.get_item_group(under.name, "soil") <= 1 then return end - crops.plant(pointed_thing.above, {name="crops:corn_base_seed"}) + crops.plant(pointed_thing.above, {name="crops:corn_base_seed", param2 = 3}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -70,9 +69,9 @@ minetest.register_craft({ minetest.register_node("crops:corn_base_seed", { visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", + drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, - mesh = "crops_orthogonal_plant.obj", tiles = { "crops_corn_base_seed.png" }, use_texture_alpha = true, walkable = false, @@ -96,15 +95,15 @@ minetest.register_abm({ if not crops.can_grow(pos) then return end - minetest.swap_node(pos, { name = "crops:corn_base_1" }) + minetest.swap_node(pos, { name = "crops:corn_base_1", param2 = 3 }) end }) minetest.register_node("crops:corn_base_1", { visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_base_1.png" }, waving = 1, use_texture_alpha = true, @@ -128,19 +127,18 @@ minetest.register_abm({ if not minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then return end - minetest.swap_node(pos, { name = "crops:corn_base_2" }) + minetest.swap_node(pos, { name = "crops:corn_base_2", param2 = 3 }) local above = {x = pos.x, y = pos.y + 1, z = pos.z} - minetest.set_node(above , { name = "crops:corn_top_1" }) + minetest.set_node(above , { name = "crops:corn_top_1", param2 = 3 }) local meta = minetest.get_meta(above) meta:set_int("crops_top_half", 1) end }) minetest.register_node("crops:corn_base_2", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_base_2.png" }, use_texture_alpha = true, walkable = false, @@ -169,17 +167,16 @@ minetest.register_node("crops:corn_base_2", { for i = 1,math.random(2 - (damage / 100), 4 - (3 * (damage / 100))) do table.insert(drops, ('crops:corn_cob')) end - minetest.set_node(pos, { name = "crops:corn_base_3" }) - minetest.set_node(above, { name = "crops:corn_top_4" }) + minetest.set_node(pos, { name = "crops:corn_base_3", param2 = 3 }) + minetest.set_node(above, { name = "crops:corn_top_4", param2 = 3 }) core.handle_node_drops(above, drops, digger) end }) minetest.register_node("crops:corn_base_3", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_base_3.png" }, use_texture_alpha = true, walkable = false, @@ -198,10 +195,9 @@ minetest.register_node("crops:corn_base_3", { }) minetest.register_node("crops:corn_top_1", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_base_1.png" }, waving = 1, use_texture_alpha = true, @@ -230,15 +226,14 @@ minetest.register_abm({ if minetest.get_node_light(pos, nil) < crops.settings.light then return end - minetest.swap_node(pos, { name = "crops:corn_top_2" }) + minetest.swap_node(pos, { name = "crops:corn_top_2", param2 = 3 }) end }) minetest.register_node("crops:corn_top_2", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_top_1.png" }, waving = 1, use_texture_alpha = true, @@ -270,15 +265,14 @@ minetest.register_abm({ if minetest.get_node_light(pos, nil) < crops.settings.light then return end - minetest.swap_node(pos, { name = "crops:corn_top_3" }) + minetest.swap_node(pos, { name = "crops:corn_top_3", param2 = 3 }) end }) minetest.register_node("crops:corn_top_3", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_top_2.png" }, waving = 1, use_texture_alpha = true, @@ -306,10 +300,9 @@ minetest.register_node("crops:corn_top_3", { }) minetest.register_node("crops:corn_top_4", { - visual = "mesh", description = S("Corn plant"), - drawtype = "mesh", - mesh = "crops_orthogonal_plant.obj", + drawtype = "plantlike", + paramtype2 = "meshoptions", tiles = { "crops_corn_top_3.png" }, waving = 1, use_texture_alpha = true, @@ -330,9 +323,9 @@ minetest.register_node("crops:corn_top_4", { }) crops.corn_die = function(pos) - minetest.set_node(pos, { name = "crops:corn_base_3" }) + minetest.set_node(pos, { name = "crops:corn_base_3", param2 = 3 }) local above = {x = pos.x, y = pos.y + 1, z = pos.z} - minetest.set_node(above, { name = "crops:corn_top_4" }) + minetest.set_node(above, { name = "crops:corn_top_4", param2 = 3 }) end local properties = { diff --git a/models/crops_orthogonal_plant.obj b/models/crops_orthogonal_plant.obj deleted file mode 100644 index 580da91..0000000 --- a/models/crops_orthogonal_plant.obj +++ /dev/null @@ -1,31 +0,0 @@ -# Blender v2.60 (sub 0) OBJ File: '' -# www.blender.org -mtllib crops_orthogonal_plant.mtl -o Mesh_Mesh_Mesh_Plant_P.001 -v 0.500000 0.500000 0.300000 -v -0.500000 0.500000 0.300000 -v -0.500000 -0.500000 0.300000 -v 0.500000 -0.500000 0.300000 -v 0.500000 0.500000 -0.300000 -v -0.500000 0.500000 -0.300000 -v -0.500000 -0.500000 -0.300000 -v 0.500000 -0.500000 -0.300000 -v 0.300000 0.500000 0.500000 -v 0.300000 0.500000 -0.500000 -v 0.300000 -0.500000 -0.500000 -v 0.300000 -0.500000 0.500000 -v -0.300000 0.500000 0.500000 -v -0.300000 0.500000 -0.500000 -v -0.300000 -0.500000 -0.500000 -v -0.300000 -0.500000 0.500000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -g Mesh_Mesh_Mesh_Plant_P.001_Material -usemtl Material -s off -f 1/1 2/2 3/3 4/4 -f 5/2 8/3 7/4 6/1 -f 9/1 12/4 11/3 10/2 -f 13/2 14/1 15/4 16/3 diff --git a/potato.lua b/potato.lua index 1c7b9e7..fbc529f 100644 --- a/potato.lua +++ b/potato.lua @@ -19,6 +19,7 @@ minetest.register_node("crops:potato_eyes", { wield_image = "crops_potato_eyes.png", tiles = { "crops_potato_plant_1.png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = false, use_texture_alpha = true, @@ -36,7 +37,7 @@ minetest.register_node("crops:potato_eyes", { if minetest.get_item_group(under.name, "soil") <= 1 then return end - crops.plant(pointed_thing.above, {name="crops:potato_plant_1"}) + crops.plant(pointed_thing.above, {name="crops:potato_plant_1", param2 = 3}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -49,6 +50,7 @@ minetest.register_node("crops:potato_plant_" .. stage , { description = S("Potato plant"), tiles = { "crops_potato_plant_" .. stage .. ".png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = true, use_texture_alpha = true, @@ -139,7 +141,7 @@ minetest.register_abm({ local n = string.gsub(node.name, "3", "4") n = string.gsub(n, "2", "3") n = string.gsub(n, "1", "2") - minetest.swap_node(pos, { name = n }) + minetest.swap_node(pos, { name = n, param2 = 3 }) end }) @@ -168,7 +170,7 @@ minetest.register_abm({ }) crops.potato_die = function(pos) - minetest.set_node(pos, { name = "crops:potato_plant_5" }) + minetest.set_node(pos, { name = "crops:potato_plant_5", param2 = 3 }) local below = { x = pos.x, y = pos.y - 1, z = pos.z } local node = minetest.get_node(below) if node.name == "crops:soil_with_potatoes" then diff --git a/tomato.lua b/tomato.lua index a659961..48b75b9 100644 --- a/tomato.lua +++ b/tomato.lua @@ -19,6 +19,7 @@ minetest.register_node("crops:tomato_seed", { wield_image = "crops_tomato_seed.png", tiles = { "crops_tomato_plant_1.png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = true, use_texture_alpha = true, @@ -34,7 +35,7 @@ minetest.register_node("crops:tomato_seed", { if minetest.get_item_group(under.name, "soil") <= 1 then return end - crops.plant(pointed_thing.above, {name="crops:tomato_plant_1"}) + crops.plant(pointed_thing.above, {name="crops:tomato_plant_1", param2 = 1}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -47,6 +48,7 @@ minetest.register_node("crops:tomato_plant_" .. stage , { description = S("Tomato plant"), tiles = { "crops_tomato_plant_" .. stage .. ".png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = true, use_texture_alpha = true, @@ -66,6 +68,7 @@ minetest.register_node("crops:tomato_plant_5" , { description = S("Tomato plant"), tiles = { "crops_tomato_plant_5.png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = true, use_texture_alpha = true, @@ -88,7 +91,7 @@ minetest.register_node("crops:tomato_plant_5" , { local meta = minetest.get_meta(pos) local ttl = meta:get_int("crops_tomato_ttl") if ttl > 1 then - minetest.swap_node(pos, { name = "crops:tomato_plant_4"}) + minetest.swap_node(pos, { name = "crops:tomato_plant_4", param2 = 1}) meta:set_int("crops_tomato_ttl", ttl - 1) else crops.die(pos) @@ -100,6 +103,7 @@ minetest.register_node("crops:tomato_plant_6", { description = S("Tomato plant"), tiles = { "crops_tomato_plant_6.png" }, drawtype = "plantlike", + paramtype2 = "meshoptions", waving = 1, sunlight_propagates = true, use_texture_alpha = true, @@ -142,7 +146,7 @@ minetest.register_abm({ n = string.gsub(n, "3", "4") n = string.gsub(n, "2", "3") n = string.gsub(n, "1", "2") - minetest.swap_node(pos, { name = n }) + minetest.swap_node(pos, { name = n, param2 = 1 }) end }) @@ -168,7 +172,7 @@ minetest.register_abm({ ttl = math.random(4 - (4 * (damage / 100)), 6 - (5 * (damage / 100))) end if ttl > 1 then - minetest.swap_node(pos, { name = "crops:tomato_plant_5" }) + minetest.swap_node(pos, { name = "crops:tomato_plant_5", param2 = 1 }) meta:set_int("crops_tomato_ttl", ttl) else crops.die(pos) @@ -177,7 +181,7 @@ minetest.register_abm({ }) crops.tomato_die = function(pos) - minetest.set_node(pos, { name = "crops:tomato_plant_6" }) + minetest.set_node(pos, { name = "crops:tomato_plant_6", param2 = 1 }) end local properties = { -- cgit v1.2.3