1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Colony\Lib\Gui; |
6
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
8
|
|
|
use Stu\Component\Building\BuildingFunctionEnum; |
9
|
|
|
use Stu\Component\Colony\ColonyFunctionManagerInterface; |
10
|
|
|
use Stu\Lib\Map\VisualPanel\AbstractVisualPanel; |
11
|
|
|
use Stu\Lib\Map\VisualPanel\Layer\DataProvider\Spacecraftcount\SpacecraftCountLayerTypeEnum; |
12
|
|
|
use Stu\Lib\Map\VisualPanel\Layer\DataProvider\Subspace\SubspaceLayerTypeEnum; |
13
|
|
|
use Stu\Lib\Map\VisualPanel\Layer\PanelLayerCreationInterface; |
14
|
|
|
use Stu\Lib\Map\VisualPanel\PanelBoundaries; |
15
|
|
|
use Stu\Lib\Map\VisualPanel\VisualPanelElementInterface; |
16
|
|
|
use Stu\Module\Logging\LoggerUtilInterface; |
17
|
|
|
use Stu\Orm\Entity\ColonyInterface; |
18
|
|
|
|
19
|
|
|
class ColonyScanPanel extends AbstractVisualPanel |
20
|
|
|
{ |
21
|
3 |
|
public function __construct( |
22
|
|
|
PanelLayerCreationInterface $panelLayerCreation, |
23
|
|
|
private ColonyInterface $colony, |
24
|
|
|
private ColonyFunctionManagerInterface $colonyFunctionManager, |
25
|
|
|
LoggerUtilInterface $loggerUtil |
26
|
|
|
) { |
27
|
3 |
|
parent::__construct($panelLayerCreation, $loggerUtil); |
28
|
|
|
} |
29
|
|
|
|
30
|
3 |
|
#[Override] |
31
|
|
|
protected function createBoundaries(): PanelBoundaries |
32
|
|
|
{ |
33
|
3 |
|
$range = 1; |
34
|
|
|
|
35
|
3 |
|
if ($this->colonyFunctionManager->hasFunction($this->colony, BuildingFunctionEnum::BUILDING_FUNCTION_SUBSPACE_TELESCOPE)) { |
36
|
|
|
$range = 3; |
37
|
3 |
|
} elseif ($this->colonyFunctionManager->hasFunction($this->colony, BuildingFunctionEnum::BUILDING_FUNCTION_COLONY_CENTRAL)) { |
38
|
|
|
$range = 2; |
39
|
|
|
} |
40
|
|
|
|
41
|
3 |
|
return PanelBoundaries::fromLocation($this->colony->getStarsystemMap(), $range); |
42
|
|
|
} |
43
|
|
|
|
44
|
3 |
|
#[Override] |
45
|
|
|
protected function loadLayers(): void |
46
|
|
|
{ |
47
|
3 |
|
$showCloaked = $this->colonyFunctionManager->hasFunction($this->colony, BuildingFunctionEnum::BUILDING_FUNCTION_COLONY_CENTRAL); |
48
|
|
|
|
49
|
3 |
|
$panelLayerCreation = $this->panelLayerCreation |
50
|
3 |
|
->addShipCountLayer($showCloaked, null, SpacecraftCountLayerTypeEnum::ALL, 0) |
51
|
3 |
|
->addSystemLayer() |
52
|
3 |
|
->addAnomalyLayer() |
53
|
3 |
|
->addColonyShieldLayer(); |
54
|
|
|
|
55
|
3 |
|
if ($this->colonyFunctionManager->hasFunction($this->colony, BuildingFunctionEnum::BUILDING_FUNCTION_SUBSPACE_TELESCOPE)) { |
56
|
|
|
$panelLayerCreation->addSubspaceLayer($this->colony->getUser()->getId(), SubspaceLayerTypeEnum::IGNORE_USER); |
57
|
|
|
} |
58
|
3 |
|
if ($this->colonyFunctionManager->hasFunction($this->colony, BuildingFunctionEnum::BUILDING_FUNCTION_SUBSPACE_TELESCOPE)) { |
59
|
|
|
$panelLayerCreation->addSubspaceLayer($this->colony->getUser()->getId(), SubspaceLayerTypeEnum::IGNORE_USER); |
60
|
|
|
} |
61
|
|
|
|
62
|
3 |
|
$this->layers = $panelLayerCreation->build($this); |
63
|
|
|
} |
64
|
|
|
|
65
|
3 |
|
#[Override] |
66
|
|
|
protected function getEntryCallable(): callable |
67
|
|
|
{ |
68
|
3 |
|
return fn(int $x, int $y): VisualPanelElementInterface => new ColonyScanPanelEntry( |
69
|
3 |
|
$x, |
70
|
3 |
|
$y, |
71
|
3 |
|
$this->layers |
72
|
3 |
|
); |
73
|
|
|
} |
74
|
|
|
|
75
|
3 |
|
#[Override] |
76
|
|
|
protected function getPanelViewportPercentage(): int |
77
|
|
|
{ |
78
|
3 |
|
return 8; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
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