--- deliantra/server/ext/login.ext 2006/12/26 05:44:13 1.7 +++ deliantra/server/ext/login.ext 2006/12/27 15:04:38 1.8 @@ -62,7 +62,7 @@ . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; } -sub on_addme { +sub addme { my ($ns) = @_; $ns->destroy if $ns->pl; @@ -259,6 +259,7 @@ $ob->contr->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { if ($_[0] !~ /^[yY]/) { + $ob->contr->invoke (cf::EVENT_PLAYER_LOGOUT, 1); $ob->contr->ns->destroy; } else { $ob->contr->enable_save (1); @@ -267,5 +268,26 @@ }, ); -cf::client->attach (package => __PACKAGE__); +cf::player->attach ( + on_login => sub { + my ($pl) = @_; + my $name = $pl->ob->name; + + $_->ob->message ("$name has entered the game.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; + }, + on_logout => sub { + my ($pl, $cleanly) = @_; + my $name = $pl->ob->name; + + if ($cleanly) { + $_->ob->message ("$name left the game.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; + } else { + $_->ob->message ("$name uncerimoniously disconnected.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; + } + }, +); + +cf::client->attach ( + on_addme => \&addme, +);