Fixed hungry mod as hypot gives errors to some people, now uses vector.distance

master
bas080 2013-08-08 18:24:51 +02:00
parent 8f31d8ce81
commit 5bd3f7cf71
2 changed files with 1 additions and 2 deletions

View File

@ -39,7 +39,6 @@ minetest.register_abm({ --remove bees
minetest.remove_node(pos)
minetest.sound_play({name="demon_remove"},{pos=newpos, max_hear_distance=32, gain=1})
end
print(node.param2..face)
if node.param2 ~= face then
minetest.set_node(pos, {name=node.name, param2 = face} )
end

View File

@ -22,7 +22,7 @@ if hunger.enabled then
minetest.after(distance_interval, function()
hunger.update(player,pos_two)
end)
hunger[name] = hunger[name] + (math.hypot(pos_one.x-pos_two.x, pos_one.y-pos_two.y)+math.abs(pos_one.y-pos_two.y))*hunger_per_meter
hunger[name] = hunger[name] + vector.distance(pos_one,pos_two)*hunger_per_meter
if hunger[name] >= 1 then
local inv = player:get_inventory()
if inv:contains_item("main", "default:apple") then