… | |
… | |
35 | sub start_follow_handler { |
35 | sub start_follow_handler { |
36 | $FOLLOW_HANDLER = cf::async_ext { |
36 | $FOLLOW_HANDLER = cf::async_ext { |
37 | $Coro::current->{desc} = "follow handler"; |
37 | $Coro::current->{desc} = "follow handler"; |
38 | |
38 | |
39 | while () { |
39 | while () { |
40 | cf::wait_for_tick; |
40 | $cf::WAIT_FOR_TICK->wait; |
41 | |
41 | |
42 | for (values %FOLLOW) { |
42 | for (values %FOLLOW) { |
43 | my ($who, $target, $queue) = @$_; |
43 | my ($who, $target, $queue) = @$_; |
44 | |
44 | |
45 | $target->active |
45 | $target->active |
… | |
… | |
55 | || $y != $queue->[-1][2]; |
55 | || $y != $queue->[-1][2]; |
56 | |
56 | |
57 | # try to move to oldest position |
57 | # try to move to oldest position |
58 | if (@$queue > $MAX_QUEUE) { |
58 | if (@$queue > $MAX_QUEUE) { |
59 | $who->message ($target->name . " is too far away - you can't follow anymore!"); |
59 | $who->message ($target->name . " is too far away - you can't follow anymore!"); |
60 | unfollow $target->name; |
60 | unfollow $who->name; |
61 | } elsif (@$queue) { |
61 | } elsif (@$queue) { |
62 | my ($map, $x, $y) = @{ $queue->[0] }; |
62 | my ($map, $x, $y) = @{ $queue->[0] }; |
63 | |
63 | |
64 | $map->load; |
64 | $map->load; |
65 | |
65 | |