minetest/minetest — pull request #1220 by MirceaKitsune (2014-04-12 20:48:38+00:00)
Title: Player information window

Formspec window which lists all players active on the server. The name of each player is shown, as well as their ping / lag. Additionally the system supports custom icons, which mods can set per player.

http://i61.tinypic.com/288uvpd.jpg

FAQ (please read before asking questions or making requests):

Q - Why was this added in builtin?
A - Because it's intended for the Minetest engine and not for minetest_game, and doing it in Lua is the best and only way. If most developers suggest moving it minetest_game, I will do so... but note that in this case adding a keybind will no longer be possible.

Q - Why didn't you add a keybind to toggle the menu rather than a chat / console command?
A - I'll do that later, or add it to the pause menu if that's a better choice. Wanted to first hear what people think so I don't work for nothing. Currently you bring up the window by typing "/players" in the console. Note that this doesn't work in singleplayer.

Q - What are player icons for and how do they work?
A - Mods can set an icon for each player, which shows left of the player's name in the player list. Scripts can change a player's icon with the playerinfo.set_icon function. Servers / games / mods can either offer a selection of avatars, or use the face of the player skin (making it easier to recognize someone in-world). Player icons are not persisted between server restarts, because that would be both hard and a bad idea. The minetest logo is used when no icon is set.

Q - Does the window auto-update?
A - No, all info is generated when the window is opened. Auto-refresh would be both difficult and the info shown doesn't require it that much.

Q - What happens if there are too many players on the server to fit them all on the list?
A - The default size of the list is 6 x 8, so 48 players can be shown. If there are more than 48, some players will be excluded. If anyone thinks that's unacceptable, feel free to add support for multiple pages, I don't know how to do this myself.

Q - Any thoughts to add more features?
A - I wanted to list more information per player... but there isn't a lot of room for text, and it appears I can only afford two lines. My plan was to show the position of players as well as their distance from self, while clicking a player's name added a waypoint to their location. Such would be very hard to do however, especially if we don't auto-refresh the list and player positions. This could however be used to send private messages to players, by clicking their name to change chat channel.

Q - Minecraft also has a window like this, aren't we copying it too much?
A - NO! >:(