1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stu\Lib\Interaction\Member; |
4
|
|
|
|
5
|
|
|
use Override; |
|
|
|
|
6
|
|
|
use Stu\Component\Anomaly\Type\AnomalyTypeEnum; |
7
|
|
|
use Stu\Component\Spacecraft\Nbs\NbsUtilityInterface; |
8
|
|
|
use Stu\Lib\Interaction\InteractionCheckType; |
9
|
|
|
use Stu\Lib\Transfer\CommodityTransferInterface; |
10
|
|
|
use Stu\Module\Ship\Lib\TholianWebUtilInterface; |
11
|
|
|
use Stu\Orm\Entity\MapInterface; |
12
|
|
|
use Stu\Orm\Entity\SpacecraftInterface; |
13
|
|
|
use Stu\Orm\Entity\StarSystemMapInterface; |
14
|
|
|
use Stu\Orm\Entity\UserInterface; |
15
|
|
|
|
16
|
|
|
class SpacecraftMember implements InteractionMemberInterface |
17
|
|
|
{ |
18
|
15 |
|
public function __construct( |
19
|
|
|
private NbsUtilityInterface $nbsUtility, |
20
|
|
|
private TholianWebUtilInterface $tholianWebUtil, |
21
|
|
|
private CommodityTransferInterface $commodityTransfer, |
22
|
|
|
private SpacecraftInterface $spacecraft |
23
|
15 |
|
) {} |
24
|
|
|
|
25
|
10 |
|
#[Override] |
26
|
|
|
public function get(): SpacecraftInterface |
27
|
|
|
{ |
28
|
10 |
|
return $this->spacecraft; |
29
|
|
|
} |
30
|
|
|
|
31
|
13 |
|
#[Override] |
32
|
|
|
public function canAccess( |
33
|
|
|
InteractionMemberInterface $other, |
34
|
|
|
callable $shouldCheck |
35
|
|
|
): ?InteractionCheckType { |
36
|
|
|
|
37
|
|
|
if ( |
38
|
13 |
|
$shouldCheck(InteractionCheckType::EXPECT_SOURCE_UNSHIELDED) |
39
|
13 |
|
&& $this->spacecraft->getShieldState() |
40
|
|
|
) { |
41
|
|
|
return InteractionCheckType::EXPECT_SOURCE_UNSHIELDED; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
if ( |
45
|
13 |
|
$shouldCheck(InteractionCheckType::EXPECT_SOURCE_UNCLOAKED) |
46
|
13 |
|
&& $this->spacecraft->isCloaked() |
47
|
|
|
) { |
48
|
|
|
return InteractionCheckType::EXPECT_SOURCE_UNCLOAKED; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if ( |
52
|
13 |
|
$shouldCheck(InteractionCheckType::EXPECT_SOURCE_TACHYON) |
53
|
13 |
|
&& $other instanceof SpacecraftMember |
54
|
13 |
|
&& $other->get()->isCloaked() |
55
|
13 |
|
&& !$this->nbsUtility->isTachyonActive($this->spacecraft) |
56
|
|
|
) { |
57
|
|
|
return InteractionCheckType::EXPECT_SOURCE_TACHYON; |
58
|
|
|
} |
59
|
|
|
|
60
|
13 |
|
return null; |
61
|
|
|
} |
62
|
|
|
|
63
|
12 |
|
#[Override] |
64
|
|
|
public function canBeAccessedFrom( |
65
|
|
|
InteractionMemberInterface $other, |
66
|
|
|
bool $isFriend, |
67
|
|
|
callable $shouldCheck |
68
|
|
|
): ?InteractionCheckType { |
69
|
|
|
|
70
|
12 |
|
$otherEntity = $other->get(); |
71
|
|
|
if ( |
72
|
12 |
|
$otherEntity instanceof SpacecraftInterface |
73
|
12 |
|
&& $shouldCheck(InteractionCheckType::EXPECT_TARGET_DOCKED_OR_NO_ION_STORM) |
74
|
12 |
|
&& $this->spacecraft->getLocation()->hasAnomaly(AnomalyTypeEnum::ION_STORM) |
75
|
12 |
|
&& !$this->commodityTransfer->isDockTransfer($this->spacecraft, $otherEntity) |
76
|
|
|
) { |
77
|
|
|
return InteractionCheckType::EXPECT_TARGET_DOCKED_OR_NO_ION_STORM; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
if ( |
81
|
12 |
|
$shouldCheck(InteractionCheckType::EXPECT_TARGET_SAME_USER) |
82
|
12 |
|
&& $this->spacecraft->getUser() !== $other->getUser() |
83
|
|
|
) { |
84
|
|
|
return InteractionCheckType::EXPECT_TARGET_SAME_USER; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
if ( |
88
|
12 |
|
$shouldCheck(InteractionCheckType::EXPECT_TARGET_UNSHIELDED) |
89
|
12 |
|
&& $this->spacecraft->getShieldState() && !$isFriend |
90
|
|
|
) { |
91
|
|
|
return InteractionCheckType::EXPECT_TARGET_UNSHIELDED; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
if ( |
95
|
12 |
|
$shouldCheck(InteractionCheckType::EXPECT_TARGET_UNCLOAKED) |
96
|
12 |
|
&& $this->spacecraft->isCloaked() |
97
|
|
|
) { |
98
|
|
|
return InteractionCheckType::EXPECT_TARGET_UNCLOAKED; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
if ( |
102
|
12 |
|
$shouldCheck(InteractionCheckType::EXPECT_TARGET_ALSO_IN_FINISHED_WEB) |
103
|
12 |
|
&& $this->tholianWebUtil->isTargetOutsideFinishedTholianWeb($other->get(), $this->spacecraft) |
104
|
|
|
) { |
105
|
|
|
return InteractionCheckType::EXPECT_TARGET_ALSO_IN_FINISHED_WEB; |
106
|
|
|
} |
107
|
|
|
|
108
|
12 |
|
return null; |
109
|
|
|
} |
110
|
|
|
|
111
|
15 |
|
#[Override] |
112
|
|
|
public function getLocation(): MapInterface|StarSystemMapInterface |
113
|
|
|
{ |
114
|
15 |
|
return $this->spacecraft->getLocation(); |
115
|
|
|
} |
116
|
|
|
|
117
|
15 |
|
#[Override] |
118
|
|
|
public function getUser(): ?UserInterface |
119
|
|
|
{ |
120
|
15 |
|
return $this->spacecraft->getUser(); |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
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