Games-Lacuna-Client
view release on metacpan or search on metacpan
examples/build_scheduled.pl view on Meta::CPAN
# check for bad dependencies
if (grep {$failed_jobs{$_}} @{$build_order->{dependent_on}}) {
output("Depends on failed job. Removing.");
$failed_jobs{$name} = 1;
splice(@$current_work, $ibuild, 1);
$ibuild--;
next;
}
# check for known (currently) bad planets
if ($tainted_planets{ $build_order->{planet} }) {
output("Planet busy, skipping.");
next;
}
my $planet_name = $build_order->{planet};
my $planet = $planets_by_name{$planet_name};
if (not $checked_planets{$planet_name}) {
# This needs better API (understanding)
#my $buildable = $planet->get_buildable(0, 0, 'Storage');
#if ($buildable->{build_queue}{max} <= $buildable->{build_queue}{current}) {
examples/glyph_run.pl view on Meta::CPAN
my $arch_id = first {
$buildings->{$_}->{url} eq '/archaeology'
} keys %$buildings;
next unless $arch_id;
my $building = $client->building( id => $arch_id, type => '/archaeology' );
next unless $building;
if ($buildings->{$arch_id}->{work})
{
print "Skipping '$planet_name' as it is busy working\n";
next;
}
my $buildingOre = $building->get_ores_available_for_processing();
my $searching = 0;
foreach my $ore (@glyphs)
{
next unless $buildingOre->{ore}->{$ore};
my $return;
examples/wr.pl view on Meta::CPAN
}
sub update_wr {
my $wr = shift;
my $iwr = shift;
output("checking WR stats for WR $iwr");
my $wr_stat = $wr->view;
my $busy_seconds = $wr_stat->{building}{work}{seconds_remaining};
if ($busy_seconds) {
output("Still busy for $busy_seconds, waiting");
return $busy_seconds+3;
}
output("Checking resource stats");
my $pstatus = $wr_stat->{status}{body} or die "Could not get planet status via \$struct->{status}{body}: " . Dumper($wr_stat);
my $waste = $pstatus->{waste_stored};
if (not $waste or $waste < 100) {
output("(virtually) no waste has accumulated, waiting");
return 5*MINUTE;
}
lib/Games/Lacuna/Client/Governor/Archaeology.pm view on Meta::CPAN
my ($arch) = $gov->find_buildings('Archaeology');
if (not defined $arch) {
warning("There is no Archaeology Ministry on ".$gov->{planet_names}->{$pid});
return;
}
if ( my $time = $gov->building_details($pid,$arch->{building_id})->{work}{seconds_remaining} ){
$gov->set_next_action_if_sooner( $time );
warning("The Archaeology Ministry on ".$gov->{planet_names}->{$pid}." is busy.");
return;
}
my %ore_avail = %{$arch->get_ores_available_for_processing->{ore}};
my @ores = keys %ore_avail;
if (defined $cfg->{archaeology}->{search_only}) {
@ores = grep { my $o = $_; any { $o eq $_ } @{$cfg->{archaeology}->{search_only}} } @ores;
}
if (defined $cfg->{archaeology}->{do_not_search}) {
( run in 0.305 second using v1.01-cache-2.11-cpan-87723dcf8b7 )