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

Comparing deliantra/server/ext/cfplus.ext (file contents):
Revision 1.13 by root, Fri Sep 19 01:39:45 2008 UTC vs.
Revision 1.15 by root, Mon Oct 26 02:34:37 2009 UTC

85 85
86cf::register_extcmd npc_dialog_begin => sub { 86cf::register_extcmd npc_dialog_begin => sub {
87 my ($pl, $id, $token) = @_; 87 my ($pl, $id, $token) = @_;
88 88
89 #TODO: 89 #TODO:
90 # this is not a request, so returnign does no good: make it a request and die on error 90 # this is not a request, so returning does no good: make it a request and die on error
91 91
92 return unless $pl->ob && $pl->ob->map; 92 return unless $pl->ob && $pl->ob->map;
93 93
94 my ($name, $dx, $dy) = @$token; 94 my ($name, $dx, $dy) = @$token;
95 95
190 my ($pl) = @_; 190 my ($pl) = @_;
191 191
192 delete $pl->{npc_dialog}; 192 delete $pl->{npc_dialog};
193 $pl->detach ("npc_dialog_active"); 193 $pl->detach ("npc_dialog_active");
194 }, 194 },
195 on_map_change => sub {
196 my ($pl) = @_;
197
198 my $dialog = delete $pl->{npc_dialog}
199 or return;
200
201 $pl->ext_msg ($dialog->{id} => error => "out of range");
202 $pl->detach ("npc_dialog_active");
203 },
195 on_move => sub { 204 on_move => sub {
196 my ($pl, $dir) = @_; 205 my ($pl, $dir) = @_;
197 206
198 # must delay a bit :/ 207 # must delay a bit :/
199 my $delay; $delay = EV::timer 0, 0, sub { 208 my $delay; $delay = EV::timer 0, 0, sub {
202 if (my $dialog = $pl->{npc_dialog}) { 211 if (my $dialog = $pl->{npc_dialog}) {
203 my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc}); 212 my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc});
204 213
205 return if (abs $dx) <= 2 && (abs $dy) <= 2; 214 return if (abs $dx) <= 2 && (abs $dy) <= 2;
206 215
216 delete $pl->{npc_dialog};
207 $pl->ext_msg ($dialog->{id} => error => "out of range"); 217 $pl->ext_msg ($dialog->{id} => error => "out of range");
218 $pl->detach ("npc_dialog_active");
208 } 219 }
209
210 delete $pl->{npc_dialog};
211 $pl->detach ("npc_dialog_active");
212 }; 220 };
213 }, 221 },
214; 222;
215 223
216cf::player->attach ( 224cf::player->attach (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines