From 80cf8e8f0a0386fd3e035ab1d3dd28b695c4345c Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Wed, 20 Jan 2016 15:42:15 -0700 Subject: [PATCH] Halls don't need to show up in buildable. Ever. Frees up image for other purposes. --- lib/Lacuna/DB/Result/Building.pm | 2 ++ lib/Lacuna/DB/Result/Building/Permanent/HallsOfVrbansk.pm | 1 + lib/Lacuna/RPC/Body.pm | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index d6ebbc96..f97d7668 100755 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -131,6 +131,8 @@ use constant food_storage => 0; use constant ore_storage => 0; use constant waste_storage => 0; +use constant can_really_be_built => 1; + # BASE FORMULAS has effective_level => ( diff --git a/lib/Lacuna/DB/Result/Building/Permanent/HallsOfVrbansk.pm b/lib/Lacuna/DB/Result/Building/Permanent/HallsOfVrbansk.pm index 37cd1377..f933dc62 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/HallsOfVrbansk.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/HallsOfVrbansk.pm @@ -10,6 +10,7 @@ extends 'Lacuna::DB::Result::Building::Permanent'; with "Lacuna::Role::Building::CantBuildWithoutPlan"; use constant controller_class => 'Lacuna::RPC::Building::HallsOfVrbansk'; +use constant can_really_be_built => 0; around can_build => sub { confess [1013,"You can't build the Halls of Vrbansk."]; diff --git a/lib/Lacuna/RPC/Body.pm b/lib/Lacuna/RPC/Body.pm index adab932a..ca7dbf3f 100644 --- a/lib/Lacuna/RPC/Body.pm +++ b/lib/Lacuna/RPC/Body.pm @@ -473,6 +473,7 @@ sub get_buildable { my %plans; my @buildable_plans = sort {$a->extra_build_level <=> $b->extra_build_level} grep{$_->level == 1} @{$body->plan_cache}; for my $plan (@buildable_plans) { + next unless eval { $plan->class->can_really_be_built }; push @buildable, $plan->class->controller_class; $plans{$plan->class} = $plan->extra_build_level; } @@ -482,7 +483,7 @@ sub get_buildable { my $building = $building_rs->new(\%properties); my @tags = $building->build_tags; if ($properties{class} ~~ [keys %plans]) { - push @tags, 'Plan', + push @tags, 'Plan'; } if ($tag) { next unless ($tag ~~ \@tags); @@ -491,7 +492,7 @@ sub get_buildable { my $can_build = eval{$body->has_met_building_prereqs($building, $cost)}; my $reason = $@; if ($can_build) { - push @tags, 'Now'; + push @tags, 'Now'; } elsif (ref $reason ne 'ARRAY') { confess $reason; @@ -506,7 +507,7 @@ sub get_buildable { url => $class->app_url, image => $building->image_level, build => { - can => ($can_build) ? 1 : 0, + can => ($can_build) ? 1 : 0, cost => $cost, reason => $reason, tags => \@tags, -- 2.51.2