From 5ca1bd332bee644f8098a581b8c63c08d30c9afc Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 7 May 2018 10:24:13 +0100 Subject: [PATCH] added blue agave to mapgen and abm to make it spread, also bonemeal support --- README.md | 5 +++-- depends.txt | 1 + init.lua | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9bb889c..ecf6e1b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ by TenPlus1 Depends: Farming Redo -This mod adds a barrel used to ferment grapes into glasses of wine, 9 of which can then be crafted into a bottle of wine. It can also ferment honey into mead, barley into beer and apples into cider. +This mod adds a barrel used to ferment grapes into glasses of wine, 9 of which can then be crafted into a bottle of wine. It can also ferment honey into mead, barley into beer, wheat into weizen (wheat beer), and apples into cider. Change log: @@ -14,8 +14,9 @@ Change log: - 0.4 - Added ability to ferment barley from farming redo into beer and also honey from mobs redo into honey mead - 0.5 - Added apple cider - 0.6 - Added API so drinks can easily be added, also added wheat beer thanks to h-v-smacker and support for pipeworks/tubelib +- 0.7 - Blue Agave now appears in desert areas and spreads very slowly, can me fermented into tequila -Lucky Blocks: 8 +Lucky Blocks: 9 Wine Mod API diff --git a/depends.txt b/depends.txt index b39fd0d..a9ae3a1 100644 --- a/depends.txt +++ b/depends.txt @@ -2,3 +2,4 @@ default intllib? lucky_block? pipeworks? +bonemeal? diff --git a/init.lua b/init.lua index cd2de0b..c124088 100644 --- a/init.lua +++ b/init.lua @@ -136,6 +136,7 @@ minetest.register_node("wine:glass_beer", { on_use = minetest.item_eat(2), }) + -- glass of honey mead minetest.register_node("wine:glass_mead", { description = S("Honey-Mead"), @@ -247,7 +248,7 @@ minetest.register_node("wine:blue_agave", { type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.3, 0.2} }, - groups = {dig_immediate = 3, attached_node = 1}, + groups = {snappy = 3, attached_node = 1, plant = 1}, sounds = default.node_sound_leaves_defaults(), }) @@ -257,6 +258,56 @@ minetest.register_craft( { recipe = {"wine:blue_agave"} }) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + fill_ratio = 0.001, + biomes = {"desert"}, + decoration = {"wine:blue_agave"}, +}) + +minetest.register_abm({ + label = "Blue Agave growth", + nodenames = {"wine:blue_agave"}, + interval = 17, + chance = 33, + action = function(pos, node) + + local n = minetest.find_nodes_in_area( + {x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + {x = pos.x + 2, y = pos.y + 1, z = pos.z + 2}, + {"wine:blue_agave"}) + + if #n > 3 then + -- needs to have 2 neighbors or less to propagate (3 = +itself) + return + end + + -- find desert sand with air above + n = minetest.find_nodes_in_area_under_air( + {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, + {"default:desert_sand"}) + + -- place blue agave + if n and #n > 0 then + + local new_pos = n[math.random(#n)] + + new_pos.y = new_pos.y + 1 + + minetest.set_node(new_pos, {name = "wine:blue_agave"}) + end + end +}) + +if minetest.get_modpath("bonemeal") then + bonemeal:add_deco({ + {"default:desert_sand", {}, {"default:dry_shrub", "wine:blue_agave", "", ""} } + }) +end + -- Wine barrel winebarrel_formspec = "size[8,9]" .. default.gui_bg..default.gui_bg_img..default.gui_slots @@ -281,6 +332,7 @@ minetest.register_node("wine:wine_barrel", { tubedevice = 1, tubedevice_receiver = 1 }, legacy_facedir_simple = true, + on_place = minetest.rotate_node, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -441,6 +493,7 @@ if minetest.get_modpath("lucky_block") then lucky_block:add_blocks({ {"dro", {"wine:glass_wine"}, 5}, {"dro", {"wine:glass_beer"}, 5}, + {"dro", {"wine:glass_wheat_beer"}, 5}, {"dro", {"wine:glass_mead"}, 5}, {"dro", {"wine:glass_cider"}, 5}, {"dro", {"wine:glass_tequila"}, 5},