#!/usr/bin/perl
#use Mooix::Thing;
#use Mooix::Root;
run sub {
	my $this=shift;
	%_=@_;
	my $avatar=$_{avatar};
	my $exit=$Mooix::Root->concrete->exit;
	my @exits, @somexits;
	my $exit_ok=$this->exit_ok;
	foreach my $obj ($this->contents->list) {
		next unless $obj->isa($exit);
		next unless $obj->listable;
		next unless $exit_ok || $obj->owner == $this->owner;
		push @exits, $obj;
		# These exits are found when the user is
		# trying to find exits without sight.
		push @someexits, $obj if rand > 0.5;
	}
	# This is rather specific to the precise ways the variables are
	# used in the exits.msg. Oh well.
	if (@someexits > 1) {
		$_{someexits}="exits ".$avatar->prettylist(@someexits);
	}
	elsif (@someexits) {
		$_{someexits}="an exit ".$avatar->prettylist(@someexits);
	}
	else {
		$_{someexits}="nothing";
	}
	$this->msg('exits', %_,
		exits => @exits ? $avatar->prettylist(@exits) : 'none',
		s => (@exits == 1) ? "" : "s",
	);
}
