#!/usr/bin/perl
#use Mooix::Thing;
#use Mooix::Root;
run sub {
	my $this=shift;
	# log out for one hour
	$this->nologin(time + 60 * 60, "You've been killed.");

	# This goes only to the avatar, and it tells them they are dying,
	# not dead.
	$this->msg("die", onlyto => $this);

	# Until the avatar is logged out, they still have the chance to
	# possibly run some command.
	my $log=$this->log;
	foreach my $session ($this->sessions->list) {
		next if $session == $log;
		$Mooix::Root->system->sessionmanager->logout(session => $session);
	}

	# Note that for some avatars (guests), we may never get here:
	# logout destroys them.

	# And now with them logged out, it is safe to tell everyone they
	# died.
	$this->msg("die", skip => $this);
}
