aloe heals, lack of hunger does not
parent
5a12c3c518
commit
1e67596643
|
@ -25,7 +25,14 @@ minetest.register_craftitem("herbs:aloe_vera", {
|
||||||
inventory_image = "herbs_aloe_vera_plant.png",
|
inventory_image = "herbs_aloe_vera_plant.png",
|
||||||
groups = {},
|
groups = {},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
local hp = user:get_hp()
|
||||||
|
if hp < 20 then
|
||||||
|
hp = hp + 1
|
||||||
|
if hp > 20 then
|
||||||
|
hp = 20
|
||||||
|
end
|
||||||
|
user:set_hp(hp)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -143,13 +143,13 @@ local function hunger_globaltimer(dtime)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local tab = hunger[name]
|
local tab = hunger[name]
|
||||||
if tab then
|
if tab then
|
||||||
local air = player:get_breath() or 0
|
-- local air = player:get_breath() or 0
|
||||||
local hp = player:get_hp()
|
local hp = player:get_hp()
|
||||||
|
|
||||||
-- heal player by 1 hp if not dead and saturation is > 15 (of 30) player is not drowning
|
-- heal player by 1 hp if not dead and saturation is > 15 (of 30) player is not drowning
|
||||||
if tonumber(tab.lvl) > HUNGER_HEAL_LVL and hp > 0 and air > 0 then
|
-- if tonumber(tab.lvl) > HUNGER_HEAL_LVL and hp > 0 and air > 0 then
|
||||||
player:set_hp(hp + HUNGER_HEAL)
|
-- player:set_hp(hp + HUNGER_HEAL)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
-- or damage player by 1 hp if saturation is < 2 (of 30)
|
-- or damage player by 1 hp if saturation is < 2 (of 30)
|
||||||
if tonumber(tab.lvl) < HUNGER_STARVE_LVL then
|
if tonumber(tab.lvl) < HUNGER_STARVE_LVL then
|
||||||
|
|
Loading…
Reference in New Issue