Only do paperflip sound when really changing page

This commit is contained in:
Zefram 2014-04-29 20:40:48 +01:00
parent b0e10d44f4
commit 37d87d6afc

@ -79,33 +79,21 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
/ (80) + 1) / (80) + 1)
if fields.start_list then if fields.start_list then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = 1 start_i = 1
end end
if fields.rewind1 then if fields.rewind1 then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = start_i - 1 start_i = start_i - 1
end end
if fields.forward1 then if fields.forward1 then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = start_i + 1 start_i = start_i + 1
end end
if fields.rewind3 then if fields.rewind3 then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = start_i - 3 start_i = start_i - 3
end end
if fields.forward3 then if fields.forward3 then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = start_i + 3 start_i = start_i + 3
end end
if fields.end_list then if fields.end_list then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
start_i = pagemax start_i = pagemax
end end
if start_i < 1 then if start_i < 1 then
@ -115,6 +103,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
start_i = pagemax start_i = pagemax
end end
if not (start_i == start) then if not (start_i == start) then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
unified_inventory.current_index[player_name] = (start_i - 1) * 80 + 1 unified_inventory.current_index[player_name] = (start_i - 1) * 80 + 1
unified_inventory.set_inventory_formspec(player, unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name]) unified_inventory.current_page[player_name])