NAME
Games::Lacuna::Task::Role::Stars - Astronomy helper methods
SYNOPSIS
package Games::Lacuna::Task::Action::MyTask;
use Moose;
extends qw(Games::Lacuna::Task::Action);
with qw(Games::Lacuna::Task::Role::Stars);
DESCRIPTION
This role provides astronomy-related helper methods.
METHODS
get_star
$star_data = $self->get_star($star_id);
Fetches star data from the API or local cache for the given star id
get_star_by_name
$star_data = $self->get_star_by_name($star_name);
Fetches star data from the API or local cache for the given star name
get_star_by_xy
$star_data = $self->get_star_by_name($x,$y);
Fetches star data from the API or local cache for the given star coordinates
fetch_all_stars
$self->fetch_all_stars();
Populates the star cache. Usually takes several minutes to complete and thus should not be called regularly.
get_body_by_id
$body_data = $self->get_body_by_id($body_id);
Fetches body data from the local cache for the given body id
get_body_by_name
$body_data = $self->get_body_by_name($body_name);
Fetches body data from the local cache for the given body name Ignores case and accents so that eg. 'Hà Nôi' equals 'HA NOI'.
get_body_by_xy
$body_data = $self->get_body_by_name($x,$y);
Fetches body data from the local cache for the given body coordinates
set_body_excavated
$self->set_body_excavated($body_id,$is_excavated);
Mark body as excavated
set_star_cache
$self->set_star_cache($api_star_data);
Create star cache for given api response data
search_stars_callback
$self->search_stars_callback(
sub {
my $star_data = shift;
...
},
%search_params
);
Searches all stars acording to the given search parameters and executes the callback for every matching star.
Valid search options are
is_probed (0 = unprobed, 1 = probed)
is_known (0 = body data not available, 1 = body data available)
max_distance
min_distance
distance (1 = ascending, 0 = descending)
zone
x,y (refernce coordinates for distance calculations)