code tweaks
This commit is contained in:
parent
2fdaf907d9
commit
adfcc53d3d
@ -28,7 +28,7 @@ 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
|
- 1.9 - Added wine:add_drink() function to create drink glasses and bottles
|
||||||
- 1.95 - Tweaked code to accept 2 item recipes, fixed mineclone2 rum recipe
|
- 1.95 - Tweaked code to accept 2 item recipes, fixed mineclone2 rum recipe and ui recipes
|
||||||
|
|
||||||
Lucky Blocks: 18
|
Lucky Blocks: 18
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ e.g.
|
|||||||
|
|
||||||
wine:add_item({
|
wine:add_item({
|
||||||
{"farming:barley", "wine:glass_beer"},
|
{"farming:barley", "wine:glass_beer"},
|
||||||
{"default:apple", "wine:glass_cider"},
|
{"default:apple 2", "wine:glass_cider"}, -- 2x apples make 1x glass cider
|
||||||
{{"default:apple", "farming:sugar"}, "wine:glass_sparkling_apple},
|
{{"default:apple", "farming:sugar"}, "wine:glass_sparkling_apple},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
54
init.lua
54
init.lua
@ -120,22 +120,22 @@ function wine:add_item(list)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- list of beverages (name, desc, has bottle, hunger, thirst)
|
-- list of beverages (name, desc, has bottle, hunger, thirst, alcoholic)
|
||||||
local beverages = {
|
local beverages = {
|
||||||
{"wine", "Wine", true, 2, 5},
|
{"wine", "Wine", true, 2, 5, 1},
|
||||||
{"beer", "Beer", true, 2, 8},
|
{"beer", "Beer", true, 2, 8, 1},
|
||||||
{"rum", "Rum", true, 2, 5},
|
{"rum", "Rum", true, 2, 5, 1},
|
||||||
{"tequila", "Tequila", true, 2, 3},
|
{"tequila", "Tequila", true, 2, 3, 1},
|
||||||
{"wheat_beer", "Wheat Beer", true, 2, 8},
|
{"wheat_beer", "Wheat Beer", true, 2, 8, 1},
|
||||||
{"sake", "Sake", true, 2, 3},
|
{"sake", "Sake", true, 2, 3, 1},
|
||||||
{"bourbon", "Bourbon", true, 2, 3},
|
{"bourbon", "Bourbon", true, 2, 3, 1},
|
||||||
{"vodka", "Vodka", true, 2, 3},
|
{"vodka", "Vodka", true, 2, 3, 1},
|
||||||
{"cider", "Cider", true, 2, 6},
|
{"cider", "Cider", true, 2, 6, 1},
|
||||||
{"mead", "Honey-Mead", true, 4, 5},
|
{"mead", "Honey-Mead", true, 4, 5, 1},
|
||||||
{"mint", "Mint Julep", true, 4, 3},
|
{"mint", "Mint Julep", true, 4, 3, 1},
|
||||||
{"brandy", "Brandy", true, 3, 4},
|
{"brandy", "Brandy", true, 3, 4, 1},
|
||||||
{"coffee_liquor", "Coffee Liquor", true, 3, 4},
|
{"coffee_liquor", "Coffee Liquor", true, 3, 4, 1},
|
||||||
{"champagne", "Champagne", true, 4, 5}
|
{"champagne", "Champagne", true, 4, 5, 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -224,8 +224,9 @@ for n = 1, #beverages do
|
|||||||
local has_bottle = beverages[n][3]
|
local has_bottle = beverages[n][3]
|
||||||
local num_hunger = beverages[n][4]
|
local num_hunger = beverages[n][4]
|
||||||
local num_thirst = beverages[n][5]
|
local num_thirst = beverages[n][5]
|
||||||
|
local alcohol = beverages[n][6]
|
||||||
|
|
||||||
wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, 1)
|
wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, alcohol)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -322,6 +323,7 @@ minetest.register_node("wine:blue_agave", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- blue agave into cyan dye
|
-- blue agave into cyan dye
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "dye:cyan 4",
|
output = "dye:cyan 4",
|
||||||
@ -456,8 +458,7 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_take = function(
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
pos, listname, index, stack, player)
|
|
||||||
|
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
@ -535,9 +536,9 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
-- the default stack, from which objects will be taken
|
-- the default stack, from which objects will be taken
|
||||||
input_inventory = "dst",
|
input_inventory = "dst",
|
||||||
|
|
||||||
connect_sides = {
|
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
|
||||||
left = 1, right = 1, back = 1,
|
|
||||||
front = 1, bottom = 1, top = 1} } end end)(),
|
} end end)(),
|
||||||
|
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
|
|
||||||
@ -560,15 +561,17 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
|
|
||||||
recipe = ferment[n]
|
recipe = ferment[n]
|
||||||
|
|
||||||
|
-- convert any old string recipe to table
|
||||||
if type(recipe[1]) == "string" then
|
if type(recipe[1]) == "string" then
|
||||||
recipe = {{recipe[1]}, recipe[2]}
|
recipe = {{recipe[1]}, recipe[2]}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- check for first recipe item
|
||||||
if inv:contains_item("src", ItemStack(recipe[1][1])) then
|
if inv:contains_item("src", ItemStack(recipe[1][1])) then
|
||||||
|
|
||||||
has_item = true
|
has_item = true
|
||||||
|
|
||||||
-- check for second recipe item
|
-- check for second recipe item if required
|
||||||
if recipe[1][2] then
|
if recipe[1][2] then
|
||||||
|
|
||||||
if inv:contains_item("src", ItemStack(recipe[1][2])) then
|
if inv:contains_item("src", ItemStack(recipe[1][2])) then
|
||||||
@ -598,16 +601,17 @@ minetest.register_node("wine:wine_barrel", {
|
|||||||
|
|
||||||
-- 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)
|
||||||
|
|
||||||
local name = minetest.registered_items[recipe[2]].description or ""
|
local desc = minetest.registered_items[recipe[2]].description or ""
|
||||||
|
|
||||||
meta:set_string("formspec", winebarrel_formspec(status, S("Brewing: @1", name)))
|
meta:set_string("formspec", winebarrel_formspec(status, S("Brewing: @1", desc)))
|
||||||
else
|
else
|
||||||
inv:remove_item("src", recipe[1][1])
|
inv:remove_item("src", recipe[1][1])
|
||||||
|
|
||||||
-- remove 2nd recipeitem if found
|
-- remove 2nd recipe item if found
|
||||||
if has_item == 2 then
|
if has_item == 2 then
|
||||||
inv:remove_item("src", recipe[1][2])
|
inv:remove_item("src", recipe[1][2])
|
||||||
end
|
end
|
||||||
|
@ -30,4 +30,5 @@ Agave Syrup=
|
|||||||
Fermenting Barrel=
|
Fermenting Barrel=
|
||||||
Fermenting Barrel (FULL)=
|
Fermenting Barrel (FULL)=
|
||||||
Fermenting Barrel (@1% Done)=
|
Fermenting Barrel (@1% Done)=
|
||||||
|
Brewing: @1=
|
||||||
[MOD] Wine loaded=
|
[MOD] Wine loaded=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user