line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Lacuna::Task::Action::StarCacheUnknown; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1821
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
4
|
|
|
|
|
|
|
our $VERSION = $Games::Lacuna::Task::VERSION; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
425
|
use Moose -traits => 'NoAutomatic'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends qw(Games::Lacuna::Task::Action); |
8
|
|
|
|
|
|
|
with qw(Games::Lacuna::Task::Role::Stars); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use List::Util qw(min); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub description { |
13
|
|
|
|
|
|
|
return q[Builds the star cache for all solar systems which have not been checked yet]; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'coordinate' => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'Lacuna::Task::Type::Coordinate', |
19
|
|
|
|
|
|
|
documentation=> q[Coordinates for query center], |
20
|
|
|
|
|
|
|
coerce => 1, |
21
|
|
|
|
|
|
|
lazy_build => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'count' => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'Int', |
27
|
|
|
|
|
|
|
default => 1000, |
28
|
|
|
|
|
|
|
documentation=> 'Number of queries to be used for caching [Default: 1000]', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _build_coordinate { |
32
|
|
|
|
|
|
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $home_planet = $self->home_planet_id(); |
35
|
|
|
|
|
|
|
my $home_planet_data = $self->my_body_status($home_planet); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return [$home_planet_data->{x},$home_planet_data->{y}]; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub run { |
41
|
|
|
|
|
|
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $rpc_max = min($self->client->get_stash('rpc_count') + $self->count, int($self->client->get_stash('rpc_limit') * 0.9)); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$self->search_stars_callback( |
46
|
|
|
|
|
|
|
sub { |
47
|
|
|
|
|
|
|
my ($star_data) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
return 0 |
50
|
|
|
|
|
|
|
if $self->client->get_stash('rpc_count') > $rpc_max; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return 1; |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
is_probed => undef, |
55
|
|
|
|
|
|
|
x => $self->coordinate->[0], |
56
|
|
|
|
|
|
|
y => $self->coordinate->[0], |
57
|
|
|
|
|
|
|
distance => 1, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
64
|
|
|
|
|
|
|
no Moose; |
65
|
|
|
|
|
|
|
1; |