From 4e82431e86ca41029287a8c90530dd204445587d Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 28 Feb 2015 15:42:25 -0700 Subject: [PATCH] fissure warnings --- bin/tick_fissures.pl | 17 +++++++++++++---- lib/Lacuna/RPC/Building/BlackHoleGenerator.pm | 6 ++++-- var/www/public/changes.txt | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bin/tick_fissures.pl b/bin/tick_fissures.pl index a176c16b..d8ac3090 100644 --- a/bin/tick_fissures.pl +++ b/bin/tick_fissures.pl @@ -88,8 +88,6 @@ for my $body_id (sort keys %has_fissures) { fissure_level($body, $fissure); #Level fissure, Send minor alert $body_alert = level achieved. my $range = ($fissure->level * 5) * $fissure_cnt; - $range = 120 if $range > 120; - $range = 25 if $range < 25; if ($body_alert{$body_id}) { $body_alert{$body_id}->{range} = $range if ($body_alert{$body_id}->{range} < $range); @@ -122,8 +120,6 @@ for my $body_id (sort keys %has_fissures) { if ($max_fissures == $fissure_cnt) { fissure_spawn($body); my $range = 30 * $fissure_cnt; - $range = 120 if $range > 120; - $range = 25 if $range < 25; $body_alert{$body_id} = { range => $range, type => "spawn", @@ -150,6 +146,8 @@ exit; sub fissure_alert { my ($body, $range, $type) = @_; + $range = 25 if ($range < 25); + $range = 120 if ($range > 120); my $minus_x = 0 - $body->x; my $minus_y = 0 - $body->y; my $alert = Lacuna->db->resultset('Map::Body')->search({ @@ -165,8 +163,19 @@ sub fissure_alert { ], order_by => 'distance', }); + my $number_to_alert = 25;; + if ($type eq "level") { + $number_to_alert = 10;; + } + elsif ($type eq "spawn") { + $number_to_alert = 25;; + } + elsif ($type eq "critical") { + $number_to_alert = 15;; + } my %already; while (my $to_alert = $alert->next) { + last if ($number_to_alert-- < 1); my $distance = $to_alert->get_column('distance'); last if ($distance > $range); my $eid = $to_alert->empire_id; diff --git a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm index ecb9e14f..ca56aa77 100644 --- a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm +++ b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm @@ -1725,9 +1725,11 @@ sub bhg_random_fissure { }); my %already; my $max_alert = $level*5; - $max_alert = 100 if ($max_alert > 100); - $max_alert = 20 if ($max_alert < 20); + $max_alert = 120 if ($max_alert > 120); + $max_alert = 25 if ($max_alert < 25); + my $number_to_alert = 0; while (my $to_alert = $alert->next) { + last if ($number_to_alert++ > 25); my $distance = $to_alert->get_column('distance'); last if ($distance > $max_alert); my $eid = $to_alert->empire_id; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 434aea24..825d9f3d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -30,7 +30,9 @@ - Mod: Oracle cooldown on BHG movement shortened to a flat 5 minutes. - Mod: BHG Neutralization does not effect own alliance. - Mod: BHG Can no longer swap with seized hostiles. + - Mod: Spies have fewer useless options. - Mod: Invalid login attempts warns. + - Mod: Warnings about fissures shouldn't bother as many out of range. 3.0908: - Mod: trash_messages_where now defaults to not returning deleted message IDs. -- 2.51.2