--- deliantra/server/ext/commands.ext 2007/03/16 02:37:54 1.36 +++ deliantra/server/ext/commands.ext 2007/04/25 18:47:50 1.41 @@ -89,6 +89,29 @@ 1 }; +cf::register_command seen => sub { + my ($pl, $args) = @_; + + if (my ($login) = $args =~ /(\S+)/) { + if ($login eq $pl->name) { + $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_UNIQUE); + } elsif (cf::player::find_active $login) { + $pl->message ("$login is right here on this server!", cf::NDI_UNIQUE); + } elsif (cf::player::exists $login + and stat cf::player::path $login) { + my $time = (stat _)[9]; + + $pl->message ("$login was last seen here " + . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) + . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_UNIQUE); + } else { + $pl->message ("No player named $login is known to me.", cf::NDI_UNIQUE); + } + } else { + $pl->message ("Usage: seen ", cf::NDI_UNIQUE); + } +}; + cf::register_command body => sub { my ($ob) = @_; @@ -137,16 +160,6 @@ 1 }; -cf::register_command who => sub { - my ($ob, $arg) = @_; - - $ob->speed_left ($ob->speed_left - 0.25); - - $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); - - 1 -}; - for my $cmd ("run", "fire") { my $oncmd = "${cmd}_on"; cf::register_command $cmd => sub { @@ -265,7 +278,8 @@ return $ob->reply (undef, sprintf "Output rate is presently %dbps.", $ob->contr->ns->max_rate / $cf::TICK) unless $arg > 0; - $ob->contr->ns->max_rate ($arg * $cf::TICK); + # minimum is 2k/s + $ob->contr->ns->max_rate ((List::Util::max 2048, $arg) * $cf::TICK); $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $cf::TICK); 1 @@ -277,6 +291,8 @@ return $ob->reply (undef, "Output count is presently " . $ob->contr->outputs_count) unless $arg > 0; + $arg = 4 if $arg < 4; + $ob->contr->outputs_count ($arg); $ob->reply (undef, "Output count now set to " . $ob->contr->outputs_count); @@ -286,11 +302,13 @@ cf::register_command 'output-sync' => sub { my ($ob, $arg) = @_; - return $ob->reply (undef, "Output sync time is presently " . $ob->contr->outputs_sync) - unless $arg > 0; + return $ob->reply (undef, sprintf "Output sync time is presently %.1fs", $ob->contr->outputs_sync * $cf::TICK) + unless length $arg; + + $arg = 0.5 if $arg < 0.5; - $ob->contr->outputs_sync ($arg); - $ob->reply (undef, "Output sync time now set to " . $ob->contr->outputs_sync); + $ob->contr->outputs_sync ($arg / $cf::TICK); + $ob->reply (undef, sprintf "Output sync time now set to %.1fs", $ob->contr->outputs_sync * $cf::TICK); 1 };