--- deliantra/server/ext/follow.ext 2007/10/08 14:00:29 1.11 +++ deliantra/server/ext/follow.ext 2007/10/08 14:32:44 1.12 @@ -9,36 +9,34 @@ my %follow; my $timer = Event->timer (interval => 0.2, parked => 1, data => cf::WF_AUTOCANCEL, cb => sub { - cf::sync_job { - while (my ($name, $v) = each %follow) { - my ($target, $his, $mine) = @$v; - my ($who, $other) = (cf::player::find_active $name, cf::player::find_active $target); - - if ($who && $other && $other->ob->map) { - my ($map, $x, $y) = ($other->ob->map->path, $other->ob->x, $other->ob->y); - - if ($map ne $his->[0] || $x != $his->[1] || $y != $his->[2]) { - @$mine = @$his; - @$his = ($map, $x, $y); - } - - my $map; - - if ($map = cf::map::find $mine->[0] - and $map =~ /^\// # short-gap fix - and !grep +($_->flag (cf::FLAG_UNIQUE) || $_->type == cf::SHOP_FLOOR) && $_->flag (cf::FLAG_IS_FLOOR), - $map->at ($mine->[1], $mine->[2])) { - $who->ob->goto (@$mine); - } else { - delete $follow{$name}; - $who->ob->message ("You can't follow $target anymore!"); - } + while (my ($name, $v) = each %follow) { + my ($target, $his, $mine) = @$v; + my ($who, $other) = (cf::player::find_active $name, cf::player::find_active $target); + + if ($who && $other && $other->ob->map) { + my ($map, $x, $y) = ($other->ob->map->path, $other->ob->x, $other->ob->y); + + if ($map ne $his->[0] || $x != $his->[1] || $y != $his->[2]) { + @$mine = @$his; + @$his = ($map, $x, $y); + } + + my $map; + + if ($map = cf::map::find $mine->[0] + and $map =~ /^\// # short-gap fix + and !grep +($_->flag (cf::FLAG_UNIQUE) || $_->type == cf::SHOP_FLOOR) && $_->flag (cf::FLAG_IS_FLOOR), + $map->at ($mine->[1], $mine->[2])) { + $who->ob->goto (@$mine); } else { delete $follow{$name}; - $who->ob->message ("$target is gone..."); + $who->ob->message ("You can't follow $target anymore!"); } + } else { + delete $follow{$name}; + $who->ob->message ("$target is gone..."); } - }; + } $_[0]->w->stop unless keys %follow; });