Skip to content

Commit

Permalink
Added colonies/stations to empire status. planets kept as union of both.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemming552 committed Nov 29, 2014
1 parent 088e15f commit ac6130f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/util/inflate_asteroids.pl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
out('Found '.scalar @rocks.' asteroids.');

my $changed = 0; my $unchanged = 0;
foreach my $id (sort { 5 > randint(10) } @rocks) {
foreach my $id (sort { 5 > rand(10) } @rocks) {
my $rock = $rocks_rs->find($id);
next unless ($rock->get_type eq 'asteroid');

Expand Down
10 changes: 9 additions & 1 deletion docs/Empire.pod
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ B<NOTE:> You should probably B<never> call this method directly, as it is a wast
"server" : { ... },
"empire" : {
"id" : "xxxx",
"colonies" : {
"id-goes-here" : "Earth",
"id-goes-here" : "Mars"
},
"rpc_count" : 321, # the number of calls made to the server
"is_isolationist" : 1, # hasn't sent out probes or colony ships
"name" : "The Syndicate",
Expand All @@ -224,11 +228,15 @@ B<NOTE:> You should probably B<never> call this method directly, as it is a wast
"essentia" : 0,
"planets" : {
"id-goes-here" : "Earth",
"id-goes-here" : "Mars
"id-goes-here" : "Mars",
"id-goes-here" : "Death Star"
},
"tech_level" : 20, # Highests level university has gotten to.
"self_destruct_active" : 0,
"self_destruct_date" : "",
"stations" : {
"id-goes-here" : "Death Star"
},
"primary_embassy_id" : 234567
}
}
Expand Down
10 changes: 10 additions & 0 deletions lib/Lacuna/DB/Result/Empire.pm
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,16 @@ sub get_status {
$planet_rs = Lacuna->db->resultset('Map::Body')->search({-or => { empire_id => $self->id, alliance_id => $self->alliance_id }});
}
my %planets;
my %stations;
my %colonies;
while (my $planet = $planet_rs->next) {
$planets{$planet->id} = $planet->name;
if ($planet->get_type eq 'space station') {
$stations{$planet->id} = $planet->name;
}
else {
$colonies{$planet->id} = $planet->name;
}
}
my $embassy = $self->highest_embassy;
my $embassy_id = defined $embassy ? $embassy->id : undef;
Expand All @@ -469,6 +477,8 @@ sub get_status {
home_planet_id => $self->home_planet_id,
tech_level => $self->university_level,
planets => \%planets,
stations => \%stations,
colonies => \%colonies,
self_destruct_active=> $self->self_destruct_active,
self_destruct_date => $self->self_destruct_date_formatted,
primary_embassy_id => $embassy_id,
Expand Down
1 change: 1 addition & 0 deletions var/www/public/changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
3.0907:
- Add: Timer added to colony object preventing passage into Neutral Zone.
- Add: colonies and stations added to empire stat. planets kept to maintain backwards compatibility

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

0 comments on commit ac6130f

Please sign in to comment.