added api, wheat beer, pipework support
This commit is contained in:
parent
dc67662a42
commit
7a1029a38a
16
README.md
16
README.md
@ -13,5 +13,19 @@ Change log:
|
|||||||
- 0.3 - New barrel model from cottages mod (thanks Napiophelios), also wine glass can be placed
|
- 0.3 - New barrel model from cottages mod (thanks Napiophelios), also wine glass can be placed
|
||||||
- 0.4 - Added ability to ferment barley from farming redo into beer and also honey from mobs redo into honey mead
|
- 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.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
|
||||||
|
|
||||||
Lucky Blocks: 7
|
Lucky Blocks: 8
|
||||||
|
|
||||||
|
|
||||||
|
Wine Mod API
|
||||||
|
------------
|
||||||
|
|
||||||
|
wine:add_item(list)
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
wine:add_item({
|
||||||
|
{"farming:barley", "wine:glass_beer"},
|
||||||
|
{"default:apple", "wine:glass_cider"},
|
||||||
|
})
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
default
|
default
|
||||||
intllib?
|
intllib?
|
||||||
lucky_block?
|
lucky_block?
|
||||||
|
pipeworks?
|
||||||
|
221
init.lua
221
init.lua
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
wine = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
@ -20,6 +22,24 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local ferment = {
|
||||||
|
{"farming:grapes", "wine:glass_wine"},
|
||||||
|
{"farming:barley", "wine:glass_beer"},
|
||||||
|
{"mobs:honey", "wine:glass_mead"},
|
||||||
|
{"default:apple", "wine:glass_cider"},
|
||||||
|
{"wine:blue_agave", "wine:glass_tequila"},
|
||||||
|
{"farming:wheat", "wine:glass_wheat_beer"},
|
||||||
|
}
|
||||||
|
|
||||||
|
function wine:add_item(list)
|
||||||
|
|
||||||
|
for n = 1, #list do
|
||||||
|
table.insert(ferment, list[n])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- glass of wine
|
-- glass of wine
|
||||||
minetest.register_node("wine:glass_wine", {
|
minetest.register_node("wine:glass_wine", {
|
||||||
description = S("Glass of Wine"),
|
description = S("Glass of Wine"),
|
||||||
@ -73,6 +93,28 @@ minetest.register_craft({
|
|||||||
recipe = {"wine:bottle_wine"},
|
recipe = {"wine:bottle_wine"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- glass of weizen, or wheat beer
|
||||||
|
-- The image is a lighter version of the one from RiverKpocc @ deviantart.com
|
||||||
|
minetest.register_node("wine:glass_wheat_beer", {
|
||||||
|
description = S("Wheat Beer"),
|
||||||
|
drawtype = "torchlike", --"plantlike",
|
||||||
|
visual_scale = 0.8,
|
||||||
|
tiles = {"wine_wheat_beer_glass.png"},
|
||||||
|
inventory_image = "wine_wheat_beer_glass.png",
|
||||||
|
wield_image = "wine_wheat_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),
|
||||||
|
})
|
||||||
|
|
||||||
-- glass of beer (thanks to RiverKpocc @ deviantart.com for image)
|
-- glass of beer (thanks to RiverKpocc @ deviantart.com for image)
|
||||||
minetest.register_node("wine:glass_beer", {
|
minetest.register_node("wine:glass_beer", {
|
||||||
description = S("Beer"),
|
description = S("Beer"),
|
||||||
@ -136,16 +178,96 @@ minetest.register_node("wine:glass_cider", {
|
|||||||
on_use = minetest.item_eat(2),
|
on_use = minetest.item_eat(2),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- glass of tequila
|
||||||
|
minetest.register_node("wine:glass_tequila", {
|
||||||
|
description = "Tequila",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 0.8,
|
||||||
|
tiles = {"wine_tequila.png"},
|
||||||
|
inventory_image = "wine_tequila.png",
|
||||||
|
wield_image = "wine_tequila.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),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- bottle of tequila
|
||||||
|
minetest.register_node("wine:bottle_tequila", {
|
||||||
|
description = "Bottle of Tequila",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"wine_tequila_bottle.png"},
|
||||||
|
inventory_image = "wine_tequila_bottle.png",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.25, 0.15 }
|
||||||
|
},
|
||||||
|
groups = {dig_immediate = 3, attached_node = 1},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "wine:bottle_tequila",
|
||||||
|
recipe = {
|
||||||
|
{"wine:glass_tequila", "wine:glass_tequila", "wine:glass_tequila"},
|
||||||
|
{"wine:glass_tequila", "wine:glass_tequila", "wine:glass_tequila"},
|
||||||
|
{"wine:glass_tequila", "wine:glass_tequila", "wine:glass_tequila"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "wine:glass_tequila 9",
|
||||||
|
recipe = {"wine:bottle_tequila"},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- blue agave
|
||||||
|
minetest.register_node("wine:blue_agave", {
|
||||||
|
description = "Blue Agave",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 0.8,
|
||||||
|
tiles = {"wine_blue_agave.png"},
|
||||||
|
inventory_image = "wine_blue_agave.png",
|
||||||
|
wield_image = "wine_blue_agave.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 = {dig_immediate = 3, attached_node = 1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:cyan 4",
|
||||||
|
recipe = {"wine:blue_agave"}
|
||||||
|
})
|
||||||
|
|
||||||
-- Wine barrel
|
-- Wine barrel
|
||||||
winebarrel_formspec = "size[8,9]"
|
winebarrel_formspec = "size[8,9]"
|
||||||
.. default.gui_bg..default.gui_bg_img..default.gui_slots
|
.. default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
.. "list[current_name;src;2,1;1,1;]"
|
.. "list[current_name;src;2,1;1,1;]"
|
||||||
.. "list[current_name;dst;5,1;2,2;]"
|
.. "list[current_name;dst;5,1;1,1;]"
|
||||||
.. "list[current_player;main;0,5;8,4;]"
|
.. "list[current_player;main;0,5;8,4;]"
|
||||||
.. "listring[current_name;dst]"
|
.. "listring[current_name;dst]"
|
||||||
.. "listring[current_player;main]"
|
.. "listring[current_player;main]"
|
||||||
.. "listring[current_name;src]"
|
.. "listring[current_name;src]"
|
||||||
.. "listring[current_player;main]"
|
.. "listring[current_player;main]"
|
||||||
|
.. "image[3.5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"
|
||||||
|
|
||||||
minetest.register_node("wine:wine_barrel", {
|
minetest.register_node("wine:wine_barrel", {
|
||||||
description = S("Fermenting Barrel"),
|
description = S("Fermenting Barrel"),
|
||||||
@ -154,7 +276,10 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
mesh = "wine_barrel.obj",
|
mesh = "wine_barrel.obj",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 1},
|
groups = {
|
||||||
|
choppy = 2, oddly_breakable_by_hand = 1, flammable = 2,
|
||||||
|
tubedevice = 1, tubedevice_receiver = 1
|
||||||
|
},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -164,7 +289,7 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
meta:set_float("status", 0.0)
|
meta:set_float("status", 0.0)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
inv:set_size("dst", 4)
|
inv:set_size("dst", 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
@ -222,6 +347,27 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
tube = (function() if minetest.get_modpath("pipeworks") then return {
|
||||||
|
-- using a different stack from defaut when inserting
|
||||||
|
insert_object = function(pos, node, stack, direction)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
if not timer:is_started() then
|
||||||
|
timer:start(1.0)
|
||||||
|
end
|
||||||
|
return inv:add_item("src", stack)
|
||||||
|
end,
|
||||||
|
can_insert = function(pos,node,stack,direction)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:room_for_item("src", stack)
|
||||||
|
end,
|
||||||
|
-- the default stack, from which objects will be taken
|
||||||
|
input_inventory = "dst",
|
||||||
|
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
|
||||||
|
} end end)(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -251,73 +397,40 @@ minetest.register_abm({
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- does it contain grapes or barley?
|
-- does it contain any of the source items on the list?
|
||||||
if not inv:contains_item("src", ItemStack("farming:grapes"))
|
local has_item
|
||||||
and not inv:contains_item("src", ItemStack("farming:barley"))
|
for n = 1, #ferment do
|
||||||
and not inv:contains_item("src", ItemStack("default:apple"))
|
if inv:contains_item("src", ItemStack(ferment[n][1])) then
|
||||||
and not inv:contains_item("src", ItemStack("mobs:honey")) then
|
has_item = n
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not has_item then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is barrel full
|
-- is there room for additional fermentation?
|
||||||
if not inv:room_for_item("dst", "wine:glass_wine")
|
if not inv:room_for_item("dst", ferment[has_item][2]) then
|
||||||
or not inv:room_for_item("dst", "wine:glass_beer")
|
|
||||||
or not inv:room_for_item("dst", "wine:glass_cider")
|
|
||||||
or not inv:room_for_item("dst", "wine:glass_mead") then
|
|
||||||
meta:set_string("infotext", S("Fermenting Barrel (FULL)"))
|
meta:set_string("infotext", S("Fermenting Barrel (FULL)"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- do we have any grapes to ferment?
|
|
||||||
if not inv:is_empty("src") then
|
|
||||||
|
|
||||||
local status = meta:get_float("status")
|
local status = meta:get_float("status")
|
||||||
|
|
||||||
-- fermenting (change status)
|
-- fermenting (change status)
|
||||||
if status < 100 then
|
if status < 100 then
|
||||||
meta:set_string("infotext", S("Fermenting Barrel (@1% Done)", status))
|
meta:set_string("infotext", S("Fermenting Barrel (@1% Done)", status))
|
||||||
meta:set_float("status", status + 5)
|
meta:set_float("status", status + 5)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
inv:remove_item("src", ferment[has_item][1])
|
||||||
if inv:contains_item("src", "farming:grapes") then
|
inv:add_item("dst", ferment[has_item][2])
|
||||||
|
meta:set_float("status", 0,0)
|
||||||
--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)
|
|
||||||
|
|
||||||
elseif inv:contains_item("src", "mobs:honey") then
|
|
||||||
|
|
||||||
--fermented (take honey and add glass of mead)
|
|
||||||
inv:remove_item("src", "mobs:honey")
|
|
||||||
inv:add_item("dst", "wine:glass_mead")
|
|
||||||
meta:set_float("status", 0.0)
|
|
||||||
|
|
||||||
elseif inv:contains_item("src", "default:apple") then
|
|
||||||
|
|
||||||
--fermented (take apple and add glass of cider)
|
|
||||||
inv:remove_item("src", "default:apple")
|
|
||||||
inv:add_item("dst", "wine:glass_cider")
|
|
||||||
meta:set_float("status", 0.0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if inv:is_empty("src") then
|
if inv:is_empty("src") then
|
||||||
meta:set_float("status", 0.0)
|
meta:set_float("status", 0.0)
|
||||||
meta:set_string("infotext", S("Fermenting Barrel"))
|
meta:set_string("infotext", S("Fermenting Barrel"))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
else
|
|
||||||
meta:set_string("infotext", S("Fermenting Barrel"))
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -330,9 +443,13 @@ lucky_block:add_blocks({
|
|||||||
{"dro", {"wine:glass_beer"}, 5},
|
{"dro", {"wine:glass_beer"}, 5},
|
||||||
{"dro", {"wine:glass_mead"}, 5},
|
{"dro", {"wine:glass_mead"}, 5},
|
||||||
{"dro", {"wine:glass_cider"}, 5},
|
{"dro", {"wine:glass_cider"}, 5},
|
||||||
{"nod", "wine:bottle_wine"},
|
{"dro", {"wine:glass_tequila"}, 5},
|
||||||
{"nod", "wine:wine_barrel"},
|
{"dro", {"wine:wine_barrel"}, 1},
|
||||||
{"tel", 5, 1},
|
{"tel", 5, 1},
|
||||||
|
{"nod", "default:chest", 0, {
|
||||||
|
{name = "wine:bottle_wine", max = 1},
|
||||||
|
{name = "wine:bottle_tequila", max = 1},
|
||||||
|
{name = "wine:blue_agave", max = 4}}},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BIN
textures/wine_blue_agave.png
Normal file
BIN
textures/wine_blue_agave.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 320 B |
BIN
textures/wine_tequila.png
Normal file
BIN
textures/wine_tequila.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 B |
BIN
textures/wine_tequila_bottle.png
Normal file
BIN
textures/wine_tequila_bottle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 211 B |
BIN
textures/wine_wheat_beer_glass.png
Normal file
BIN
textures/wine_wheat_beer_glass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 279 B |
Loading…
x
Reference in New Issue
Block a user