ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/commands.ext
(Generate patch)

Comparing deliantra/server/ext/commands.ext (file contents):
Revision 1.27 by pippijn, Fri Mar 2 11:41:14 2007 UTC vs.
Revision 1.28 by pippijn, Fri Mar 2 12:14:57 2007 UTC

113 unless $ob->flag (cf::FLAG_USE_WEAPON); 113 unless $ob->flag (cf::FLAG_USE_WEAPON);
114 114
115 1 115 1
116}; 116};
117 117
118cf::register_command mark => sub {
119 my ($pl, $arg) = @_;
120
121 if (!$arg) {
122 my $ob = $pl->find_marked_object;
123
124 $pl->reply (undef, $ob
125 ? (sprintf "%s %s * is marked.", $ob->name, $ob->title)
126 : "You have no marked object.");
127 } else {
128 my $ob = $pl->find_best_object_match ($arg);
129
130 return $pl->reply (undef, "Could not find an object that matches $arg")
131 unless $ob;
132
133 $pl->contr->mark = $ob;
134 $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title));
135 }
136
137 1
138};
139
118cf::register_command who => sub { 140cf::register_command who => sub {
119 my ($ob, $arg) = @_; 141 my ($ob, $arg) = @_;
120 142
121 $ob->speed_left ($ob->speed_left - 0.25); 143 $ob->speed_left ($ob->speed_left - 0.25);
122 144
123 $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); 145 $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE);
124 146
125 1 147 1
126}; 148};
149
150for my $cmd ("run", "fire") {
151 my $oncmd = "${cmd}_on";
152 cf::register_command $cmd => sub {
153 my ($ob, $arg) = @_;
154
155 return $ob->reply (undef, "Can't $cmd into a non adjacent square.")
156 if $arg < 0 or $arg >= 9;
157
158 $ob->contr->$oncmd (1);
159 $ob->move ($arg);
160
161 1
162 };
163
164 cf::register_command "${cmd}_stop" => sub {
165 my ($ob) = @_;
166
167 $ob->contr->$oncmd (0);
168
169 1
170 };
171}
127 172
128cf::register_command mapinfo => sub { 173cf::register_command mapinfo => sub {
129 my ($ob) = @_; 174 my ($ob) = @_;
130 175
131 my $map = $ob->map 176 my $map = $ob->map

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines