Skip to content
Browse files

Miniscule progress on groupmind

  • Loading branch information...
1 parent 85dac76 commit e44922b43940bce645d9ed10b21ef62469fd1aa8 T. Alexander Popiel committed
Showing with 21 additions and 0 deletions.
  1. +21 −0 groupmind.pl
View
21 groupmind.pl
@@ -96,6 +96,27 @@
emit_json("Current goals", \@current);
+my @tasks;
+for my $goal (@current) {
+}
+
+sub tasks_for_goal {
+ my $goal = shift;
+
+ my @buildings;
+ for my $name (@{$groups{$_->{name}} || [ $_->{name} ]}) {
+ push(@buildings, eval { $client->find_building($body_id, $name) });
+ }
+ $goal->{count} ||= 1;
+ if (@buildings < $goal->{count}) {
+# { task => "build", name
+
+ }
+ @buildings = sort { $b->{level} <=> $a->{level} } @buildings;
+ @buildings = @buildings[0..$_->{count}] if $_->{count} && @buildings > $_->{count};
+
+}
+
sub emit {
my $message = shift;
my $prefix = shift;

0 comments on commit e44922b

Please sign in to comment.
Something went wrong with that request. Please try again.