Skip to content

Commit

Permalink
view_laws added to map function for looking up laws affecting star.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemming552 committed Dec 12, 2014
1 parent 9150b51 commit 65a35b7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
27 changes: 27 additions & 0 deletions docs/Map.pod
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,33 @@ one fissure;

If there are no fissures on any of the bodies which you have probed then an empty list is returned;

=head2 view_laws (session_id, star_id )

B<NOTE:> Pass in a the id of a star and the laws enacted by the controlling station will be returned.

Returns a list of the laws.

{
"status" : { ... },
"laws" : [
{
"id" : "id-goes-here",
"name" : "Censure of Jamie Vrbsky",
"description" : "Jamie Vrbsky is bad at playing Lacuna!",
"date_enacted" : "01 31 2010 13:09:05 +0600"
},
...
]
}

=head3 session_id

A session id.

=head3 star_id

The unique id of the star


=head1 FAQ

Expand Down
25 changes: 25 additions & 0 deletions lib/Lacuna/RPC/Map.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,30 @@ sub probe_summary_fissures {
return { fissures => $fissures};
}

sub view_laws {
my ($self, $session_id, $star_id) = @_;
my $empire = $self->get_empire_by_session($session_id);
my $star = Lacuna->db->resultset('Map::Star')->find($star_id);
if ($star and $star->station_id) {
my $station = Lacuna->db->resultset('Lacuna::DB::Result::Map::Body')
->find($star->station->id);
my @out;
my $laws = $station->laws;
while (my $law = $laws->next) {
push @out, $law->get_status($empire);
}
return {
status => $self->format_status($empire, $station),
laws => \@out,
};
}
else {
return {
status => $self->format_status($empire, $star),
laws => [ { name => "Not controlled by a station", descripition => "Not controlled by a station", date_enacted => "00 00 0000 00:00:00 +0000", id => 0 } ],
},
}
}

__PACKAGE__->register_rpc_method_names(qw(
get_star_map
Expand All @@ -168,6 +192,7 @@ __PACKAGE__->register_rpc_method_names(qw(
search_stars
check_star_for_incoming_probe
probe_summary_fissures
view_laws
));

no Moose;
Expand Down
3 changes: 2 additions & 1 deletion var/www/public/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- Mod: Firing BFG now requires captcha.
- Fix: Jump Zone for BHG can now find needles in haystacks.
- UI : Reasons for not being able to use a BHG function now always displayed for every task.
- Fix: Instead of going via parliament, go via body to view_laws. This allows everyone access to passed laws by a station.
- Fix: Instead of going via parliament, go via body or star to view_laws. This allows everyone access to passed laws by a station.

3.0907:
- Add: Timer added to colony object preventing passage into Neutral Zone.
Expand All @@ -13,6 +13,7 @@
- Add: Bugout task for spies added to get spies home.
- Mod: Replace cheap plastic parts on Space Station with steel.
- Mod: Slight tweaking of AI behaviours.
- Mod: Police Stations now have more thorough security on incoming visitors.

3.0906:
- Fix: Some fixes to the send_ship_types API call.
Expand Down

0 comments on commit 65a35b7

Please sign in to comment.