Fix ctf scrolling

with lag, a player was able to scroll past the max, which cause the server to crash,should be fixed now. (hard to debug locally, with no lag)
This commit is contained in:
Elkien3 2017-10-19 08:16:02 -05:00
parent f748d99908
commit 386be9fb14

View File

@ -317,17 +317,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
cur_team = tname cur_team = tname
end end
if fields.scroll_up then if fields.scroll_up then
scroll_diplomacy = scroll_diplomacy - 1 if scroll_diplomacy > 0 then
if scroll_diplomacy < 0 then scroll_diplomacy = scroll_diplomacy - 1
else
scroll_diplomacy = 0 scroll_diplomacy = 0
end end
ctf.gui.show(name, "diplo", cur_team) ctf.gui.show(name, "diplo", cur_team)
end end
if fields.scroll_down then if fields.scroll_down then
scroll_diplomacy = scroll_diplomacy + 1 if scroll_diplomacy < (scroll_max+5) then
if scroll_diplomacy > (scroll_max+5) then scroll_diplomacy = scroll_diplomacy + 1
else
scroll_diplomacy = scroll_max scroll_diplomacy = scroll_max
end end
ctf.gui.show(name, "diplo", cur_team) ctf.gui.show(name, "diplo", cur_team)
end end