NAME
Games::Lacuna::Task::Role::Ships - Helper methods for fetching and building ships
SYNOPSIS
package Games::Lacuna::Task::Action::MyTask;
use Moose;
extends qw(Games::Lacuna::Task::Action);
with qw(Games::Lacuna::Task::Role::Ships);
DESCRIPTION
This role provides ship-related helper methods.
METHODS
get_ships
my @avaliable_scows = $self->get_ships(
planet => $planet_stats,
ships_needed => 3, # get three
ship_type => 'scow',
);
Tries to fetch the given number of available ships. If there are not enough ships available then the required number of ships are built.
The following arguments are accepted
planet
Planet data has [Required]
ships_needed
Number of required ships. If ships_needed is a negative number it will return all matching ships and build as many new ships as possible while keeping ships_needed * -1 space port slots free [Required]
ship_type
Ship type [Required]
travelling
If true will not build new ships if there are matchig ships currently travelling
name_prefix
Will only return ships with the given prefix in their names. Newly built ships will be renamed to add the prefix.
trade_ships
my $trade_ship_id = $self->trade_ships($body_id,$cargo);
Returns a ship that can transport the required quantity of cargo
push_ships
$self->push_ships($from_body_id,$to_body_id,\@ships);
Pushes the selected ships from one body to another