forked from mtcontrib/witchcraft
Add hunger_ng support.
Fixes https://github.com/D00Med/witchcraft/issues/6
This commit is contained in:
parent
0115b9f0ba
commit
ee1eb7d8ce
@ -8,5 +8,6 @@ farming?
|
||||
lightning?
|
||||
pmobs?
|
||||
hud_hunger?
|
||||
hunger_ng?
|
||||
moreplants?
|
||||
horror?
|
57
init.lua
57
init.lua
@ -2539,11 +2539,9 @@ minetest.register_node("witchcraft:potion_purple", {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
if minetest.get_modpath("hud_hunger") ~= nil then
|
||||
local register_food = hunger.register_food
|
||||
minetest.register_node("witchcraft:potion_gpurple", {
|
||||
local register_food = hunger.register_food
|
||||
minetest.register_node("witchcraft:potion_gpurple", {
|
||||
description = "Filling Potion",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"witchcraft_potion_gpurple.png"},
|
||||
@ -2563,9 +2561,9 @@ minetest.register_node("witchcraft:potion_gpurple", {
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node("witchcraft:potion_gred", {
|
||||
minetest.register_node("witchcraft:potion_gred", {
|
||||
description = "Hunger Potion",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"witchcraft_potion_gred.png"},
|
||||
@ -2585,17 +2583,16 @@ minetest.register_node("witchcraft:potion_gred", {
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
register_food("witchcraft:potion_gpurple", 10)
|
||||
register_food("witchcraft:potion_gred", -4)
|
||||
register_food("witchcraft:potion_gpurple", 10)
|
||||
register_food("witchcraft:potion_gred", -4)
|
||||
else
|
||||
|
||||
minetest.register_node("witchcraft:potion_gpurple", {
|
||||
description = "Filling Potion (better with hunger mod)",
|
||||
description = "Filling Potion",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"witchcraft_potion_purple.png"},
|
||||
wield_image = "witchcraft_potion_purple.png",
|
||||
tiles = {"witchcraft_potion_gpurple.png"},
|
||||
wield_image = "witchcraft_potion_gpurple.png",
|
||||
paramtype = "light",
|
||||
stack_max = 1,
|
||||
is_ground_content = false,
|
||||
@ -2607,15 +2604,11 @@ else
|
||||
groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
inventory_image = "witchcraft_potion_purple.png",
|
||||
on_use = function(itemstack, player)
|
||||
local health = player:get_hp();
|
||||
player:set_hp(health+20)
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
return itemstack
|
||||
end,
|
||||
on_use = minetest.item_eat(20, "vessels:glass_bottle"),
|
||||
})
|
||||
|
||||
minetest.register_node("witchcraft:potion_gred", {
|
||||
description = "Hunger Potion (better with hunger mod)",
|
||||
description = "Hunger Potion",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"witchcraft_potion_gred.png"},
|
||||
wield_image = "witchcraft_potion_gred.png",
|
||||
@ -2630,14 +2623,22 @@ else
|
||||
groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
inventory_image = "witchcraft_potion_gred.png",
|
||||
on_use = function(itemstack, player)
|
||||
local health = player:get_hp();
|
||||
player:set_hp(health+10)
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
})
|
||||
on_use = minetest.item_eat(-10, "vessels:glass_bottle"),
|
||||
})
|
||||
|
||||
if minetest.get_modpath("hunger_ng") ~= nil then
|
||||
local register_food = hunger_ng.add_hunger_data
|
||||
|
||||
register_food('witchcraft:potion_gpurple', {
|
||||
satiates = 10,
|
||||
returns = 'vessels:glass_bottle'
|
||||
})
|
||||
|
||||
register_food('witchcraft:potion_gred', {
|
||||
satiates = -4,
|
||||
returns = 'vessels:glass_bottle'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("witchcraft:potion_purple_2", {
|
||||
|
Loading…
Reference in New Issue
Block a user