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.16 by root, Tue Mar 16 20:28:22 2010 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
171=cut 171=cut
172 172
173cf::register_extcmd editor_support => sub { 173cf::register_extcmd editor_support => sub {
174 my ($pl, %msg) = @_; 174 my ($pl, %msg) = @_;
175 175
176 map +($_ => $cf::CFG{"editor_$_"}), qw(servertype gameserver testserver cvs_root lib_root builder_ui) 176 my %cfg = map +($_ => $cf::CFG{"editor_$_"}), qw(servertype servertypes gameserver testserver cvs_root lib_root builder_ui);
177
178 # clients 2.10 and below check for type and "nameserver" :/
179 $cfg{type} = $cfg{servertype};
180 $cfg{nameserver} = $cfg{gameserver};
181
182 %cfg
177}; 183};
178 184
179sub unload { 185sub unload {
180 for my $pl (cf::player::list) { 186 for my $pl (cf::player::list) {
181 if (my $dialog = delete $pl->{npc_dialog}) { 187 if (my $dialog = delete $pl->{npc_dialog}) {
190 my ($pl) = @_; 196 my ($pl) = @_;
191 197
192 delete $pl->{npc_dialog}; 198 delete $pl->{npc_dialog};
193 $pl->detach ("npc_dialog_active"); 199 $pl->detach ("npc_dialog_active");
194 }, 200 },
201 on_map_change => sub {
202 my ($pl) = @_;
203
204 my $dialog = delete $pl->{npc_dialog}
205 or return;
206
207 $pl->ext_msg ($dialog->{id} => error => "out of range");
208 $pl->detach ("npc_dialog_active");
209 },
195 on_move => sub { 210 on_move => sub {
196 my ($pl, $dir) = @_; 211 my ($pl, $dir) = @_;
197 212
198 # must delay a bit :/ 213 # must delay a bit :/
199 my $delay; $delay = EV::timer 0, 0, sub { 214 my $delay; $delay = EV::timer 0, 0, sub {
202 if (my $dialog = $pl->{npc_dialog}) { 217 if (my $dialog = $pl->{npc_dialog}) {
203 my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc}); 218 my (undef, $dx, $dy) = $pl->ob->rangevector ($dialog->{npc});
204 219
205 return if (abs $dx) <= 2 && (abs $dy) <= 2; 220 return if (abs $dx) <= 2 && (abs $dy) <= 2;
206 221
222 delete $pl->{npc_dialog};
207 $pl->ext_msg ($dialog->{id} => error => "out of range"); 223 $pl->ext_msg ($dialog->{id} => error => "out of range");
224 $pl->detach ("npc_dialog_active");
208 } 225 }
209
210 delete $pl->{npc_dialog};
211 $pl->detach ("npc_dialog_active");
212 }; 226 };
213 }, 227 },
214; 228;
215 229
216cf::player->attach ( 230cf::player->attach (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines