From c826af9b4487d0bd2c9f318071d5d7c5087f0440 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 14 Mar 2017 21:25:20 +0100 Subject: [PATCH] Switch wheat plants from nodebox to meshoptions --- mods/ITEMS/mcl_dye/init.lua | 6 +-- mods/ITEMS/mcl_farming/shared_functions.lua | 4 +- mods/ITEMS/mcl_farming/wheat.lua | 56 +++++---------------- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index cf7eec679c..1727c227d5 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -135,11 +135,11 @@ mcl_dye.apply_bone_meal = function(pointed_thing) elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then stage = string.sub(n.name, -1) if stage == "3" then - minetest.add_node(pos, {name="mcl_farming:wheat"}) + minetest.add_node(pos, {name="mcl_farming:wheat", param = n.param, param2 = n.param2}) elseif math.random(1,5) < 3 then - minetest.add_node(pos, {name="mcl_farming:wheat"}) + minetest.add_node(pos, {name="mcl_farming:wheat", param = n.param, param2 = n.param2}) else - minetest.add_node(pos, {name="mcl_farming:wheat_"..math.random(2,3)}) + minetest.add_node(pos, {name="mcl_farming:wheat_"..math.random(2,3), param = n.param, param2 = n.param2}) end return true elseif string.find(n.name, "mcl_farming:potato_") ~= nil then diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 3f4f01a29f..6f925cdac6 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -29,6 +29,8 @@ function mcl_farming:add_plant(full_grown, names, interval, chance) if new_node.name == nil then new_node.name = full_grown end + new_node.param = node.param + new_node.param2 = node.param2 minetest.set_node(pos, new_node) end }) @@ -58,7 +60,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then - minetest.add_node(pos, {name=plantname}) + minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2}) else return end diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index a5af9e4a73..94ba3a877d 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -15,10 +15,11 @@ minetest.register_node("mcl_farming:wheat_1", { _doc_items_entry_name = "Premature Wheat Plant", _doc_items_longdesc = "Premature wheat plants grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.", paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, sunlight_propagates = true, walkable = false, - drawtype = "nodebox", - paramtype = "light", + drawtype = "plantlike", drop = "mcl_farming:wheat_seeds", tiles = {"farming_wheat_1.png"}, inventory_image = "farming_wheat_1.png", @@ -31,15 +32,6 @@ minetest.register_node("mcl_farming:wheat_1", { }, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1 - {0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2 - {-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3 - {-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4 - } - }, _mcl_blast_resistance = 0, }) @@ -48,9 +40,10 @@ minetest.register_node("mcl_farming:wheat_2", { _doc_items_create_entry = false, sunlight_propagates = true, paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, walkable = false, - drawtype = "nodebox", - paramtype = "light", + drawtype = "plantlike", drop = "mcl_farming:wheat_seeds", tiles = {"farming_wheat_2.png"}, inventory_image = "farming_wheat_2.png", @@ -63,15 +56,6 @@ minetest.register_node("mcl_farming:wheat_2", { }, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1 - {0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2 - {-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3 - {-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4 - } - }, _mcl_blast_resistance = 0, }) @@ -80,9 +64,10 @@ minetest.register_node("mcl_farming:wheat_3", { _doc_items_create_entry = false, sunlight_propagates = true, paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, walkable = false, - drawtype = "nodebox", - paramtype = "light", + drawtype = "plantlike", drop = "mcl_farming:wheat_seeds", tiles = {"farming_wheat_3.png"}, inventory_image = "farming_wheat_3.png", @@ -95,15 +80,6 @@ minetest.register_node("mcl_farming:wheat_3", { }, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1 - {0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2 - {-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3 - {-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4 - } - }, _mcl_blast_resistance = 0, }) @@ -112,9 +88,10 @@ minetest.register_node("mcl_farming:wheat", { _doc_items_longdesc = "Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further.", sunlight_propagates = true, paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, walkable = false, - drawtype = "nodebox", - paramtype = "light", + drawtype = "plantlike", tiles = {"farming_wheat.png"}, inventory_image = "farming_wheat.png", wield_image = "farming_wheat.png", @@ -135,15 +112,6 @@ minetest.register_node("mcl_farming:wheat", { }, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1 - {0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2 - {-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3 - {-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4 - } - }, _mcl_blast_resistance = 0, })