diff --git a/lib/Lacuna/DB/Result/Ships/SpaceStation.pm b/lib/Lacuna/DB/Result/Ships/SpaceStation.pm index f0e5103d..73b01fa7 100644 --- a/lib/Lacuna/DB/Result/Ships/SpaceStation.pm +++ b/lib/Lacuna/DB/Result/Ships/SpaceStation.pm @@ -25,6 +25,7 @@ with 'Lacuna::Role::Ship::Send::MemberOfAlliance'; with "Lacuna::Role::Ship::Send::SpendNextColonyCost"; with "Lacuna::Role::Ship::Send::IsHostile"; with "Lacuna::Role::Ship::Arrive::ConvertToStation"; +with "Lacuna::Role::Ship::Arrive::TriggerDefense"; no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0); -- 2.51.2 From 5e114f846130b03c6fbff6b24ffe0d64d82aee5f Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 31 Mar 2011 11:39:03 -0500 Subject: [PATCH 2/4] bump version --- lib/Lacuna.pm | 2 +- var/www/public/changes.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index faffe0fc..9b7257ac 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 3.0402; +our $VERSION = 3.0500; 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/var/www/public/changes.txt b/var/www/public/changes.txt index d88eaac5..d5ca2584 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,5 @@ +3.0500 + 3.0402 - API: Changed parliament propositions and laws to use email formatting rules. - Rule: Lagoons, Groves, and Sand now produce less because they were unbalancing. -- 2.51.2 From 810296b76e8673a589d5420e794b781948cf9695 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 31 Mar 2011 11:45:36 -0500 Subject: [PATCH 3/4] add locks on adding trades --- lib/Lacuna/RPC/Building/Trade.pm | 13 ++++++++++--- lib/Lacuna/RPC/Building/Transporter.pm | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/Lacuna/RPC/Building/Trade.pm b/lib/Lacuna/RPC/Building/Trade.pm index 29aa7cee..e31a02d1 100644 --- a/lib/Lacuna/RPC/Building/Trade.pm +++ b/lib/Lacuna/RPC/Building/Trade.pm @@ -38,11 +38,11 @@ sub push_items { my $building = $self->get_building($empire, $building_id); confess [1013, 'You cannot use a trade ministry that has not yet been built.'] unless $building->level > 0; my $cache = Lacuna->cache; - if (! $cache->add('trade_push_lock', $building_id, 1, 5)) { - confess [1013, 'You have a push setup in progress. Please wait a few moments and try again.']; + if (! $cache->add('trade_add_lock', $building_id, 1, 5)) { + confess [1013, 'You have a trade setup in progress. Please wait a few moments and try again.']; } my $guard = guard { - $cache->delete('trade_push_lock',$building_id); + $cache->delete('trade_add_lock',$building_id); }; unless ($target_id) { confess [1002, "You must specify a target body id."]; @@ -158,6 +158,13 @@ sub add_to_market { my $empire = $self->get_empire_by_session($session_id); my $building = $self->get_building($empire, $building_id); confess [1013, 'You cannot use a trade ministry that has not yet been built.'] unless $building->level > 0; + my $cache = Lacuna->cache; + if (! $cache->add('trade_add_lock', $building_id, 1, 5)) { + confess [1013, 'You have a trade setup in progress. Please wait a few moments and try again.']; + } + my $guard = guard { + $cache->delete('trade_add_lock',$building_id); + }; my $trade = $building->add_to_market($offer, $ask, $options); return { trade_id => $trade->id, diff --git a/lib/Lacuna/RPC/Building/Transporter.pm b/lib/Lacuna/RPC/Building/Transporter.pm index a47d5937..6ddc0c75 100644 --- a/lib/Lacuna/RPC/Building/Transporter.pm +++ b/lib/Lacuna/RPC/Building/Transporter.pm @@ -31,11 +31,11 @@ sub push_items { my $building = $self->get_building($empire, $building_id); confess [1013, 'You cannot use a transporter that has not yet been built.'] unless $building->level > 0; my $cache = Lacuna->cache; - if (! $cache->add('trade_push_lock', $building_id, 1, 5)) { - confess [1013, 'You have a push setup in progress. Please wait a few moments and try again.']; + if (! $cache->add('trade_add_lock', $building_id, 1, 5)) { + confess [1013, 'You have a trade setup in progress. Please wait a few moments and try again.']; } my $guard = guard { - $cache->delete('trade_push_lock',$building_id); + $cache->delete('trade_add_lock',$building_id); }; unless ($empire->essentia >= 2) { confess [1011, "You need 2 essentia to push items using the Subspace Transporter."]; @@ -66,6 +66,13 @@ sub add_to_market { my $empire = $self->get_empire_by_session($session_id); my $building = $self->get_building($empire, $building_id); confess [1013, 'You cannot use a transporter that has not yet been built.'] unless $building->level > 0; + my $cache = Lacuna->cache; + if (! $cache->add('trade_add_lock', $building_id, 1, 5)) { + confess [1013, 'You have a trade setup in progress. Please wait a few moments and try again.']; + } + my $guard = guard { + $cache->delete('trade_add_lock',$building_id); + }; unless ($empire->essentia >= 1) { confess [1011, "You need 1 essentia to make a trade using the Subspace Transporter."]; } -- 2.51.2 From b93c977a0d58993b09fdaf7cfeef20c7b815ea39 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 31 Mar 2011 11:52:51 -0500 Subject: [PATCH 4/4] note changes --- var/www/public/changes.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index d5ca2584..70aaf4e8 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,4 +1,8 @@ 3.0500 + - Fix: No longer possible to exploit timing on trade adding to generate free resources + - Fix: SAWs will not attack ships of same empire or same alliance + - Rule: SAWs will now defend before allied ships + - Rule: Space Station Hulls will trigger defenses 3.0402 - API: Changed parliament propositions and laws to use email formatting rules.