added wine:add_drink() function to add glasses and bottles
This commit is contained in:
parent
82746a50e9
commit
b5f94f49da
17
README.md
17
README.md
@ -27,6 +27,7 @@ Change log:
|
|||||||
re-arranged code, tweaked lucky blocks, updated translations
|
re-arranged code, tweaked lucky blocks, updated translations
|
||||||
- 1.7 - Added more uses for blue agave (fuel, paper, food, agave syrup)
|
- 1.7 - Added more uses for blue agave (fuel, paper, food, agave syrup)
|
||||||
- 1.8 - Added glass and bottles for Champagne, Brandy and Coffee Liquor (thanks Felfa)
|
- 1.8 - Added glass and bottles for Champagne, Brandy and Coffee Liquor (thanks Felfa)
|
||||||
|
- 1.9 - Added wine:add_drink() function to create drink glasses and bottles
|
||||||
|
|
||||||
Lucky Blocks: 18
|
Lucky Blocks: 18
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ Lucky Blocks: 18
|
|||||||
Wine Mod API
|
Wine Mod API
|
||||||
------------
|
------------
|
||||||
|
|
||||||
wine:add_item(list)
|
wine:add_item(item_table)
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
@ -42,3 +43,17 @@ wine:add_item({
|
|||||||
{"farming:barley", "wine:glass_beer"},
|
{"farming:barley", "wine:glass_beer"},
|
||||||
{"default:apple", "wine:glass_cider"},
|
{"default:apple", "wine:glass_cider"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, alcoholic)
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
wine:add_drink("beer", "Beer", true, 2, 8, 1)
|
||||||
|
wine:add_drink("cider", "Cider", true, 2, 6, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|
||||||
|
Textures used will be wine_beer_glass.png wine_beer_bottle.png and num_thirst is only
|
||||||
|
used if thirst mod is active, alcoholic is used if stamina mod is active for drunk effect.
|
||||||
|
30
init.lua
30
init.lua
@ -135,14 +135,8 @@ local beverages = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- create glasses and bottles
|
-- add drink with bottle
|
||||||
for n = 1, #beverages do
|
function wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, alcoholic)
|
||||||
|
|
||||||
local name = beverages[n][1]
|
|
||||||
local desc = beverages[n][2]
|
|
||||||
local has_bottle = beverages[n][3]
|
|
||||||
local num_hunger = beverages[n][4]
|
|
||||||
local num_thirst = beverages[n][5]
|
|
||||||
|
|
||||||
-- glass
|
-- glass
|
||||||
minetest.register_node("wine:glass_" .. name, {
|
minetest.register_node("wine:glass_" .. name, {
|
||||||
@ -162,7 +156,7 @@ for n = 1, #beverages do
|
|||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
vessel = 1, dig_immediate = 3,
|
vessel = 1, dig_immediate = 3,
|
||||||
attached_node = 1, alcohol = 1, drink = 1
|
attached_node = 1, drink = 1, alcohol = alcoholic
|
||||||
},
|
},
|
||||||
sounds = snd_g,
|
sounds = snd_g,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
@ -206,12 +200,11 @@ for n = 1, #beverages do
|
|||||||
recipe = {
|
recipe = {
|
||||||
{glass, glass, glass},
|
{glass, glass, glass},
|
||||||
{glass, glass, glass},
|
{glass, glass, glass},
|
||||||
{glass, glass, glass},
|
{glass, glass, glass}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
-- type = "shapeless",
|
|
||||||
output = glass .. " 9",
|
output = glass .. " 9",
|
||||||
recipe = {{"wine:bottle_" .. name}}
|
recipe = {{"wine:bottle_" .. name}}
|
||||||
})
|
})
|
||||||
@ -219,6 +212,19 @@ for n = 1, #beverages do
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- create glasses and bottles
|
||||||
|
for n = 1, #beverages do
|
||||||
|
|
||||||
|
local name = beverages[n][1]
|
||||||
|
local desc = beverages[n][2]
|
||||||
|
local has_bottle = beverages[n][3]
|
||||||
|
local num_hunger = beverages[n][4]
|
||||||
|
local num_thirst = beverages[n][5]
|
||||||
|
|
||||||
|
wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- brandy recipe
|
-- brandy recipe
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user