#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	my $avatar=$_{avatar};

	# Separate contents into what is worn and what is held.
	my @holding, @wearing;
	my @contents=grep { ! $_->hidden } $this->contents->list;
	foreach (@contents) {
		if ($_->worn) {
			push @wearing, $_;
		}
		else {
			push @holding, $_;
			# The contents of some containers are visible to just plain
			# look.
			my @visi = $_->visiblecontents;
			if (@visi) {
				push @holding, @visi;
			}
		}
	}
	
	$_{contents}=$avatar->prettylist(grep { $_ != $avatar } @holding);
	if (@wearing) {
		$_{contents} .= " and wearing ".$avatar->prettylist(@wearing);
	}
	$this->msg('inventory', %_);
}
