Switch wheat plants from nodebox to meshoptions

This commit is contained in:
Wuzzy 2017-03-14 21:25:20 +01:00
parent cb6e6f1906
commit c826af9b44
3 changed files with 18 additions and 48 deletions

View File

@ -135,11 +135,11 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then
stage = string.sub(n.name, -1) stage = string.sub(n.name, -1)
if stage == "3" then 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 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 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 end
return true return true
elseif string.find(n.name, "mcl_farming:potato_") ~= nil then elseif string.find(n.name, "mcl_farming:potato_") ~= nil then

View File

@ -29,6 +29,8 @@ function mcl_farming:add_plant(full_grown, names, interval, chance)
if new_node.name == nil then if new_node.name == nil then
new_node.name = full_grown new_node.name = full_grown
end end
new_node.param = node.param
new_node.param2 = node.param2
minetest.set_node(pos, new_node) minetest.set_node(pos, new_node)
end 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 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 else
return return
end end

View File

@ -15,10 +15,11 @@ minetest.register_node("mcl_farming:wheat_1", {
_doc_items_entry_name = "Premature Wheat Plant", _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.", _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", paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
paramtype = "light",
drop = "mcl_farming:wheat_seeds", drop = "mcl_farming:wheat_seeds",
tiles = {"farming_wheat_1.png"}, tiles = {"farming_wheat_1.png"},
inventory_image = "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}, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), 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, _mcl_blast_resistance = 0,
}) })
@ -48,9 +40,10 @@ minetest.register_node("mcl_farming:wheat_2", {
_doc_items_create_entry = false, _doc_items_create_entry = false,
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
paramtype = "light",
drop = "mcl_farming:wheat_seeds", drop = "mcl_farming:wheat_seeds",
tiles = {"farming_wheat_2.png"}, tiles = {"farming_wheat_2.png"},
inventory_image = "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}, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), 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, _mcl_blast_resistance = 0,
}) })
@ -80,9 +64,10 @@ minetest.register_node("mcl_farming:wheat_3", {
_doc_items_create_entry = false, _doc_items_create_entry = false,
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
paramtype = "light",
drop = "mcl_farming:wheat_seeds", drop = "mcl_farming:wheat_seeds",
tiles = {"farming_wheat_3.png"}, tiles = {"farming_wheat_3.png"},
inventory_image = "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}, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), 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, _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.", _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, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
paramtype = "light",
tiles = {"farming_wheat.png"}, tiles = {"farming_wheat.png"},
inventory_image = "farming_wheat.png", inventory_image = "farming_wheat.png",
wield_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}, groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), 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, _mcl_blast_resistance = 0,
}) })