diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-03-10 17:47:15 +0000 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-03-10 17:47:15 +0000 |
commit | c07fcc7d937b7803a185942366af9488e71e5c4c (patch) | |
tree | dcde8443c94f03f56e0e74fa015d6332d592c0fd | |
parent | a0bdf03918d0fa63062aa385660a9e903a525521 (diff) |
Added ability to ferment barley into beer
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | init.lua | 87 | ||||
-rw-r--r-- | textures/wine.png | bin | 374 -> 0 bytes | |||
-rw-r--r-- | textures/wine_beer_glass.png | bin | 0 -> 227 bytes | |||
-rw-r--r-- | textures/wine_bottle.png (renamed from textures/bottle_wine.png) | bin | 1492 -> 1492 bytes | |||
-rw-r--r-- | textures/wine_glass.png | bin | 374 -> 374 bytes |
6 files changed, 62 insertions, 28 deletions
@@ -13,4 +13,5 @@ Changelog: 0.1 - Initial release 0.2 - Added protection checks to barrel 0.3 - New barrel model from cottages mod (thanks Napiophelios) - - Wine glass can be placed
\ No newline at end of file + - Wine glass can be placed +0.4 - Added ability to ferment barley from farming redo into beer
\ No newline at end of file @@ -1,17 +1,12 @@ ---[[ wine glass -minetest.register_craftitem("wine:glass_wine", { - description = "Glass of Wine", - inventory_image = "wine.png", - on_use = minetest.item_eat(2), -})]] +-- glass of wine minetest.register_node("wine:glass_wine", { description = "Glass of Wine", drawtype = "plantlike", visual_scale = 0.8, - tiles = {"wine.png"}, - inventory_image = "wine.png", - wield_image = "wine.png", + tiles = {"wine_glass.png"}, + inventory_image = "wine_glass.png", + wield_image = "wine_glass.png", paramtype = "light", is_ground_content = false, sunlight_propagates = true, @@ -29,8 +24,8 @@ minetest.register_node("wine:glass_wine", { minetest.register_node("wine:bottle_wine", { description = "Bottle of Wine", drawtype = "plantlike", - tiles = {"bottle_wine.png"}, - inventory_image = "bottle_wine.png", + tiles = {"wine_bottle.png"}, + inventory_image = "wine_bottle.png", paramtype = "light", sunlight_propagates = true, walkable = false, @@ -57,6 +52,27 @@ minetest.register_craft({ recipe = {"wine:bottle_wine"}, }) +-- glass of beer (thanks to RiverKpocc @ deviantart.com for image) +minetest.register_node("wine:glass_beer", { + description = "Glass of Beer", + drawtype = "torchlike", --"plantlike", + visual_scale = 0.8, + tiles = {"wine_beer_glass.png"}, + inventory_image = "wine_beer_glass.png", + wield_image = "wine_beer_glass.png", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.5, -0.2, 0.2, 0.3, 0.2} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), + on_use = minetest.item_eat(2), +}) + -- Wine barrel winebarrel_formspec = "size[8,9]" .. default.gui_bg..default.gui_bg_img..default.gui_slots @@ -69,9 +85,7 @@ winebarrel_formspec = "size[8,9]" .. "listring[current_player;main]" minetest.register_node("wine:wine_barrel", { - description = "Winebarrel", --- tiles = {"barrel_side.png", "barrel_side.png", "barrel_side.png^[transformR90", --- "barrel_side.png^[transformR90", "barrel_bottom.png", "barrel_front.png"}, + description = "Fermenting Barrel", tiles = {"wine_barrel.png" }, drawtype = "mesh", mesh = "wine_barrel.obj", @@ -83,7 +97,7 @@ minetest.register_node("wine:wine_barrel", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", winebarrel_formspec) - meta:set_string("infotext", "Wine Barrel") + meta:set_string("infotext", "Fermenting Barrel") meta:set_float("status", 0.0) local inv = meta:get_inventory() inv:set_size("src", 1) @@ -159,7 +173,7 @@ minetest.register_craft({ -- Wine barrel abm minetest.register_abm({ nodenames = {"wine:wine_barrel"}, - interval = 5.0, + interval = 5, chance = 1, catch_up = false, @@ -168,15 +182,21 @@ minetest.register_abm({ local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - -- make sure only grapes are fermented in barrel + -- is barrel empty? + if inv:is_empty("src") then + return + end + + -- does it contain grapes or barley? if not inv:contains_item("src", ItemStack("farming:grapes")) - and not inv:is_empty("src") then + and not inv:contains_item("src", ItemStack("farming:barley")) then return end -- is barrel full - if not inv:room_for_item("dst", "farming:grapes") then - meta:set_string("infotext", "Wine Barrel (FULL)") + if not inv:room_for_item("dst", "wine:glass_wine") + or not inv:room_for_item("dst", "wine:glass_beer") then + meta:set_string("infotext", "Fermenting Barrel (FULL)") return end @@ -187,18 +207,31 @@ minetest.register_abm({ -- fermenting (change status) if status < 100 then - meta:set_string("infotext", "Wine Barrel (fermented: " .. status .. "%)") + meta:set_string("infotext", "Fermenting Barrel (" .. status .. "% Done)") meta:set_float("status", status + 5) - else --fermented (take grapes and add glass of wine) - inv:remove_item("src", "farming:grapes") - inv:add_item("dst", "wine:glass_wine") - meta:set_float("status", 0.0) + else + + if inv:contains_item("src", "farming:grapes") then + + --fermented (take grapes and add glass of wine) + inv:remove_item("src", "farming:grapes") + inv:add_item("dst", "wine:glass_wine") + meta:set_float("status", 0.0) + + elseif inv:contains_item("src", "farming:barley") then + + --fermented (take barley and add glass of beer) + inv:remove_item("src", "farming:barley") + inv:add_item("dst", "wine:glass_beer") + meta:set_float("status", 0.0) + + end end else - meta:set_string("infotext", "Wine Barrel") + meta:set_string("infotext", "Fermenting Barrel") end end, }) -print ("[MOD] Wine mod loaded")
\ No newline at end of file +print ("[MOD] Wine mod loaded") diff --git a/textures/wine.png b/textures/wine.png Binary files differdeleted file mode 100644 index 3f2f435..0000000 --- a/textures/wine.png +++ /dev/null diff --git a/textures/wine_beer_glass.png b/textures/wine_beer_glass.png Binary files differnew file mode 100644 index 0000000..e53041a --- /dev/null +++ b/textures/wine_beer_glass.png diff --git a/textures/bottle_wine.png b/textures/wine_bottle.png Binary files differindex fa678e2..fa678e2 100644 --- a/textures/bottle_wine.png +++ b/textures/wine_bottle.png diff --git a/textures/wine_glass.png b/textures/wine_glass.png Binary files differindex 24485ba..3f2f435 100644 --- a/textures/wine_glass.png +++ b/textures/wine_glass.png |