Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory not being rendered #9640

Closed
theviper121 opened this issue Apr 11, 2020 · 6 comments · Fixed by #9700
Closed

Inventory not being rendered #9640

theviper121 opened this issue Apr 11, 2020 · 6 comments · Fixed by #9700
Labels
Bug Issues that were confirmed to be a bug

Comments

@theviper121
Copy link
Contributor

theviper121 commented Apr 11, 2020

Minetest version 5.2.0
Summary

Inventory not being rendered when it is created on the same server step the form using it is send.
It seems the client is not yet aware of the newly created inventory.

Steps to reproduce

Create a detached inventory and send formspec to client on same step to get:
GUIFormSpecMenu::parseList(): The inventory list ##### @ ####### doesn't exist

Seems the issue was introduced by commit 7843822
In file src/gui/guiFormSpecMenu.cpp

@theviper121 theviper121 added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Apr 11, 2020
@SmallJoker
Copy link
Member

Inventory lists and inventory formspecs are sent very closely together:

minetest/src/server.cpp

Lines 1005 to 1009 in aa3cf40

// Send inventory formspec
SendPlayerInventoryFormspec(peer_id);
// Send inventory
SendInventory(playersao, false);

Does this happen using the default settings (i.e. rename "minetest.conf")?

GUIFormSpecMenu::parseList(): The inventory list ##### @ ####### doesn't exist

Which lists? Please provide the each different warning log line.

@Desour
Copy link
Member

Desour commented Apr 11, 2020

I can reproduce, sometimes.
In the old formspec code, the inventory list tried again and again, each draw step, to get the inventorylist. Now it doesn't anymore. Before the formspec changes, there were probably also warnings.

Code I've used for testing
local detached_test_inv_exists = false
local function show_inv_formspec(name)
	print("opening inv test formspec...")
	local inv_name = "fs_test_detached_inv"
	if not detached_test_inv_exists then
		local inv = minetest.create_detached_inventory(inv_name, {
			allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
				return count
			end,
			allow_put = function(inv, listname, index, stack, player)
				return stack:get_count()
			end,
			allow_take = function(inv, listname, index, stack, player)
				return stack:get_count()
			end,
			--~ on_move = function(inv, from_list, from_index, to_list, to_index, count, player),
			on_put = function(inv, listname, index, stack, player)
				minetest.remove_detached_inventory(inv_name)
				detached_test_inv_exists = false
			end,
			--~ on_take = function(inv, listname, index, stack, player),
		})
		inv:set_size("baum", 6)
		detached_test_inv_exists = true
	end
	--~ minetest.remove_detached_inventory(inv_name)
	minetest.show_formspec(name, "fs_test_inv", "formspec_version[3]"..
		"size["..(9 + 7 * 0.25)..",10]"..
		"list[detached:"..inv_name..";baum;0.5,0.5;3,2;0]"..
		"list[current_player;main;0.5,3.25;8,4;]"
	)
	print("finished.")
end

minetest.register_chatcommand("fs", {
	params = "",
	description = "Show the test formspec.",
	privs = {},
	func = function(name, param)
		show_inv_formspec(name)
		return true
	end,
})

@oilboi
Copy link
Contributor

oilboi commented Apr 12, 2020

Wouldn't the simple solution be to send the inventory before the formspec? Or create a statement which delays the sending of one or the other

@KaylebJay
Copy link

This issue arises on the server Tunnelers' Abyss with the mod 'inventorybags' on clients newer than 5.1.1, to confirm.

@rubenwardy
Copy link
Member

This happens when granting creative in a non-creative game

@Desour
Copy link
Member

Desour commented Apr 17, 2020

Fix: #9700

@SmallJoker SmallJoker added Bug Issues that were confirmed to be a bug and removed Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible labels Apr 17, 2020
nerzhul pushed a commit to nerzhul/minetest that referenced this issue Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants