diff --git a/lib/Lacuna/Role/Ship/Send/LoadWithSpies.pm b/lib/Lacuna/Role/Ship/Send/LoadWithSpies.pm index b721b409..331c812d 100644 --- a/lib/Lacuna/Role/Ship/Send/LoadWithSpies.pm +++ b/lib/Lacuna/Role/Ship/Send/LoadWithSpies.pm @@ -29,14 +29,16 @@ sub get_available_spies_to_send { my $self = shift; my $body = $self->body; my $on_body = $self->direction eq 'out' ? $self->body : $self->foreign_body; - my $spies = Lacuna->db->resultset('Lacuna::DB::Result::Spies')->search( - {task => ['in','Idle','Training'], on_body_id=>$on_body->id, empire_id=>$body->empire->id}, - ); my @spies; - while (my $spy = $spies->next) { - if ($spy->is_available) { - push @spies, $spy; - last if (scalar(@spies) >= $self->max_occupants); + if ($on_body) { + my $spies = Lacuna->db->resultset('Lacuna::DB::Result::Spies')->search( + {task => ['in','Idle','Training'], on_body_id=>$on_body->id, empire_id=>$body->empire->id}, + ); + while (my $spy = $spies->next) { + if ($spy->is_available) { + push @spies, $spy; + last if (scalar(@spies) >= $self->max_occupants); + } } } return \@spies; -- 2.51.2 From 4c1ce98803afefff205d67ed0c1899c7da3edb86 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Tue, 15 Mar 2011 23:16:11 -0500 Subject: [PATCH 2/4] Allow Spy Pods to show up as available in get_ships_for results --- var/www/public/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index f2d1c58e..2ea2a92d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -7,6 +7,7 @@ - Fix: Space stations now count against your next colony cost while in transit. - Fix: Added missing Malcud Field, Ravine, Lapis Forest, and Beeldeban Nest API docs. - Rule: Only ships that are performing hostile actions will trigger captchas. + - Fix: Allow Spy Pods to show up as available in get_ships_for results. 3.0001 - Add: Added Space Station Lab building, which will eventually allow building space station modules. -- 2.51.2 From 2d976e4fafbb2393fab718cdb6400c6d25277957 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 16 Mar 2011 22:51:32 -0500 Subject: [PATCH 3/4] Added Amalgus Meadow and Denton Brambles glyph buildings. --- bin/lacuna.psgi | 2 + docs/AmalgusMeadow.pod | 8 +++ docs/Buildings.pod | 4 ++ docs/DentonBrambles.pod | 9 ++++ lib/Lacuna/DB/Result/Building.pm | 2 + lib/Lacuna/DB/Result/Building/Archaeology.pm | 6 +++ .../Building/Permanent/AmalgusMeadow.pm | 54 +++++++++++++++++++ .../Building/Permanent/DentonBrambles.pm | 54 +++++++++++++++++++ lib/Lacuna/DB/Result/Medals.pm | 2 + lib/Lacuna/RPC/Building/AmalgusMeadow.pm | 17 ++++++ lib/Lacuna/RPC/Building/DentonBrambles.pm | 17 ++++++ var/www/public/changes.txt | 3 ++ var/www/public/resources.json | 2 + 13 files changed, 180 insertions(+) create mode 100644 docs/AmalgusMeadow.pod create mode 100644 docs/DentonBrambles.pod create mode 100644 lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm create mode 100644 lib/Lacuna/DB/Result/Building/Permanent/DentonBrambles.pm create mode 100644 lib/Lacuna/RPC/Building/AmalgusMeadow.pm create mode 100644 lib/Lacuna/RPC/Building/DentonBrambles.pm diff --git a/bin/lacuna.psgi b/bin/lacuna.psgi index 5ccb573f..fe84cf47 100644 --- a/bin/lacuna.psgi +++ b/bin/lacuna.psgi @@ -213,6 +213,8 @@ my $app = builder { Lacuna::RPC::Building::SSLb Lacuna::RPC::Building::SSLc Lacuna::RPC::Building::SSLd + Lacuna::RPC::Building::AmalgusMeadow + Lacuna::RPC::Building::DentonBrambles )) { mount $building->new->to_app_with_url; } diff --git a/docs/AmalgusMeadow.pod b/docs/AmalgusMeadow.pod new file mode 100644 index 00000000..4337444c --- /dev/null +++ b/docs/AmalgusMeadow.pod @@ -0,0 +1,8 @@ +=head1 Amalgus Meadow Methods + +Amalgus Meadow is accessible via the URL C. + +The list of methods below represents changes and additions to the methods that all L share. + +=cut + diff --git a/docs/Buildings.pod b/docs/Buildings.pod index 279f3345..9369accd 100644 --- a/docs/Buildings.pod +++ b/docs/Buildings.pod @@ -283,6 +283,8 @@ Below is a list of the different types of structures that can be built on planet =item L +=item L + =item L =item L @@ -325,6 +327,8 @@ Below is a list of the different types of structures that can be built on planet =item L +=item L + =item L =item L diff --git a/docs/DentonBrambles.pod b/docs/DentonBrambles.pod new file mode 100644 index 00000000..30d88992 --- /dev/null +++ b/docs/DentonBrambles.pod @@ -0,0 +1,9 @@ +=head1 Denton Brambles Methods + +Denton Brambles is accessible via the URL C. + +The list of methods below represents changes and additions to the methods that all L share. + +=cut + + diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index c29399d9..e8646a8c 100644 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -1055,6 +1055,8 @@ sub spend_efficiency { 'Lacuna::DB::Result::Building::Module::IBS' => 'Lacuna::DB::Result::Building::Module::IBS', 'Lacuna::DB::Result::Building::Module::Warehouse' => 'Lacuna::DB::Result::Building::Module::Warehouse', 'Lacuna::DB::Result::Building::Module::Parliament' => 'Lacuna::DB::Result::Building::Module::Parliament', + 'Lacuna::DB::Result::Building::Permanent::AmalgusMeadow' => 'Lacuna::DB::Result::Building::Permanent::AmalgusMeadow', + 'Lacuna::DB::Result::Building::Permanent::DentonBrambles' => 'Lacuna::DB::Result::Building::Permanent::DentonBrambles', }); } diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index e4ef28d9..0102b344 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -151,6 +151,9 @@ my %recipies = ( }, }, }, + trona => { + plan => 'Lacuna::DB::Result::Building::Permanent::AmalgusMeadow', + }, }, chalcopyrite=> { plan => 'Lacuna::DB::Result::Building::Permanent::Lagoon', @@ -316,6 +319,9 @@ my %recipies = ( }, }, }, + goethite => { + plan => 'Lacuna::DB::Result::Building::Permanent::DentonBrambles', + }, }, sulfur => { methane => { diff --git a/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm b/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm new file mode 100644 index 00000000..e9e9fb74 --- /dev/null +++ b/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm @@ -0,0 +1,54 @@ +package Lacuna::DB::Result::Building::Permanent::AmalgusMeadow; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Building::Permanent'; + +use constant controller_class => 'Lacuna::RPC::Building::AmalgusMeadow'; + +around can_build => sub { + my ($orig, $self, $body) = @_; + if ($body->get_plan(__PACKAGE__, 1)) { + return $orig->($self, $body); + } + confess [1013,"You can't build an Amalgus Meadow. It forms naturally."]; +}; + +around can_upgrade => sub { + my ($orig, $self) = @_; + if ($self->body->get_plan(__PACKAGE__, $self->level + 1)) { + return $orig->($self); + } + confess [1013,"You can't upgrade an Amalgus Meadow. It forms naturally."]; +}; + +use constant image => 'amalgusmeadow'; + +sub image_level { + my ($self) = @_; + return $self->image.'1'; +} + +after finish_upgrade => sub { + my $self = shift; + $self->body->add_news(30, sprintf('Children everywhere on %s where heard singing "Beans, beans, the music fruit" after they discovered an Amalgus Meadow today.', $self->body->name)); +}; + +use constant min_orbit => 4; +use constant max_orbit => 4; +use constant name => 'Amalgus Meadow'; +use constant bean_production => 4000; +use constant time_to_build => 0; +use constant max_instances_per_planet => 1; + +around produces_food_items => sub { + my ($orig, $class) = @_; + my $foods = $orig->($class); + push @{$foods}, qw(bean); + return $foods; +}; + + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/DB/Result/Building/Permanent/DentonBrambles.pm b/lib/Lacuna/DB/Result/Building/Permanent/DentonBrambles.pm new file mode 100644 index 00000000..a0b57726 --- /dev/null +++ b/lib/Lacuna/DB/Result/Building/Permanent/DentonBrambles.pm @@ -0,0 +1,54 @@ +package Lacuna::DB::Result::Building::Permanent::DentonBrambles; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Building::Permanent'; + +use constant controller_class => 'Lacuna::RPC::Building::DentonBrambles'; + +around can_build => sub { + my ($orig, $self, $body) = @_; + if ($body->get_plan(__PACKAGE__, 1)) { + return $orig->($self, $body); + } + confess [1013,"You can't build Denton Brambles. They form naturally."]; +}; + +around can_upgrade => sub { + my ($orig, $self) = @_; + if ($self->body->get_plan(__PACKAGE__, $self->level + 1)) { + return $orig->($self); + } + confess [1013,"You can't upgrade Denton Brambles. They form naturally."]; +}; + +use constant image => 'dentonbrambles'; + +sub image_level { + my ($self) = @_; + return $self->image.'1'; +} + +after finish_upgrade => sub { + my $self = shift; + $self->body->add_news(30, sprintf('Tender and juicy denton roots await those souls of %s who are brave enough to tackle the Denton Brambles.', $self->body->name)); +}; + +use constant min_orbit => 5; +use constant max_orbit => 6; +use constant name => 'Denton Brambles'; +use constant bean_production => 4000; +use constant time_to_build => 0; +use constant max_instances_per_planet => 1; + +around produces_food_items => sub { + my ($orig, $class) = @_; + my $foods = $orig->($class); + push @{$foods}, qw(root); + return $foods; +}; + + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/DB/Result/Medals.pm b/lib/Lacuna/DB/Result/Medals.pm index ee1f13eb..ab819c3d 100644 --- a/lib/Lacuna/DB/Result/Medals.pm +++ b/lib/Lacuna/DB/Result/Medals.pm @@ -317,6 +317,8 @@ use constant MEDALS => { LuxuryHousing => 'Built Luxury Housing', MissionCommand => 'Built Mission Command', CloakingLab => 'Built Cloaking Lab', + AmalgusMeadow => 'Discovered an Amalgus Meadow', + DentonBrambles => 'Discovered Denton Brambles', }; sub name { diff --git a/lib/Lacuna/RPC/Building/AmalgusMeadow.pm b/lib/Lacuna/RPC/Building/AmalgusMeadow.pm new file mode 100644 index 00000000..239c5dd1 --- /dev/null +++ b/lib/Lacuna/RPC/Building/AmalgusMeadow.pm @@ -0,0 +1,17 @@ +package Lacuna::RPC::Building::AmalgusMeadow; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::RPC::Building'; + +sub app_url { + return '/amalgusmeadow'; +} + +sub model_class { + return 'Lacuna::DB::Result::Building::Permanent::AmalgusMeadow'; +} + +no Moose; +__PACKAGE__->meta->make_immutable; diff --git a/lib/Lacuna/RPC/Building/DentonBrambles.pm b/lib/Lacuna/RPC/Building/DentonBrambles.pm new file mode 100644 index 00000000..6608ae1f --- /dev/null +++ b/lib/Lacuna/RPC/Building/DentonBrambles.pm @@ -0,0 +1,17 @@ +package Lacuna::RPC::Building::DentonBrambles; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::RPC::Building'; + +sub app_url { + return '/dentonbrambles'; +} + +sub model_class { + return 'Lacuna::DB::Result::Building::Permanent::DentonBrambles'; +} + +no Moose; +__PACKAGE__->meta->make_immutable; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 2ea2a92d..d6f447a5 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,6 @@ +3.0200 + - Add: Added Amalgus Meadow and Denton Brambles glyph buildings. + 3.0100 - Add: The space station lab is now capable of producing some module plans. - Rule: Deployed bleeders now require a captcha to be demolished. diff --git a/var/www/public/resources.json b/var/www/public/resources.json index 964b2eef..30756fc8 100644 --- a/var/www/public/resources.json +++ b/var/www/public/resources.json @@ -35,6 +35,8 @@ "/crashedshipsite" : { "description" : "Harvest technology from a crashed ship to make your own ships better.", "wiki" : "http://community.lacunaexpanse.com/wiki/crashed-ship-site" }, "/citadelofknope" : { "description" : "Defends your planet from incoming hostile ships by absorbing the damage onto itself.", "wiki" : "http://community.lacunaexpanse.com/wiki/citadel-of-knope" }, "/ravine" : { "description" : "A natural place to store waste.", "wiki" : "http://community.lacunaexpanse.com/wiki/ravine" }, + "/amalgusmeadow" : { "description" : "A wild meadow filled with wild amalgus beans.", "wiki" : "http://community.lacunaexpanse.com/wiki/amalgus-meadow" }, + "/dentonbrambles" : { "description" : "A thorny patch of brambles, who's roots happen to be the delicious denton roots.", "wiki" : "http://community.lacunaexpanse.com/wiki/denton-brambles" }, "/malcudfield" : { "description" : "A natural source of food.", "wiki" : "http://community.lacunaexpanse.com/wiki/malcud-field" }, "/lapisforest" : { "description" : "A natural source of food.", "wiki" : "http://community.lacunaexpanse.com/wiki/lapis-forest" }, "/algaepond" : { "description" : "A natural source of food.", "wiki" : "http://community.lacunaexpanse.com/wiki/algae-pond" }, -- 2.51.2 From a4785a3c851ce206393e8d54ebe1017761c93375 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 16 Mar 2011 23:50:13 -0500 Subject: [PATCH 4/4] Fix typo --- lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm b/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm index e9e9fb74..3197fa79 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm @@ -32,7 +32,7 @@ sub image_level { after finish_upgrade => sub { my $self = shift; - $self->body->add_news(30, sprintf('Children everywhere on %s where heard singing "Beans, beans, the music fruit" after they discovered an Amalgus Meadow today.', $self->body->name)); + $self->body->add_news(30, sprintf('Children everywhere on %s were heard singing "Beans, beans, the music fruit" after they discovered an Amalgus Meadow today.', $self->body->name)); }; use constant min_orbit => 4;