From 679491102381f036bafb4d557d1c62dd7440bdc3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 14 Mar 2017 02:37:42 +0100 Subject: [PATCH] Stems: 8 stages, fix bone meal and selection box --- mods/ITEMS/mcl_dye/init.lua | 22 ++++++---- mods/ITEMS/mcl_farming/melon.lua | 67 ++++++++++++----------------- mods/ITEMS/mcl_farming/pumpkin.lua | 69 ++++++++++++------------------ 3 files changed, 69 insertions(+), 89 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index a10b84c5..7c12d59e 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -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 - minetest.add_node(pos, {name="mcl_farming:pumpkintige_unconnect"}) + 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 - minetest.add_node(pos, {name="mcl_farming:melontige_unconnect"}) + 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 diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 74cb4de0..62a5ddde 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -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", - paramtype = "light", - walkable = false, - drawtype = "plantlike", - sunlight_propagates = true, - drop = stemdrop, - tiles = {"farming_tige_1.png"}, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} +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 = {"[combine:32x32:0,"..(32-4*s).."=farming_tige_end.png"}, + selection_box = { + type = "fixed", + fixed = { + {-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}, - 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, -}) + 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, + }) +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) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 4c4ab80f..3cf2734c 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -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", - paramtype = "light", - walkable = false, - drawtype = "plantlike", - sunlight_propagates = true, - drop = stemdrop, - tiles = {"farming_tige_1.png"}, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} +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 = {"[combine:32x32:0,"..(32-4*s).."=farming_tige_end.png"}, + selection_box = { + type = "fixed", + fixed = { + {-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}, - 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, -}) + 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, + }) +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)