From 113844e88968d60e639b9589b048258eac200be2 Mon Sep 17 00:00:00 2001 From: Ian Docherty Date: Sun, 9 Sep 2012 14:51:01 -0400 Subject: [PATCH] Fissure stabilization repair costs --- lib/Lacuna.pm | 2 +- .../DB/Result/Building/Permanent/Fissure.pm | 30 +++++++++++++------ var/www/public/changes.txt | 3 ++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index bcae5928..8fcf8c7b 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 3.0868; +our $VERSION = 3.0869; my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf'); my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1}); diff --git a/lib/Lacuna/DB/Result/Building/Permanent/Fissure.pm b/lib/Lacuna/DB/Result/Building/Permanent/Fissure.pm index 9b1add81..d7c029d3 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/Fissure.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/Fissure.pm @@ -36,17 +36,24 @@ after finish_upgrade => sub { }; before 'can_demolish' => sub { - my $self = shift; - unless ($self->level == 1) { - confess [1013, 'You must fill in the fissure by spending resources to downgrade it before you can demolish it.']; - } + my $self = shift; + unless ($self->efficiency >= 100) { + confess [1013, 'Unless your Fissure maintenance equipment is 100% operational, it is just too dangerous to attempt']; + } + unless ($self->level == 1) { + confess [1013, 'You must fill in the fissure by spending resources to downgrade it before you can demolish it.']; + } }; before 'can_downgrade' => sub { - my $self = shift; - unless ($self->has_resources_to_fill_in_fissure) { - confess [1013, 'You need '.int($self->cost_to_fill_in_fissure).' in ore to fill in the fissure.']; - } + my $self = shift; + + unless ($self->efficiency >= 100) { + confess [1013, 'Unless your Fissure maintenance equipment is 100% operational, it is just too dangerous to attempt.']; + } + unless ($self->has_resources_to_fill_in_fissure) { + confess [1013, 'You need '.int($self->cost_to_fill_in_fissure).' in ore to fill in the fissure.']; + } }; before downgrade => sub { @@ -58,9 +65,9 @@ before downgrade => sub { $body->spend_ore($cost); } else { - $cost -= $stored; $body->spend_ore($stored); } + $self->body->add_news(30, sprintf('Scientists on %s successfully downgraded a Fissure today.', $self->body->name)); }; sub cost_to_fill_in_fissure { @@ -77,6 +84,11 @@ sub has_resources_to_fill_in_fissure { use constant name => 'Fissure'; use constant time_to_build => 0; +use constant food_to_build => 18; +use constant energy_to_build => 20; +use constant ore_to_build => 21; +use constant water_to_build => 20; +use constant waste_to_build => 10; no Moose; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index ec9159d8..0428f18c 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,6 @@ +3.0969: + - Fix: Fissure now has repair costs for stabilization equipment + 3.0868: - Fix: No longer try to send N19 news from an asteroid -- 2.51.2