diff --git a/files/farming/farming_addons/README.txt b/files/farming/farming_addons/README.txt index 36e5e6c..168925c 100644 --- a/files/farming/farming_addons/README.txt +++ b/files/farming/farming_addons/README.txt @@ -15,7 +15,20 @@ Credits: "farming_addons" by SaKeL (LGPLv3.0+) https://bitbucket.org/minetest_gamers/farming_addons -### Textures +Authors of media (textures) +--------------------------- +Copyright (C) MultiCraft Development Team + +farming_addons_corn_*.png +farming_addons_cocoa_*.png +farming_addons_chocolate.png +farming_addons_potato_seed.png +farming_addons_carrot_seed.png + +Graphics in this mod is NOT free and can be used only as part of the official MultiCraft build. +Allowed to be used in non-official builds ONLY for personal use. + +-------- **Industrial Craft 2**, https://forum.industrial-craft.net/ @@ -28,9 +41,10 @@ https://bitbucket.org/minetest_gamers/farming_addons - farming_addons_pumpkin_7.png - farming_addons_pumpkin_8.png +------- + **CC BY-SA 4.0, Pixel Perfection by XSSheep**, https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated -- farming_addons_pumpkin_pie.png - farming_addons_melon_1.png - modified by SaKeL - farming_addons_melon_2.png - modified by SaKeL - farming_addons_melon_3.png - modified by SaKeL @@ -44,11 +58,3 @@ https://bitbucket.org/minetest_gamers/farming_addons - farming_addons_wart_brick.png - farming_addons_wartrack.png - farming_addons_wart_red_brick_block.png -- farming_addons_cookie.png -- farming_addons_cocoa_1.png -- farming_addons_cocoa_2.png -- farming_addons_cocoa_3.png - -**Created by Itsoo1** - -- farming_addons_chocolate.png diff --git a/files/farming/farming_addons/cocoa.lua b/files/farming/farming_addons/cocoa.lua index 4c62095..14364bb 100644 --- a/files/farming/farming_addons/cocoa.lua +++ b/files/farming/farming_addons/cocoa.lua @@ -13,8 +13,8 @@ function farming_addons.grow_cocoa_plant(pos) local name = node.name local def = minetest.registered_nodes[name] + -- disable timer for fully grown plant if not def.next_plant then - -- disable timer for fully grown plant return end @@ -48,10 +48,7 @@ end function farming_addons.place_cocoa_bean(itemstack, placer, pointed_thing) local pt = pointed_thing -- check if pointing at a node - if not pt then - return itemstack - end - if pt.type ~= "node" then + if not pt or pt.type ~= "node" then return itemstack end @@ -66,15 +63,13 @@ function farming_addons.place_cocoa_bean(itemstack, placer, pointed_thing) pointed_thing) or itemstack end - local player_name = placer and placer:get_player_name() or "" + local player_name = placer and placer:get_player_name() - if minetest.is_protected(pt.under, player_name) then + if player_name and + (minetest.is_protected(pt.under, player_name) or + minetest.is_protected(pt.above, player_name)) then minetest.record_protection_violation(pt.under, player_name) - return - end - if minetest.is_protected(pt.above, player_name) then - minetest.record_protection_violation(pt.above, player_name) - return + return itemstack end -- return if any of the nodes is not registered @@ -90,7 +85,6 @@ function farming_addons.place_cocoa_bean(itemstack, placer, pointed_thing) pt.above.y == pt.under.y + 1 then return itemstack end - -- check if you can replace the node above the pointed node if not minetest.registered_nodes[above.name].buildable_to then return itemstack @@ -108,7 +102,7 @@ function farming_addons.place_cocoa_bean(itemstack, placer, pointed_thing) minetest.set_node(pt.above, {name = "farming_addons:cocoa_1", param2 = new_param2}) tick(pt.above) - if not (creative and creative.is_enabled_for + if player_name and not (creative and creative.is_enabled_for and creative.is_enabled_for(player_name)) then itemstack:take_item() end @@ -168,11 +162,11 @@ minetest.register_node("farming_addons:cocoa_1", { {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5} } }, - groups = {choppy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1}, + groups = {choppy = 3, flammable = 2, plant = 1, cocoa = 1, not_in_creative_inventory = 1}, sounds = default.node_sound_wood_defaults(), next_plant = "farming_addons:cocoa_2", on_timer = farming_addons.grow_cocoa_plant, - minlight = 12 + minlight = 10 }) -- 2 @@ -218,11 +212,11 @@ minetest.register_node("farming_addons:cocoa_2", { {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5} } }, - groups = {choppy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1}, + groups = {choppy = 3, flammable = 2, plant = 1, cocoa = 1, not_in_creative_inventory = 1}, sounds = default.node_sound_wood_defaults(), next_plant = "farming_addons:cocoa_3", on_timer = farming_addons.grow_cocoa_plant, - minlight = 12 + minlight = 10 }) -- 3 @@ -245,6 +239,7 @@ minetest.register_node("farming_addons:cocoa_3", { drop = { items = { {items = {"farming_addons:cocoa_bean"}, rarity = 1}, + {items = {"farming_addons:cocoa_bean"}, rarity = 2}, {items = {"farming_addons:cocoa_bean"}, rarity = 2} } }, @@ -252,9 +247,9 @@ minetest.register_node("farming_addons:cocoa_3", { type = "fixed", fixed = { {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, - {-0.0624999, 0.25, 0.25, 0.0625, 0.375, 0.4375}, + {-0.0625, 0.25, 0.25, 0.0625, 0.375, 0.4375}, {-0.0625, 0.375, 0.375, 0.0625, 0.5, 0.5}, - {-0.0624999, 0.375, 0.3125, 0.0625, 0.4375, 0.375} + {-0.0625, 0.375, 0.3125, 0.0625, 0.4375, 0.375} } }, collision_box = { @@ -269,10 +264,10 @@ minetest.register_node("farming_addons:cocoa_3", { {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5} } }, - groups = {choppy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1}, + groups = {choppy = 3, flammable = 2, plant = 1, cocoa = 1, not_in_creative_inventory = 1}, sounds = default.node_sound_wood_defaults(), on_timer = farming_addons.grow_cocoa_plant, - minlight = 12 + minlight = 10 }) -- replacement LBM for pre-nodetimer plants @@ -285,9 +280,45 @@ minetest.register_lbm({ action = tick_again }) +-- grow cocoa in jungletrees +local find_node_near = minetest.find_node_near +local get_node = minetest.get_node +local get_time = minetest.get_timeofday +minetest.register_abm({ + name = "farming_addons:grow_cocoa", + nodenames = "default:jungletree", + neighbors = {"default:jungletree"}, + interval = 5, + chance = 50, + catch_up = false, + action = function(pos) + if get_time() >= 0.25 and get_time() < 0.8 then + if find_node_near(pos, 3, "group:cocoa") + then return end + + local apos = {x = pos.x, y = pos.y, z = pos.z} + if get_node({x = pos.x + 1, y = pos.y, z = pos.z}).name == "air" then + apos.x = apos.x + 1 + elseif get_node({x = pos.x - 1, y = pos.y, z = pos.z}).name == "air" then + apos.x = apos.x - 1 + elseif get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name == "air" then + apos.z = apos.z + 1 + elseif get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name == "air" then + apos.z = apos.z - 1 + else return end + + if get_node({x = apos.x, y = apos.y - 2, z = apos.z}).name ~= "air" + then return end + + farming_addons.place_cocoa_bean( + ItemStack("farming_addons:cocoa_1"), nil, {type = "node", under = pos, above = apos}) + end + end +}) + -- Cocoa minetest.register_craft( { - output = "dye:brown", + output = "dye:brown 2", recipe = { {"farming_addons:cocoa_bean"} } @@ -311,7 +342,7 @@ minetest.register_craftitem("farming_addons:chocolate", { description = "Chocolate", inventory_image = "farming_addons_chocolate.png", on_use = minetest.item_eat(3), - groups = {food = 1}, + groups = {food = 1} }) minetest.register_craft( { diff --git a/files/farming/farming_addons/seeds.lua b/files/farming/farming_addons/seeds.lua index a053d53..b6a86ce 100644 --- a/files/farming/farming_addons/seeds.lua +++ b/files/farming/farming_addons/seeds.lua @@ -41,13 +41,3 @@ minetest.override_item("default:dry_shrub", {drop = { {items = {"default:dry_shrub"}} } }}) - --- Cocoa Bean -minetest.override_item("default:jungleleaves", {drop = { - max_items = 1, - items = { - {items = {"farming_addons:cocoa_bean"}, rarity = 10}, - {items = {"default:junglesapling"}, rarity = 20}, - {items = {"default:jungleleaves"}} - } -}}) diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_bean.png b/files/farming/farming_addons/textures/farming_addons_cocoa_bean.png index 88b12dc..9a54f4c 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_bean.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_bean.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_1.png b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_1.png index a60d98a..8b9588f 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_1.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_1.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_2.png b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_2.png index 3b4e5ad..08649e8 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_2.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_2.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_3.png b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_3.png index 7653318..467daee 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_3.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_bottom_3.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_front_1.png b/files/farming/farming_addons/textures/farming_addons_cocoa_front_1.png index 7a8a929..7aa0e9e 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_front_1.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_front_1.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_front_2.png b/files/farming/farming_addons/textures/farming_addons_cocoa_front_2.png index a3b4d17..df5d268 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_front_2.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_front_2.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_front_3.png b/files/farming/farming_addons/textures/farming_addons_cocoa_front_3.png index 798cf25..ad3ea7a 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_front_3.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_front_3.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_side_1.png b/files/farming/farming_addons/textures/farming_addons_cocoa_side_1.png index 7f5a2b7..15fbdaa 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_side_1.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_side_1.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_side_2.png b/files/farming/farming_addons/textures/farming_addons_cocoa_side_2.png index dd80cd6..6495705 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_side_2.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_side_2.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_side_3.png b/files/farming/farming_addons/textures/farming_addons_cocoa_side_3.png index e6ecc19..65a3682 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_side_3.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_side_3.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_top_1.png b/files/farming/farming_addons/textures/farming_addons_cocoa_top_1.png index 5e4bafb..0afd025 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_top_1.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_top_1.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_top_2.png b/files/farming/farming_addons/textures/farming_addons_cocoa_top_2.png index 646f651..94321c4 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_top_2.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_top_2.png differ diff --git a/files/farming/farming_addons/textures/farming_addons_cocoa_top_3.png b/files/farming/farming_addons/textures/farming_addons_cocoa_top_3.png index 10820ec..076c12b 100644 Binary files a/files/farming/farming_addons/textures/farming_addons_cocoa_top_3.png and b/files/farming/farming_addons/textures/farming_addons_cocoa_top_3.png differ