Fix sus stew not having eating particle & sound effects and eating slow speed getting stuck on login

This commit is contained in:
Eliy21 2024-01-16 06:58:10 +00:00
parent 184f1575ee
commit 109aed75df

View file

@ -67,6 +67,7 @@ minetest.register_on_joinplayer(function(player)
_custom_wrapper = nil, -- Will execute alongside minetest.do_item_eat if not empty and _custom_itemstack is equal to current player itemstack _custom_wrapper = nil, -- Will execute alongside minetest.do_item_eat if not empty and _custom_itemstack is equal to current player itemstack
_custom_do_delayed = false, -- If true, then will execute only _custom_wrapper after holding RMB or LMB within a delay specified by mcl_hunger.EATING_DELAY (Use to bypass minetest.do_item_eat entirely) _custom_do_delayed = false, -- If true, then will execute only _custom_wrapper after holding RMB or LMB within a delay specified by mcl_hunger.EATING_DELAY (Use to bypass minetest.do_item_eat entirely)
} }
playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed")
end) end)
-- Clear when player leaves -- Clear when player leaves
@ -284,6 +285,18 @@ minetest.register_globalstep(function(dtime)
if eat_effects_cooldown[player] > 0.2 then if eat_effects_cooldown[player] > 0.2 then
eat_effects_cooldown[player] = 0 eat_effects_cooldown[player] = 0
if not mcl_hunger.eat_internal[player_name].user then
mcl_hunger.eat_internal[player_name].user = player
end
if not mcl_hunger.eat_internal[player_name].itemname then
mcl_hunger.eat_internal[player_name].itemname = current_itemstack:get_name()
end
if not mcl_hunger.eat_internal[player_name].hp_change then
mcl_hunger.eat_internal[player_name].hp_change = 0
end
local pos = player:get_pos() local pos = player:get_pos()
local itemname = mcl_hunger.eat_internal[player_name].itemname local itemname = mcl_hunger.eat_internal[player_name].itemname
local def = minetest.registered_items[itemname] local def = minetest.registered_items[itemname]