Skip to content

Commit

Permalink
Missed removing debug code from algaepond, also shouldn't be calling
Browse files Browse the repository at this point in the history
sprintf when passing in to add_news which calls sprintf again.  If the
first sprintf results in a % showing up somewhere, it'll get re-interpolated,
messing up the output.  Besides, it's also a waste of processing power.
  • Loading branch information
dmcbride committed Mar 25, 2015
1 parent 30027a3 commit c4194f6
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 27 deletions.
6 changes: 3 additions & 3 deletions lib/Lacuna/DB/Result/Building/Permanent/AlgaePond.pm
Expand Up @@ -27,11 +27,11 @@ my @fish = (

after finish_upgrade => sub {
my $self = shift;
my @msg = ('This is no fisherman\'s tale. A local fisherman caught a %.1f meter %s out of an algae pond on %s.',
randint(10,95),
my @msg = (q[This is no fisherman's tale. A local fisherman caught a %.1f meter %s out of an algae pond on %s.],
randint(10,95)/10,
random_element(\@fish),
$self->body->name);
$self->body->add_news(130, @msg);
$self->body->add_news(30, @msg);
};

use constant name => 'Algae Pond';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/AmalgusMeadow.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$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));
$self->body->add_news(30, '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;
Expand Down
8 changes: 7 additions & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/BeeldebanNest.pm
Expand Up @@ -4,6 +4,7 @@ use Moose;
use utf8;
no warnings qw(uninitialized);
extends 'Lacuna::DB::Result::Building::Permanent';
use Lacuna::Util qw(random_element);

use constant controller_class => 'Lacuna::RPC::Building::BeeldebanNest';

Expand All @@ -17,9 +18,14 @@ sub image_level {
return $self->image.'1';
}

my @upgrades = (
'A boy was nearly killed today when he and his sister wandered into a wild Beeldeban nest on %s today.',
'A girl was nearly killed today when she and her brother wandered into a wild Beeldeban nest on %s today.',
);

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('A boy was nearly killed today when he and his sister wandered into a wild Beeldeban nest on %s today.', $self->body->name));
$self->body->add_news(30, random_element(\@upgrades), $self->body->name);
};

use constant name => 'Beeldeban Nest';
Expand Down
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('%s is experimenting with advanced singularity technology.', $self->body->name));
$self->body->add_news(30, '%s is experimenting with advanced singularity technology.', $self->body->name);
};

sub can_build_on {
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/CitadelOfKnope.pm
Expand Up @@ -20,7 +20,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('Research students say that the Citadel of Knope, which remained dormant for years on %s, sprang to life.', $self->body->name));
$self->body->add_news(50, 'Research students say that the Citadel of Knope, which remained dormant for years on %s, sprang to life.', $self->body->name);
};

use constant name => 'Citadel of Knope';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/CrashedShipSite.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('Construction workers uncovered the hull of an ancient ship on %s as they were digging the foundation of a house.', $self->body->name));
$self->body->add_news(50, 'Construction workers uncovered the hull of an ancient ship on %s as they were digging the foundation of a house.', $self->body->name);
};

use constant name => 'Crashed Ship Site';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/DentonBrambles.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

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));
$self->body->add_news(30, '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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/EssentiaVein.pm
Expand Up @@ -36,7 +36,7 @@ sub image_level {
after finish_upgrade => sub {
my $self = shift;

$self->body->add_news(30, sprintf('Though officials on %s tried to keep it secret, news of the discovery of an Essentia vein broke.', $self->body->name));
$self->body->add_news(30, 'Though officials on %s tried to keep it secret, news of the discovery of an Essentia vein broke.', $self->body->name);
# Removed any scheduled work that is already running
# Reschedule work.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/Fissure.pm
Expand Up @@ -32,7 +32,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('Scientists are worried that %s may collapse in on itself.', $self->body->name));
$self->body->add_news(30, 'Scientists are worried that %s may collapse in on itself.', $self->body->name);
};

before 'can_demolish' => sub {
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/GeoThermalVent.pm
Expand Up @@ -14,7 +14,7 @@ use constant image => 'geothermalvent';

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('%s considers itself a very efficient planet, much of its energy production coming from thermal vents.', $self->body->name));
$self->body->add_news(30, '%s considers itself a very efficient planet, much of its energy production coming from thermal vents.', $self->body->name);
};

sub image_level {
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/GratchsGauntlet.pm
Expand Up @@ -20,7 +20,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('The agents on %s use techniques handed down for millenia, which they say makes them unbeatable.', $self->body->name));
$self->body->add_news(30, 'The agents on %s use techniques handed down for millenia, which they say makes them unbeatable.', $self->body->name);
};

before 'repair' => sub {
Expand Down
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('An ancient interdimensional rift was opened on %s today. Onlookers stood speechless.', $self->body->name));
$self->body->add_news(50, 'An ancient interdimensional rift was opened on %s today. Onlookers stood speechless.', $self->body->name);
};

use constant name => 'Interdimensional Rift';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/KalavianRuins.pm
Expand Up @@ -20,7 +20,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('Archaeologists estimate that the Kalavian Ruins they uncovered on %s were buried for '.randint(10,99).',000 years.', $self->body->name));
$self->body->add_news(50, 'Archaeologists estimate that the Kalavian Ruins they uncovered on %s were buried for %d,000 years.', $self->body->name, randint(10,99));
};

use constant name => 'Kalavian Ruins';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/KasternsKeep.pm
Expand Up @@ -40,7 +40,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('The old castle stands alone atop a bluff on %s. And still looks magestic after all these years.', $self->body->name));
$self->body->add_news(30, 'The old castle stands alone atop a bluff on %s. And still looks magestic after all these years.', $self->body->name);
};

use constant name => 'Kastern\'s Keep';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/LapisForest.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(40, sprintf('The poet known for his "Ode To A Lapis Forest" is scheduled to speak today on %s.', $self->body->name));
$self->body->add_news(40, 'The poet known for his "Ode To A Lapis Forest" is scheduled to speak today on %s.', $self->body->name);
};

use constant name => 'Lapis Forest';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/LibraryOfJith.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('Scientists on %s have unlocked the secrets of the origin of species.', $self->body->name));
$self->body->add_news(30, 'Scientists on %s have unlocked the secrets of the origin of species.', $self->body->name);
};

use constant name => 'Library of Jith';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/MalcudField.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('Today the governor of %s announced that a wild malcud field would be set aside as a nature preserve.', $self->body->name));
$self->body->add_news(30, 'Today the governor of %s announced that a wild malcud field would be set aside as a nature preserve.', $self->body->name);
};

use constant name => 'Malcud Field';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/MassadsHenge.pm
Expand Up @@ -40,7 +40,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('The whole of the heavens are exposed to the citizens of %s.', $self->body->name));
$self->body->add_news(30, 'The whole of the heavens are exposed to the citizens of %s.', $self->body->name);
};

use constant name => 'Massad\'s Henge';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/NaturalSpring.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('Worries of drought ended today as a natural spring bubbled to the surface of %s today.', $self->body->name));
$self->body->add_news(30, 'Worries of drought ended today as a natural spring bubbled to the surface of %s today.', $self->body->name);
};

use constant name => 'Natural Spring';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/OracleOfAnid.pm
Expand Up @@ -30,7 +30,7 @@ sub probes {
after finish_upgrade => sub {
my $self = shift;

$self->body->add_news(30, sprintf('A warning to all enemies foreign and domestic. The government of %s sees all.', $self->body->name));
$self->body->add_news(30, 'A warning to all enemies foreign and domestic. The government of %s sees all.', $self->body->name);

my $work_secs = 60;
if ($self->is_working) {
Expand Down
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('No one is certain how, but measurements of %s from the ground indicate it\'s bigger than measurements from space.', $self->body->name));
$self->body->add_news(50, 'No one is certain how, but measurements of %s from the ground indicate it\'s bigger than measurements from space.', $self->body->name);
};

use constant name => 'Pantheon of Hagness';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/Ravine.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('A tectonic shift shook the inhabitants of %s today as the ground quaked beneath their feet.', $self->body->name));
$self->body->add_news(30, 'A tectonic shift shook the inhabitants of %s today as the ground quaked beneath their feet.', $self->body->name);
};

use constant name => 'Ravine';
Expand Down
Expand Up @@ -12,7 +12,7 @@ use constant controller_class => 'Lacuna::RPC::Building::TempleOfTheDrajilites';

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(50, sprintf('The followers of the Drajilite religion rejoiced when their ancient temple was uncovered on %s.', $self->body->name));
$self->body->add_news(50, 'The Disciples of Drajilite rejoiced when their ancient temple was uncovered on %s.', $self->body->name);
};

use constant image => 'templedrajilites';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm
Expand Up @@ -42,7 +42,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('It is hard to believe that after going unused for nearly '.randint(10,99).',000 years, The Dillon Forge still works on %s.', $self->body->name));
$self->body->add_news(30, 'It is hard to believe that after going unused for nearly '.randint(10,99).',000 years, The Dillon Forge still works on %s.', $self->body->name);
};

use constant name => 'The Dillon Forge';
Expand Down
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Permanent/Volcano.pm
Expand Up @@ -19,7 +19,7 @@ sub image_level {

after finish_upgrade => sub {
my $self = shift;
$self->body->add_news(30, sprintf('A volcano erupted on %s today spewing tons of ash on the inhabitants.', $self->body->name));
$self->body->add_news(30, 'A volcano erupted on %s today spewing tons of ash on the inhabitants.', $self->body->name);
};

use constant name => 'Volcano';
Expand Down

0 comments on commit c4194f6

Please sign in to comment.