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.1 by root, Fri Dec 15 19:29:18 2006 UTC vs.
Revision 1.4 by root, Mon Apr 2 18:04:45 2007 UTC

23cf::register_extcmd cfplus_support => sub { 23cf::register_extcmd cfplus_support => sub {
24 my ($pl, $msg) = @_; 24 my ($pl, $msg) = @_;
25 25
26 # $msg->{version} 26 # $msg->{version}
27 27
28 (
28 (version => 2) 29 version => 2,
30 )
29}; 31};
30 32
31my %dialog; # currently active dialogs 33my %dialog; # currently active dialogs
32 34
33my $timer = Event->timer (interval => 0.2, parked => 1, data => cf::WF_AUTOCANCEL, cb => sub { 35my $timer = Event->timer (interval => 0.2, parked => 1, data => cf::WF_AUTOCANCEL, cb => sub {
65=cut 67=cut
66 68
67cf::register_extcmd lookat => sub { 69cf::register_extcmd lookat => sub {
68 my ($pl, $msg) = @_; 70 my ($pl, $msg) = @_;
69 my ($dx, $dy) = @$msg{qw(dx dy)}; 71 my ($dx, $dy) = @$msg{qw(dx dy)};
72
73 return unless $pl->ob && $pl->ob->map;
70 74
71 my $near = (abs $dx) <= 2 && (abs $dy) <= 2; 75 my $near = (abs $dx) <= 2 && (abs $dy) <= 2;
72 76
73 my %res; 77 my %res;
74 78
96 100
97cf::register_extcmd npc_dialog_begin => sub { 101cf::register_extcmd npc_dialog_begin => sub {
98 my ($pl, $msg) = @_; 102 my ($pl, $msg) = @_;
99 my ($id, $dx, $dy) = @$msg{qw(msgid dx dy)}; 103 my ($id, $dx, $dy) = @$msg{qw(msgid dx dy)};
100 104
105 return unless $pl->ob && $pl->ob->map;
101 return unless (abs $dx) <= 2 && (abs $dy) <= 2; 106 return unless (abs $dx) <= 2 && (abs $dy) <= 2;
102 return unless $pl->cell_visible ($dx, $dy); 107 return unless $pl->cell_visible ($dx, $dy);
103 108
104 for my $npc ($pl->ob->map->at ($pl->ob->x + $dx, $pl->ob->y + $dy)) { 109 for my $npc ($pl->ob->map->at ($pl->ob->x + $dx, $pl->ob->y + $dy)) {
105 if (NPC_Dialogue::has_dialogue $npc) { 110 if (NPC_Dialogue::has_dialogue $npc) {
146 delete $dialog{$msg->{msgid}}; 151 delete $dialog{$msg->{msgid}};
147 152
148 () 153 ()
149}; 154};
150 155
151cf::attach_to_players 156cf::player->attach (
152 on_logout => sub { 157 on_logout => sub {
153 my ($pl) = @_; 158 my ($pl) = @_;
154 159
155 delete $dialog{$_} for grep $pl->ob == $dialog{$_}{ob}, keys %dialog; 160 delete $dialog{$_} for grep $pl->ob == $dialog{$_}{ob}, keys %dialog;
156 }, 161 },
157; 162);
158 163
159=item ... = extcmd editor_support 164=item ... = extcmd editor_support
160 165
161Returns the value required by clients that have an editor to download and 166Returns the value required by clients that have an editor to download and
162upload maps from/to the server. 167upload maps from/to the server.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines