#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;

	# Don't clear fields on unpack if the clothing is worn and has a
	# location (wearer) set. Do clear fields otherwise, and on object
	# creation too.
	if (! $this->defines("wielded") || ! ref $this->location) {
		foreach my $field (qw{worn immobile}) {
			$this->$field(0);
			chmod(0664, $this->fieldfile($field)) || die "chmod $field: $!";
		}
	}

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