--- deliantra/server/ext/commands.ext 2007/03/02 14:44:52 1.31 +++ deliantra/server/ext/commands.ext 2007/03/14 15:44:47 1.35 @@ -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,6 +126,12 @@ $pl->contr->mark ($ob); $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); + } else { + my $ob = $pl->find_marked_object; + + $pl->reply (undef, $ob + ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) + : "You have no marked object."); } 1 @@ -152,15 +152,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 +258,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) = @_;