#!/usr/bin/perl
#use Mooix::Thing;
#use Mooix::Root;
run sub {
	my $this=shift;
	%_=@_;
	my $oldversion=$_{oldversion} || $this->croak("missing oldversion");
	
	if (40 > $oldversion) {
		# Fragile objects used to track their brokenness with a
		# "broken" field, and then all objects got hit points..
		if (! $this->defines("hitpoints") && $this->break_max && $this->defines("broken")) {
			$this->hitpoints($this->break_max - $this->broken);
		}
		unlink($this->fieldfile("break_max"));
		unlink($this->fieldfile("broken"));
		# If the fragile is indeed already broken, reparent it to
		# junk.
		if ($this->broken < $this->break_max) {
			$this->parent($Mooix::Root->concrete->junk);
		}
	}

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