drinks/drinks.lua

54 lines
2.0 KiB
Lua
Raw Normal View History

2016-10-30 17:59:51 -07:00
--Parse Table
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
2016-11-13 19:07:29 -08:00
-- The color of the drink is all done in code, so we don't need to have multiple images.
2016-10-30 17:59:51 -07:00
--Actual Node registration
drinks.register_item('drinks:jcu_'..desc, 'vessels:drinking_glass', {
2016-10-30 17:59:51 -07:00
description = 'Cup of '..craft..' Juice',
groups = {drink=1},
juice_type = craft,
2016-10-30 17:59:51 -07:00
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(health, 'vessels:drinking_glass')
2016-10-30 17:59:51 -07:00
return eat_func(itemstack, user, pointed_thing)
end,
})
drinks.register_item('drinks:jbo_'..desc, 'vessels:glass_bottle',{
2016-10-30 17:59:51 -07:00
description = 'Bottle of '..craft..' Juice',
groups = {drink = 1},
juice_type = craft,
2016-10-30 17:59:51 -07:00
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((health*2), 'vessels:glass_bottle')
2016-10-30 17:59:51 -07:00
return eat_func(itemstack, user, pointed_thing)
end,
})
drinks.register_item('drinks:jsb_'..desc, 'vessels:steel_bottle',{
description = 'Heavy Steel Bottle ('..craft..' Juice)',
groups = {drink = 1},
inventory_image = 'vessels_steel_bottle.png',
on_use = function(itemstack, user, pointed_thing)
thirsty.drink(user, 8, 20)
local eat_func = minetest.item_eat((health*2), 'vessels:steel_bottle')
return eat_func(itemstack, user, pointed_thing)
end,
})
2016-10-30 17:59:51 -07:00
minetest.register_craftitem('drinks:jbu_'..desc, {
description = 'Bucket of '..craft..' Juice',
juice_type = craft,
2016-10-30 17:59:51 -07:00
inventory_image = 'bucket.png^(drinks_bucket_contents.png^[colorize:'..color..':200)',
stack_max = 1,
})
end