1
0
Fork 0

Fix annoying mcl_hunger typo (“poisen”)

This commit is contained in:
Wuzzy 2017-05-20 23:34:31 +02:00
parent 9a520450c1
commit af4ef21675
1 changed files with 8 additions and 8 deletions

View File

@ -25,11 +25,11 @@ end
-- food functions -- food functions
local food = mcl_hunger.food local food = mcl_hunger.food
function mcl_hunger.register_food(name, hunger_change, replace_with_item, poisen, heal, sound) function mcl_hunger.register_food(name, hunger_change, replace_with_item, poison, heal, sound)
food[name] = {} food[name] = {}
food[name].saturation = hunger_change -- hunger points added food[name].saturation = hunger_change -- hunger points added
food[name].replace = replace_with_item -- what item is given back after eating food[name].replace = replace_with_item -- what item is given back after eating
food[name].poisen = poisen -- time its poisening food[name].poison = poison -- time its poisoning
food[name].healing = heal -- amount of HP food[name].healing = heal -- amount of HP
food[name].sound = sound -- special sound that is played when eating food[name].sound = sound -- special sound that is played when eating
end end
@ -46,19 +46,19 @@ function mcl_hunger.eat(hp_change, replace_with_item, itemstack, user, pointed_t
def.saturation = hp_change def.saturation = hp_change
def.replace = replace_with_item def.replace = replace_with_item
end end
local func = mcl_hunger.item_eat(def.saturation, def.replace, def.poisen, def.healing, def.sound) local func = mcl_hunger.item_eat(def.saturation, def.replace, def.poison, def.healing, def.sound)
return func(itemstack, user, pointed_thing) return func(itemstack, user, pointed_thing)
end end
-- Poison player -- Poison player
local function poisenp(tick, time, time_left, player) local function poisonp(tick, time, time_left, player)
-- First check if player is still there -- First check if player is still there
if not player:is_player() then if not player:is_player() then
return return
end end
time_left = time_left + tick time_left = time_left + tick
if time_left < time then if time_left < time then
minetest.after(tick, poisenp, tick, time, time_left, player) minetest.after(tick, poisonp, tick, time, time_left, player)
else else
mcl_hunger.poisonings[player:get_player_name()] = mcl_hunger.poisonings[player:get_player_name()] - 1 mcl_hunger.poisonings[player:get_player_name()] = mcl_hunger.poisonings[player:get_player_name()] - 1
if mcl_hunger.poisonings[player:get_player_name()] <= 0 then if mcl_hunger.poisonings[player:get_player_name()] <= 0 then
@ -72,7 +72,7 @@ local function poisenp(tick, time, time_left, player)
end end
function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound) function mcl_hunger.item_eat(hunger_change, replace_with_item, poison, heal, sound)
return function(itemstack, user, pointed_thing) return function(itemstack, user, pointed_thing)
local itemname = itemstack:get_name() local itemname = itemstack:get_name()
if itemstack:take_item() ~= nil and user ~= nil then if itemstack:take_item() ~= nil and user ~= nil then
@ -151,11 +151,11 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
mcl_hunger.update_saturation_hud(user, mcl_hunger.get_saturation(user), h) mcl_hunger.update_saturation_hud(user, mcl_hunger.get_saturation(user), h)
end end
-- Poison -- Poison
if poisen then if poison then
-- Set poison bar -- Set poison bar
hb.change_hudbar(user, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png") hb.change_hudbar(user, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png")
mcl_hunger.poisonings[name] = mcl_hunger.poisonings[name] + 1 mcl_hunger.poisonings[name] = mcl_hunger.poisonings[name] + 1
poisenp(1, poisen, 0, user) poisonp(1, poison, 0, user)
end end
--sound:eat --sound:eat