diff --git a/init.lua b/init.lua index 313e9b4..c2f75ad 100644 --- a/init.lua +++ b/init.lua @@ -432,8 +432,7 @@ end local show_fs = function(player, player_name) if sfinv_only then - local context = sfinv.get_or_create_context(player) - sfinv.set_player_inventory_formspec(player, context) + sfinv.set_player_inventory_formspec(player) else make_formspec(player_name) local data = player_data[player_name] @@ -782,12 +781,8 @@ if sfinv_only then title = "Craft Guide", get = function(self, player, context) - local player_name = player:get_player_name() - return sfinv.make_formspec( - player, - context, - make_formspec(player_name) - ) + local formspec = make_formspec(player:get_player_name()) + return sfinv.make_formspec(player, context, formspec) end, on_enter = function(self, player, context) @@ -809,7 +804,7 @@ if sfinv_only then else mt.register_on_player_receive_fields(get_fields) - local function on_use(itemstack, user) + local function on_use(user) local player_name = user:get_player_name() local data = player_data[player_name] @@ -833,7 +828,7 @@ else stack_max = 1, groups = {book = 1}, on_use = function(itemstack, user) - on_use(itemstack, user) + on_use(user) end }) @@ -860,7 +855,7 @@ else end, on_rightclick = function(pos, node, user, itemstack) - on_use(itemstack, user) + on_use(user) end }) @@ -894,7 +889,7 @@ else tooltip = S("Shows a list of available crafting recipes, cooking recipes and fuels"), image = "craftguide_book.png", action = function(player) - on_use(nil, player) + on_use(player) end, }) end