… | |
… | |
194 | }, |
194 | }, |
195 | on_move => sub { |
195 | on_move => sub { |
196 | my ($pl, $dir) = @_; |
196 | my ($pl, $dir) = @_; |
197 | |
197 | |
198 | # must delay a bit :/ |
198 | # must delay a bit :/ |
199 | Event->timer (after => 0, cb => sub { |
199 | my $delay; $delay = EV::timer 0, 0, sub { |
200 | $_[0]->w->cancel; |
200 | undef $delay; |
201 | |
201 | |
202 | if (my $dialog = $pl->{npc_dialog}) { |
202 | if (my $dialog = $pl->{npc_dialog}) { |
203 | my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc}); |
203 | my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc}); |
204 | |
204 | |
205 | return if (abs $dx) <= 2 && (abs $dy) <= 2; |
205 | return if (abs $dx) <= 2 && (abs $dy) <= 2; |
… | |
… | |
207 | $pl->ext_msg ($dialog->{id} => error => "out of range"); |
207 | $pl->ext_msg ($dialog->{id} => error => "out of range"); |
208 | } |
208 | } |
209 | |
209 | |
210 | delete $pl->{npc_dialog}; |
210 | delete $pl->{npc_dialog}; |
211 | $pl->detach ("npc_dialog_active"); |
211 | $pl->detach ("npc_dialog_active"); |
212 | }); |
212 | }; |
213 | }, |
213 | }, |
214 | ; |
214 | ; |
215 | |
215 | |
216 | cf::player->attach ( |
216 | cf::player->attach ( |
217 | on_login => sub { |
217 | on_login => sub { |