--- deliantra/server/ext/commands.ext 2007/03/02 14:44:52 1.31 +++ deliantra/server/ext/commands.ext 2007/03/17 22:52:32 1.37 @@ -1,4 +1,4 @@ -#! perl +#! perl # MANDATORY use POSIX (); @@ -118,13 +118,7 @@ cf::register_command mark => sub { my ($pl, $arg) = @_; - unless (length $arg) { - my $ob = $pl->find_marked_object; - - $pl->reply (undef, $ob - ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) - : "You have no marked object."); - } else { + if (length $arg) { my $ob = $pl->find_best_object_match ($arg); return $pl->reply (undef, "Could not find an object that matches $arg") @@ -132,17 +126,13 @@ $pl->contr->mark ($ob); $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); - } - - 1 -}; - -cf::register_command who => sub { - my ($ob, $arg) = @_; - - $ob->speed_left ($ob->speed_left - 0.25); + } else { + my $ob = $pl->find_marked_object; - $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); + $pl->reply (undef, $ob + ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) + : "You have no marked object."); + } 1 }; @@ -152,15 +142,15 @@ cf::register_command $cmd => sub { my ($ob, $arg) = @_; - return $ob->reply (undef, "Can't $cmd into a non adjacent square.") + $ob->reply (undef, "Can't $cmd into a non adjacent square.") if $arg < 0 or $arg >= 9; $ob->contr->$oncmd (1); - $ob->move ($arg); + $ob->move_player ($arg); 1 }; - + cf::register_command "${cmd}_stop" => sub { my ($ob) = @_; @@ -258,6 +248,18 @@ 1 }; + +cf::register_command 'output-rate' => sub { + my ($ob, $arg) = @_; + + 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); + $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $cf::TICK); + + 1 +}; cf::register_command 'output-count' => sub { my ($ob, $arg) = @_;