From 9d7c6df01472a85e44f4e1598172c09b312db8f9 Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Fri, 16 Jan 2015 17:38:45 -0700 Subject: [PATCH] Return pod_delay as part of pcc view so the UI can eventually display it. --- docs/PlanetaryCommand.pod | 1 + .../DB/Result/Building/PlanetaryCommand.pm | 25 +++++++++++-------- lib/Lacuna/RPC/Building/PlanetaryCommand.pm | 1 + var/www/public/changes.txt | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/PlanetaryCommand.pod b/docs/PlanetaryCommand.pod index 66ead9ab..baef3886 100644 --- a/docs/PlanetaryCommand.pod +++ b/docs/PlanetaryCommand.pod @@ -28,6 +28,7 @@ Command extends the view method to include a C section. "bauxite_stored" : 1235, ... }, + "pod_delay" : 70515, # seconds between supply pod sendings "planet" : { "id" : "id-goes-here", "x" : -4, diff --git a/lib/Lacuna/DB/Result/Building/PlanetaryCommand.pm b/lib/Lacuna/DB/Result/Building/PlanetaryCommand.pm index 40ce6771..8a9dae4a 100644 --- a/lib/Lacuna/DB/Result/Building/PlanetaryCommand.pm +++ b/lib/Lacuna/DB/Result/Building/PlanetaryCommand.pm @@ -72,18 +72,23 @@ sub incoming_supply_chains { return Lacuna->db->resultset('Lacuna::DB::Result::SupplyChain')->search({ target_id => $self->body_id }); } -sub sent_a_pod -{ - my ($self) = @_; +sub pod_delay { + my ($self, $level) = @_; - my $level = $self->effective_level; - my $cooldown = int( - 28.747 * $level * $level - - 2877.4 * $level - + 89249. - ); + $level //= $self->effective_level; + my $delay = int( + 28.747 * $level * $level + - 2877.4 * $level + + 89249. + ); - $self->start_work({}, $cooldown); + return $delay; +} + +sub sent_a_pod +{ + my $self = shift; + $self->start_work({}, $self->pod_delay); } sub can_send_pod diff --git a/lib/Lacuna/RPC/Building/PlanetaryCommand.pm b/lib/Lacuna/RPC/Building/PlanetaryCommand.pm index 131b7c63..61db3cf3 100644 --- a/lib/Lacuna/RPC/Building/PlanetaryCommand.pm +++ b/lib/Lacuna/RPC/Building/PlanetaryCommand.pm @@ -24,6 +24,7 @@ around 'view' => sub { $out->{ore} = $building->body->get_ore_status; $out->{food} = $building->body->get_food_status; $out->{next_colony_cost} = $empire->next_colony_cost; + $out->{pod_delay} = $building->pod_delay; return $out; }; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index bd7080bf..93b70eec 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -17,6 +17,7 @@ - Mod: Archaeology searches now take 5 hours, 50 minutes to complete. (thanks tmtowtdi!) - Mod: Bleeders replicate. - Mod: Disable chat for sitters. + - Add: pod_delay returned as part of PCC view 3.0908: - Mod: trash_messages_where now defaults to not returning deleted message IDs. -- 2.51.2