forked from VoxeLibre/VoxeLibre
Remove unused function in mcl_hunger
This commit is contained in:
parent
78ae5ddc26
commit
a4eaaad1a9
|
@ -99,42 +99,6 @@ function mcl_hunger.reset_bars_poison_hunger(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Poison player TODO remove this function
|
|
||||||
local function poisonp(tick, time, time_left, damage, exhaustion, name)
|
|
||||||
if not mcl_hunger.active then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
-- First check if player is still there
|
|
||||||
if not player then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- Abort if food poisonings have been stopped
|
|
||||||
if mcl_hunger.poison_hunger[name] == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
time_left = time_left + tick
|
|
||||||
if time_left < time then
|
|
||||||
minetest.after(tick, poisonp, tick, time, time_left, damage, exhaustion, name)
|
|
||||||
else
|
|
||||||
if exhaustion > 0 then
|
|
||||||
mcl_hunger.poison_hunger [name] = mcl_hunger.poison_hunger[name] - 1
|
|
||||||
end
|
|
||||||
if mcl_hunger.poison_hunger[name] <= 0 then
|
|
||||||
mcl_hunger.reset_bars_poison_hunger(player)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Deal damage and exhaust player
|
|
||||||
-- TODO: Introduce fatal poison at higher difficulties
|
|
||||||
if player:get_hp()-damage > 0 then
|
|
||||||
mcl_util.deal_damage(player, damage, {type = "hunger"})
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_hunger.exhaust(name, exhaustion)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local poisonrandomizer = PseudoRandom(os.time())
|
local poisonrandomizer = PseudoRandom(os.time())
|
||||||
|
|
||||||
function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poison, exhaust, poisonchance, sound)
|
function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poison, exhaust, poisonchance, sound)
|
||||||
|
|
Loading…
Reference in New Issue