|
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\BuildingEnum; |
|
|
|
|
|
|
9
|
|
|
use Stu\Component\Colony\ColonyFunctionManagerInterface; |
|
10
|
|
|
use Stu\Lib\Map\VisualPanel\AbstractVisualPanel; |
|
11
|
|
|
use Stu\Lib\Map\VisualPanel\Layer\DataProvider\Shipcount\ShipcountLayerTypeEnum; |
|
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
|
|
|
public function __construct( |
|
22
|
|
|
PanelLayerCreationInterface $panelLayerCreation, |
|
23
|
|
|
private ColonyInterface $colony, |
|
24
|
|
|
private ColonyFunctionManagerInterface $colonyFunctionManager, |
|
25
|
|
|
LoggerUtilInterface $loggerUtil |
|
26
|
|
|
) { |
|
27
|
|
|
parent::__construct($panelLayerCreation, $loggerUtil); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
#[Override] |
|
31
|
|
|
protected function createBoundaries(): PanelBoundaries |
|
32
|
|
|
{ |
|
33
|
|
|
$range = 1; |
|
34
|
|
|
// TODO range = 2 for colony central |
|
35
|
|
|
|
|
36
|
|
|
if ($this->colonyFunctionManager->hasFunction($this->colony, BuildingEnum::BUILDING_FUNCTION_SUBSPACE_TELESCOPE)) { |
|
37
|
|
|
$range = 3; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
return PanelBoundaries::fromLocation($this->colony->getStarsystemMap(), $range); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
#[Override] |
|
44
|
|
|
protected function loadLayers(): void |
|
45
|
|
|
{ |
|
46
|
|
|
//TODO cloaked for colony central |
|
47
|
|
|
$panelLayerCreation = $this->panelLayerCreation |
|
48
|
|
|
->addShipCountLayer(false, null, ShipcountLayerTypeEnum::ALL, 0) |
|
49
|
|
|
->addSystemLayer() |
|
50
|
|
|
->addColonyShieldLayer(); |
|
51
|
|
|
|
|
52
|
|
|
if ($this->colonyFunctionManager->hasFunction($this->colony, BuildingEnum::BUILDING_FUNCTION_SUBSPACE_TELESCOPE)) { |
|
53
|
|
|
$panelLayerCreation->addSubspaceLayer($this->colony->getUser()->getId(), SubspaceLayerTypeEnum::IGNORE_USER); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
$this->layers = $panelLayerCreation->build($this); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
#[Override] |
|
60
|
|
|
protected function getEntryCallable(): callable |
|
61
|
|
|
{ |
|
62
|
|
|
return fn(int $x, int $y): VisualPanelElementInterface => new ColonyScanPanelEntry( |
|
63
|
|
|
$x, |
|
64
|
|
|
$y, |
|
65
|
|
|
$this->layers |
|
66
|
|
|
); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
#[Override] |
|
70
|
|
|
protected function getPanelViewportPercentage(): int |
|
71
|
|
|
{ |
|
72
|
|
|
return 8; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
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