From 1ffd879449222ba7c599007652dc6acb17c7b61a Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Thu, 12 Nov 2015 08:51:18 -0700 Subject: [PATCH] When IBS goes to zero, so should the influence. When the IBS hits zero, stale influence is still around, so we'll make the max distance "just under" the calculated distance. This shouldn't affect anyone other than IBS level 0 since there's no other situation where you can actually seize anything at full distance anyway due to the inverse square law being used for influence. Also, the calculate influence should happen *after* a downgrade/demolish. --- lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm | 2 +- lib/Lacuna/Role/Influencer.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm b/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm index bd530d4e..12833b0e 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm @@ -228,7 +228,7 @@ sub update_influence { WHERE s.id = si.star_id AND - pow(pow(x - ?, 2) + pow(y - ?, 2), 0.5) > ? + pow(pow(x - ?, 2) + pow(y - ?, 2), 0.5) >= ? ) EOSQL $sth->execute( diff --git a/lib/Lacuna/Role/Influencer.pm b/lib/Lacuna/Role/Influencer.pm index 3e98c9b1..eaedf593 100644 --- a/lib/Lacuna/Role/Influencer.pm +++ b/lib/Lacuna/Role/Influencer.pm @@ -2,12 +2,12 @@ package Lacuna::Role::Influencer; use Moose::Role; -before demolish => sub { +after demolish => sub { my $self = shift; $self->body->update_influence; }; -before downgrade => sub { +after downgrade => sub { my $self = shift; $self->body->update_influence; }; -- 2.51.2