#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	my $avatar=$_{avatar};
	
	if (! $this->worn || $this->location != $avatar) {
		fail "You are not wearing that.";
	}

	if ($this->worn(0) == 0 && $this->immobile(0) == 0) {
		$this->msg("remove", @_);
	}
	else {
		# Back out any changes made.
		$this->worn(0) if $this->worn == 0;
		$this->immobile(0) if $this->immobile == 0;
		fail "You cannot take it off!";
	}
}
