D3FS
====
D3FS is a Perl script which uses FUSE (Filesystem in Userspace) to
present you an overview of Descent 3 servers and information about
them as a filesystem you can mount at a directory of your choice.

Usage: d3fs.pl <mountpoint> &

(Note the &; it doesn't fork by itself, so you'll probably want to
 background it)

To unmount: fusermount -u <mountpoint>

Example:
	mkdir d3servers		# Create directory
	d3fs.pl d3servers &	# Mount D3 serverlist filesystem
	ls -ld d3servers	# The size tells you the number of servers
	cd d3servers
	ls -lS			# List servers sorted by player count
				# (the size tells you the number of players)

	# Show all servers not running Skybox.
	find . -wholename '*mission/name' -print0 | xargs -0 grep -vH skybox

	# Show all servers located in Europe
	find . -name location -print0 | xargs -0 grep Europe

	# Show all servers with mouselook enabled
	find . -name mouselook

	# ...or those with `Randomize powerups' disabled
	find . -name No_randomize_powerups

	# cd back out of the directory, unmount, and terminate the script
	cd ..
	fusermount -u d3servers

The layout of the filesystem tree is a bit ad-hoc, and more
advanced queries are probably difficult to do. It's probably not
really useful, but nice to have as a toy.

Requirements
------------
* FUSE (CONFIG_FUSE_FS=y in Linux config and FUSE C library installed)
  (http://fuse.sourceforge.net/)

* The "Fuse" Perl module
  (http://search.cpan.org/search?query=Fuse&mode=module)

* gslist (used to retrieve server list from Gamespy)
  (http://aluigi.altervista.org/papers.htm#gslist)

* all indirect requirements such as Perl, a working GNU/Linux system,
  etc...

Current version
---------------
0.1. Please change this and the $VERSION variable in d3fs.pl if you
release any modified version of D3FS, along with adding your name
and modification notice, of course.

Copyright
---------
BSD-style copyright license, see d3fs.pl for the full license text.

Notes
-----
* After running the script, you should wait a few seconds to allow it
  to query the servers, wait for responses, and build the filesystem
  tree. The time to wait for responses can be changed by editing the
  $serverlist_timeout variable near the top of d3fs.pl.

  The query procedure first queries all servers, then it queries
  again those servers which didn't respond. The query procedure
  therefore takes about 2 times $serverlist_timeout seconds, assuming
  some servers fail to respond each time; less if all server
  information is retrieved successfully.

* You can refresh the entire list of servers by touching the mountpoint.
  touch will block until the update procedure is finished.

* You can refresh information for a single server by touching the
  corresponding server directory. Again, touch will block until the
  update is complete.

* Besides the initial server querying at startup and the 2 methods
  listed above, *no* refreshing of server information is done.

* Near the top of d3fs.pl is a variable $d3_missions_dir which you can
  set to your actual D3 missions directory. The mission/file link
  should then point to the actual mission file, if you have it.

* If gslist cannot be found, edit the $gslist_bin variable to contain
  the path to the gslist binary (including the name of the binary).

Possible future improvements
----------------------------
* Better interface: commandline arguments for help and to set things
  such as server query timeout and D3 missions dir.

* Some sections (the my_* filesystem callback functions) could probably
  use a couple of comments)

* mission/name: show full mission name instead of .mn3 filename

* mission/urls: a list of mission download links (queried from D3 server)

* Integration with Loki D3 or Wine+D3 users: a "join_this_server"
  shell script in every server dir which lets you instantly join that
  server.

* ......

----------------

Enjoy & cya in the mines,

The Lion
