1
0
Fork 0

Grow carrots in 8 stages

This commit is contained in:
Wuzzy 2017-04-01 04:56:42 +02:00
parent 85cec2ac85
commit 8d8d9e8c43
1 changed files with 50 additions and 67 deletions

View File

@ -1,51 +1,29 @@
minetest.register_node("mcl_farming:carrot_1", { for i=1, 7 do
description = "Premature Carrot Plant (First Stage)", local texture, sel_height
_doc_items_entry_name = "Premature Carrot Plant", if i < 3 then
_doc_items_longdesc = "Carrot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature.", sel_height = -5/16
paramtype = "light", texture = "farming_carrot_1.png"
sunlight_propagates = true, elseif i < 5 then
paramtype2 = "meshoptions", sel_height = -3/16
place_param2 = 3, texture = "farming_carrot_2.png"
walkable = false, else
drawtype = "plantlike", sel_height = 2/16
drop = "mcl_farming:carrot_item", texture = "farming_carrot_3.png"
tiles = {"farming_carrot_1.png"}, end
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,dig_by_water=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
minetest.register_node("mcl_farming:carrot_2", { local create, name, longdesc
description = "Premature Carrot Plant (Second Stage)", if i == 1 then
_doc_items_create_entry = false, create = true
paramtype = "light", name = "Premature Carrot Plant"
sunlight_propagates = true, longdesc = "Carrot plants are plants which grow on farmland under sunlight in 8 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."
walkable = false, else
drawtype = "plantlike", create = false
paramtype2 = "meshoptions", end
place_param2 = 3, minetest.register_node("mcl_farming:carrot_"..i, {
drop = "mcl_farming:carrot_item", description = string.format("Premature Carrot Plant (Stage %d)", i),
tiles = {"farming_carrot_2.png"}, _doc_items_create_entry = create,
selection_box = { _doc_items_entry_name = name,
type = "fixed", _doc_items_longdesc = longdesc,
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,dig_by_water=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
minetest.register_node("mcl_farming:carrot_3", {
description = "Premature Carrot Plant (Third Stage)",
_doc_items_create_entry = false,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
@ -53,17 +31,20 @@ minetest.register_node("mcl_farming:carrot_3", {
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "plantlike",
drop = "mcl_farming:carrot_item", drop = "mcl_farming:carrot_item",
tiles = {"farming_carrot_3.png"}, tiles = {texture},
inventory_image = texture,
wield_image = texture,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5} {-0.5, -0.5, -0.5, 0.5, sel_height, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,dig_by_water=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
}) })
end
minetest.register_node("mcl_farming:carrot", { minetest.register_node("mcl_farming:carrot", {
description = "Mature Carrot Plant", description = "Mature Carrot Plant",
@ -75,6 +56,8 @@ minetest.register_node("mcl_farming:carrot", {
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_carrot_4.png"}, tiles = {"farming_carrot_4.png"},
inventory_image = "farming_carrot_4.png",
wield_image = "farming_carrot_4.png",
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -84,7 +67,7 @@ minetest.register_node("mcl_farming:carrot", {
{ items = {'mcl_farming:carrot_item 1'} }, { items = {'mcl_farming:carrot_item 1'} },
} }
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,dig_by_water=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
}) })
@ -124,10 +107,10 @@ minetest.register_craft({
} }
}) })
mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3"}, 50, 20) mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 25, 20)
if minetest.get_modpath("doc") then if minetest.get_modpath("doc") then
for i=2,3 do for i=2,7 do
doc.add_entry_alias("nodes", "mcl_farming:carrot_1", "nodes", "mcl_farming:carrot_"..i) doc.add_entry_alias("nodes", "mcl_farming:carrot_1", "nodes", "mcl_farming:carrot_"..i)
end end
end end