#!/usr/bin/perl
#use Mooix::Thing;
#use Mooix::Root;
#use Fcntl q{:flock};
run sub {
	my $this=shift;
	my $damage=shift;
	
	$this->super($damage);

	# Damage contents, sometimes.
	foreach my $obj ($this->contents->list) {
		next unless rand > 0.75;
		$obj->damage($damage * rand(0.75));
	}
	
	# Drop contents if heavily damaged.
	if ($this->hitpoints <= 0) {
		foreach my $obj ($this->contents->list) {
			my $lock=$obj->getlock(LOCK_EX | LOCK_NB);
			next unless $lock;
			$obj->drop(to => $this->location);
		}
	}
}
