ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/follow.ext
(Generate patch)

Comparing deliantra/maps/perl/follow.ext (file contents):
Revision 1.9 by root, Tue Feb 7 03:06:01 2006 UTC vs.
Revision 1.12 by root, Mon Mar 20 22:49:26 2006 UTC

2 2
3# TODO: skip arena 3# TODO: skip arena
4# TODO: check for player leaving 4# TODO: check for player leaving
5 5
6# implement a 'follow' command 6# implement a 'follow' command
7# don't follow on damned ground
7 8
8my %follow; 9my %follow;
9 10
10cf::register_command follow => 0, sub { 11cf::register_command follow => 0, sub {
11 my ($who, $args) = @_; 12 my ($who, $args) = @_;
43 44
44 return if $pl->ob->map->path eq $map 45 return if $pl->ob->map->path eq $map
45 && abs ($pl->ob->x - $x) <= 1 46 && abs ($pl->ob->x - $x) <= 1
46 && abs ($pl->ob->y - $y) <= 1; 47 && abs ($pl->ob->y - $y) <= 1;
47 48
48 my $portal = cf::object::new ("exit"); 49 my $portal = cf::object::new "exit";
49 50
50 $portal->set_slaying ($map); 51 $portal->set_slaying ($map);
51 $portal->set_hp ($x); 52 $portal->set_hp ($x);
52 $portal->set_sp ($y); 53 $portal->set_sp ($y);
53 54
54 $portal->apply ($pl->ob); 55 $portal->apply ($pl->ob);
55 56
56 $portal->free; 57 $portal->free;
58}
59
60sub on_player_death {
61 my ($event) = @_;
62
63 my $ob = $event->{who};
64 my $name = $ob->name;
65
66 delete $follow->{$name};
67
68 while (my ($name, $v) = each %follow) {
69 if ($v->[0] eq $name) {
70 delete $follow{$name};
71 }
72 }
73
74 0
57} 75}
58 76
59sub on_clock { 77sub on_clock {
60 my ($event) = @_; 78 my ($event) = @_;
61 79

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines