From 77873ddb9e26fd1ac5090a9979a7df6e46787898 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 6 May 2016 15:14:38 +0100 Subject: [PATCH] cherry-pick from github.com/minetest/minetest_game> Creative: Fix '-' glitch in playername Fix the glitch when players use the '-' character in their username on a server, causing creative inventory to not pass page 2 --- mods/creative/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/creative/init.lua b/mods/creative/init.lua index a2c8858d..5ef8dcf0 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -194,8 +194,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) creative.set_creative_formspec(player, 0) else local formspec = player:get_inventory_formspec() - local start_i = formspec:match("list%[.-" .. player_name .. ";.-;(%d+)%]") - start_i = tonumber(start_i) or 0 + local start_i = player_inventory[player_name].start_i or 0 if fields.creative_prev then start_i = start_i - 3*8 @@ -212,6 +211,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end + player_inventory[player_name].start_i = start_i creative.set_creative_formspec(player, start_i) end end)