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

	# Take a shared lock to prevent the door from closing while it is
	# being moved through.
	require $this->fieldfile("getlock.pl");
	my @locks=getduallock($this, LOCK_SH, "closed");
	
	my @ret;
	if ($this->closed) {
		if (! $_{noautoopen}) {
			# Autoopen. But first, have to drop our locks.
			close $_ foreach @locks;
			$this->open_verb(@_);
			# regain lock
			@locks = getduallock($this, LOCK_SH, "closed");
		}
		
		if ($this->closed) {
			fail "You can't go that way.";
		}
	}

	$this->exec->super(@_);
}
