]> ruin.nu Git - NDIRC.git/commitdiff
Add coords and type to the scan response
authorMichael Andreen <harv@ruin.nu>
Tue, 10 Nov 2009 15:42:40 +0000 (16:42 +0100)
committerMichael Andreen <harv@ruin.nu>
Tue, 10 Nov 2009 15:42:40 +0000 (16:42 +0100)
Delling.pm

index 8008e810f2e9523d1bab6f91052817e56b1e9806..39c7cf9f65494371a17733531bbe950251fcd44b 100644 (file)
@@ -117,20 +117,23 @@ sub refresh {
 
        my $dbh = DB();
        my $scans = $dbh->prepare(q{SELECT s.scan_id
+                       ,coords(x,y,z),type
                        ,array_agg(sr.nick) AS nick
                        ,array_agg(sr.id) AS id
                FROM scan_requests sr
                        JOIN scans s USING (pid,type)
+                       JOIN current_planet_stats USING (pid)
                WHERE sr.time > NOW() - '30 min'::INTERVAL
                        AND s.tick >= sr.tick AND NOT sr.sent
-               GROUP BY scan_id
+               GROUP BY scan_id,x,y,z,type
                });
        my $sentscan = $dbh->prepare(q{UPDATE scan_requests
                SET sent = TRUE WHERE id = ANY($1)
                });
        $scans->execute;
        while (my $scan = $scans->fetchrow_hashref){
-               $heap->{irc}->yield(notice => $scan->{nick}, "http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}");
+               $heap->{irc}->yield(notice => $scan->{nick}, "($scan->{coords} $scan->{type})"
+                       ." http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}");
                $sentscan->execute($scan->{id});
        }
        return;