|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stu\Lib\Pirate\Behaviour; |
|
4
|
|
|
|
|
5
|
|
|
use Override; |
|
|
|
|
|
|
6
|
|
|
use Stu\Lib\Pirate\Component\PirateNavigationInterface; |
|
7
|
|
|
use Stu\Lib\Pirate\PirateBehaviourEnum; |
|
8
|
|
|
use Stu\Lib\Pirate\PirateReactionInterface; |
|
9
|
|
|
use Stu\Lib\Pirate\PirateReactionMetadata; |
|
10
|
|
|
use Stu\Module\Logging\LoggerUtilFactoryInterface; |
|
11
|
|
|
use Stu\Module\Logging\PirateLoggerInterface; |
|
12
|
|
|
use Stu\Module\Ship\Lib\FleetWrapperInterface; |
|
13
|
|
|
use Stu\Orm\Entity\SpacecraftInterface; |
|
14
|
|
|
use Stu\Orm\Repository\StarSystemRepositoryInterface; |
|
15
|
|
|
|
|
16
|
|
|
class HideBehaviour implements PirateBehaviourInterface |
|
17
|
|
|
{ |
|
18
|
|
|
private PirateLoggerInterface $logger; |
|
19
|
|
|
|
|
20
|
1 |
|
public function __construct( |
|
21
|
|
|
private StarSystemRepositoryInterface $starSystemRepository, |
|
22
|
|
|
private PirateNavigationInterface $pirateNavigation, |
|
23
|
|
|
LoggerUtilFactoryInterface $loggerUtilFactory |
|
24
|
|
|
) { |
|
25
|
1 |
|
$this->logger = $loggerUtilFactory->getPirateLogger(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
#[Override] |
|
29
|
|
|
public function action( |
|
30
|
|
|
FleetWrapperInterface $fleet, |
|
31
|
|
|
PirateReactionInterface $pirateReaction, |
|
32
|
|
|
PirateReactionMetadata $reactionMetadata, |
|
33
|
|
|
?SpacecraftInterface $triggerSpacecraft |
|
34
|
|
|
): ?PirateBehaviourEnum { |
|
35
|
|
|
|
|
36
|
|
|
$leadWrapper = $fleet->getLeadWrapper(); |
|
37
|
|
|
|
|
38
|
|
|
$hideSystems = $this->starSystemRepository->getPirateHides($leadWrapper); |
|
39
|
|
|
if ($hideSystems === []) { |
|
40
|
|
|
$this->logger->log(' no hide system in reach'); |
|
41
|
|
|
return PirateBehaviourEnum::RAGE; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
shuffle($hideSystems); |
|
45
|
|
|
$closestHideSystem = current($hideSystems); |
|
46
|
|
|
|
|
47
|
|
|
$this->pirateNavigation->navigateToTarget($fleet, $closestHideSystem); |
|
48
|
|
|
|
|
49
|
|
|
return null; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths