added support for different health gains for the drinks.
parent
71956d0f7b
commit
eab14164b0
|
@ -3,6 +3,8 @@ for i in ipairs (drinks.drink_table) do
|
|||
local desc = drinks.drink_table[i][1]
|
||||
local craft = drinks.drink_table[i][2]
|
||||
local color = drinks.drink_table[i][3]
|
||||
local health = drinks.drink_table[i][4]
|
||||
health = health or 1
|
||||
-- The color of the drink is all done in code, so we don't need to have multiple images.
|
||||
|
||||
--Actual Node registration
|
||||
|
@ -12,7 +14,7 @@ minetest.register_craftitem('drinks:jcu_'..desc, {
|
|||
inventory_image = 'drinks_glass_contents.png^[colorize:'..color..':200^drinks_drinking_glass.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
thirsty.drink(user, 4, 20)
|
||||
local eat_func = minetest.item_eat(.5, 'vessels:drinking_glass')
|
||||
local eat_func = minetest.item_eat(health, 'vessels:drinking_glass')
|
||||
return eat_func(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
@ -23,7 +25,7 @@ minetest.register_craftitem('drinks:jbo_'..desc, {
|
|||
inventory_image = 'drinks_bottle_contents.png^[colorize:'..color..':200^drinks_glass_bottle.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
thirsty.drink(user, 8, 20)
|
||||
local eat_func = minetest.item_eat(.5, 'vessels:glass_bottle')
|
||||
local eat_func = minetest.item_eat((health*2), 'vessels:glass_bottle')
|
||||
return eat_func(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -4,6 +4,8 @@ for i in ipairs (drinks.drink_table) do
|
|||
local desc = drinks.drink_table[i][1]
|
||||
local craft = drinks.drink_table[i][2]
|
||||
local color = drinks.drink_table[i][3]
|
||||
local health = drinks.drink_table[i][4]
|
||||
health = health or 1
|
||||
|
||||
--Actual Node registration
|
||||
minetest.register_craftitem('drinks:jcu_'..desc, {
|
||||
|
@ -11,7 +13,7 @@ minetest.register_craftitem('drinks:jcu_'..desc, {
|
|||
groups = {drink=1},
|
||||
inventory_image = 'drinks_glass_contents.png^[colorize:'..color..':200^drinks_drinking_glass.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local eat_func = minetest.item_eat(.5, 'vessels:drinking_glass')
|
||||
local eat_func = minetest.item_eat(health, 'vessels:drinking_glass')
|
||||
return eat_func(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
@ -21,7 +23,7 @@ minetest.register_craftitem('drinks:jbo_'..desc, {
|
|||
groups = {drink=1},
|
||||
inventory_image = 'drinks_bottle_contents.png^[colorize:'..color..':200^drinks_glass_bottle.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local eat_func = minetest.item_eat(.5, 'vessels:glass_bottle')
|
||||
local eat_func = minetest.item_eat((health*2), 'vessels:glass_bottle')
|
||||
return eat_func(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue