1
0
Fork 0

Stems: 8 stages, fix bone meal and selection box

This commit is contained in:
Wuzzy 2017-03-14 02:37:42 +01:00
parent b42fdbf385
commit 6794911023
3 changed files with 69 additions and 89 deletions

View File

@ -168,18 +168,24 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
return true
elseif string.find(n.name, "mcl_farming:pumpkin_") ~= nil then
stage = tonumber(string.sub(n.name, -1))
if stage == 1 then
minetest.add_node(pos, {name="mcl_farming:pumpkin_"..math.random(stage,2)})
else
if stage then
stage = stage + math.random(2,5)
if stage >= 8 then
minetest.add_node(pos, {name="mcl_farming:pumpkintige_unconnect"})
else
minetest.add_node(pos, {name="mcl_farming:pumpkin_"..stage})
end
end
return true
elseif string.find(n.name, "mcl_farming:melontige_") ~= nil then
stage = tonumber(string.sub(n.name, -1))
if stage == 1 then
minetest.add_node(pos, {name="mcl_farming:melontige_"..math.random(stage,2)})
else
if stage then
stage = stage + math.random(2,5)
if stage >= 8 then
minetest.add_node(pos, {name="mcl_farming:melontige_unconnect"})
else
minetest.add_node(pos, {name="mcl_farming:melontige_"..stage})
end
end
return true
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then

View File

@ -57,45 +57,26 @@ local stemdrop = {
}
-- Growing unconnected stems
minetest.register_node("mcl_farming:melontige_1", {
description = "Melon Stem (1)",
_doc_items_entry_name = "Melon Stem",
for s=1,7 do
local h = s / 8
minetest.register_node("mcl_farming:melontige_"..s, {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = stemdrop,
tiles = {"farming_tige_1.png"},
tiles = {"[combine:32x32:0,"..(32-4*s).."=farming_tige_end.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5}
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
groups = {dig_immediate=3, not_in_creative_inventory=1, attached_node=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
minetest.register_node("mcl_farming:melontige_2", {
description = "Melon Stem (2)",
_doc_items_create_entry = false,
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = stemdrop,
tiles = {"farming_tige_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
})
end
-- Full melon stem, able to spawn melons
minetest.register_node("mcl_farming:melontige_unconnect", {
@ -107,13 +88,19 @@ minetest.register_node("mcl_farming:melontige_unconnect", {
drop = stemdrop,
drawtype = "plantlike",
tiles = {"farming_tige_end.png"},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
selection_box = {
type = "fixed",
fixed = {
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, attached_node=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
-- Register stem growth
mcl_farming:add_plant("mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2"}, 50, 20)
mcl_farming:add_plant("mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 50, 20)
-- Register actual melon, connected stems and stem-to-melon growth
mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", stemdrop, "mcl_farming:melon", melon_base_def, 25, 15)

View File

@ -32,47 +32,28 @@ local stemdrop = {
},
}
-- Growing unconnected stem
-- Unconnected immature stem
minetest.register_node("mcl_farming:pumpkin_1", {
description = "Pumpkin Stem (First Stage)",
_doc_items_entry_name = "Pumpkin Stem",
for s=1,7 do
local h = s / 8
minetest.register_node("mcl_farming:pumpkin_"..s, {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = stemdrop,
tiles = {"farming_tige_1.png"},
tiles = {"[combine:32x32:0,"..(32-4*s).."=farming_tige_end.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5}
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
groups = {dig_immediate=3, not_in_creative_inventory=1, attached_node=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
minetest.register_node("mcl_farming:pumpkin_2", {
description = "Pumpkin Stem (Second Stage)",
_doc_items_create_entry = false,
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = stemdrop,
tiles = {"farming_tige_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
})
end
-- Full stem (not connected)
minetest.register_node("mcl_farming:pumpkintige_unconnect", {
@ -84,7 +65,13 @@ minetest.register_node("mcl_farming:pumpkintige_unconnect", {
drop = stemdrop,
drawtype = "plantlike",
tiles = {"farming_tige_end.png"},
groups = {dig_immediate=3, not_in_creative_inventory=1 ,dig_by_water=1},
selection_box = {
type = "fixed",
fixed = {
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, attached_node=1, dig_by_water=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
@ -103,7 +90,7 @@ local pumpkin_base_def = {
}
-- Register stem growth
mcl_farming:add_plant("mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2"}, 80, 20)
mcl_farming:add_plant("mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 80, 20)
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", stemdrop, "mcl_farming:pumpkin_face", pumpkin_base_def, 30, 15)