|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
8
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
9
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
10
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
11
|
|
|
use Doctrine\ORM\Mapping\OneToOne; |
|
12
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
13
|
|
|
use Override; |
|
|
|
|
|
|
14
|
|
|
use Stu\Component\Spacecraft\SpacecraftStateEnum; |
|
15
|
|
|
use Stu\Component\Spacecraft\SpacecraftTypeEnum; |
|
16
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
|
17
|
|
|
use Stu\Component\Station\StationUtility; |
|
18
|
|
|
use Stu\Lib\Transfer\TransferEntityTypeEnum; |
|
19
|
|
|
use Stu\Orm\Repository\ShipRepository; |
|
20
|
|
|
|
|
21
|
|
|
#[Table(name: 'stu_ship')] |
|
22
|
|
|
#[Entity(repositoryClass: ShipRepository::class)] |
|
23
|
|
|
class Ship extends Spacecraft implements ShipInterface |
|
24
|
|
|
{ |
|
25
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
26
|
|
|
private ?int $fleet_id = null; |
|
27
|
|
|
|
|
28
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
29
|
|
|
private ?int $docked_to_id = null; |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
#[Column(type: 'boolean')] |
|
32
|
|
|
private bool $is_fleet_leader = false; |
|
33
|
|
|
|
|
34
|
|
|
#[ManyToOne(targetEntity: 'Fleet', inversedBy: 'ships')] |
|
35
|
|
|
#[JoinColumn(name: 'fleet_id', referencedColumnName: 'id')] |
|
36
|
|
|
private ?FleetInterface $fleet = null; |
|
37
|
|
|
|
|
38
|
|
|
#[ManyToOne(targetEntity: 'Station', inversedBy: 'dockedShips')] |
|
39
|
|
|
#[JoinColumn(name: 'docked_to_id', referencedColumnName: 'id')] |
|
40
|
|
|
private ?StationInterface $dockedTo = null; |
|
41
|
|
|
|
|
42
|
|
|
#[OneToOne(targetEntity: 'Spacecraft', mappedBy: 'tractoredShip')] |
|
43
|
|
|
private ?SpacecraftInterface $tractoringSpacecraft = null; |
|
44
|
|
|
|
|
45
|
|
|
#[OneToOne(targetEntity: 'MiningQueue', mappedBy: 'ship')] |
|
46
|
|
|
private ?MiningQueueInterface $miningqueue = null; |
|
47
|
|
|
|
|
48
|
|
|
#[OneToOne(targetEntity: 'ColonyShipQueue', mappedBy: 'ship')] |
|
49
|
|
|
private ?ColonyShipQueueInterface $colonyShipQueue = null; |
|
50
|
|
|
|
|
51
|
20 |
|
#[Override] |
|
52
|
|
|
public function getType(): SpacecraftTypeEnum |
|
53
|
|
|
{ |
|
54
|
20 |
|
return SpacecraftTypeEnum::SHIP; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
#[Override] |
|
58
|
|
|
public function getFleetId(): ?int |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->fleet_id; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
#[Override] |
|
64
|
|
|
public function setFleetId(?int $fleetId): ShipInterface |
|
65
|
|
|
{ |
|
66
|
|
|
$this->fleet_id = $fleetId; |
|
67
|
|
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
#[Override] |
|
71
|
|
|
public function isUnderRetrofit(): bool |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->getState() === SpacecraftStateEnum::SHIP_STATE_RETROFIT; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
5 |
|
#[Override] |
|
77
|
|
|
public function getIsFleetLeader(): bool |
|
78
|
|
|
{ |
|
79
|
5 |
|
return $this->getFleet() !== null && $this->is_fleet_leader; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
#[Override] |
|
83
|
|
|
public function setIsFleetLeader(bool $isFleetLeader): ShipInterface |
|
84
|
|
|
{ |
|
85
|
|
|
$this->is_fleet_leader = $isFleetLeader; |
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
14 |
|
#[Override] |
|
90
|
|
|
public function getFleet(): ?FleetInterface |
|
91
|
|
|
{ |
|
92
|
14 |
|
return $this->fleet; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
#[Override] |
|
96
|
|
|
public function setFleet(?FleetInterface $fleet): ShipInterface |
|
97
|
|
|
{ |
|
98
|
|
|
$this->fleet = $fleet; |
|
99
|
|
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
5 |
|
#[Override] |
|
103
|
|
|
public function isFleetLeader(): bool |
|
104
|
|
|
{ |
|
105
|
5 |
|
return $this->getIsFleetLeader(); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
1 |
|
#[Override] |
|
109
|
|
|
public function isTractored(): bool |
|
110
|
|
|
{ |
|
111
|
1 |
|
return $this->getTractoringSpacecraft() !== null; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
1 |
|
#[Override] |
|
115
|
|
|
public function dockedOnTradePost(): bool |
|
116
|
|
|
{ |
|
117
|
1 |
|
$dockedTo = $this->getDockedTo(); |
|
118
|
|
|
|
|
119
|
1 |
|
return $dockedTo !== null |
|
120
|
1 |
|
&& $dockedTo->getTradePost() !== null; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
5 |
|
#[Override] |
|
124
|
|
|
public function getTractoringSpacecraft(): ?SpacecraftInterface |
|
125
|
|
|
{ |
|
126
|
5 |
|
return $this->tractoringSpacecraft; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
#[Override] |
|
130
|
|
|
public function setTractoringSpacecraft(?SpacecraftInterface $spacecraft): ShipInterface |
|
131
|
|
|
{ |
|
132
|
|
|
$this->tractoringSpacecraft = $spacecraft; |
|
133
|
|
|
return $this; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
16 |
|
#[Override] |
|
137
|
|
|
public function getDockedTo(): ?StationInterface |
|
138
|
|
|
{ |
|
139
|
16 |
|
return $this->dockedTo; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
#[Override] |
|
143
|
|
|
public function setDockedTo(?StationInterface $dockedTo): ShipInterface |
|
144
|
|
|
{ |
|
145
|
|
|
$this->dockedTo = $dockedTo; |
|
146
|
|
|
return $this; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
1 |
|
#[Override] |
|
150
|
|
|
public function canBuildConstruction(): bool |
|
151
|
|
|
{ |
|
152
|
1 |
|
return StationUtility::canShipBuildConstruction($this); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
5 |
|
#[Override] |
|
156
|
|
|
public function isWarped(): bool |
|
157
|
|
|
{ |
|
158
|
5 |
|
$tractoringShip = $this->getTractoringSpacecraft(); |
|
159
|
|
|
|
|
160
|
5 |
|
if ($tractoringShip !== null) { |
|
161
|
|
|
return $tractoringShip->getWarpDriveState(); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
5 |
|
return parent::getWarpDriveState(); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
1 |
|
#[Override] |
|
168
|
|
|
public function getAstroState(): bool |
|
169
|
|
|
{ |
|
170
|
1 |
|
return $this->getSystemState(SpacecraftSystemTypeEnum::ASTRO_LABORATORY); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
1 |
|
#[Override] |
|
174
|
|
|
public function isBussardCollectorHealthy(): bool |
|
175
|
|
|
{ |
|
176
|
1 |
|
return $this->isSystemHealthy(SpacecraftSystemTypeEnum::BUSSARD_COLLECTOR); |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
1 |
|
#[Override] |
|
180
|
|
|
public function getMiningQueue(): ?MiningQueueInterface |
|
181
|
|
|
{ |
|
182
|
1 |
|
return $this->miningqueue; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
#[Override] |
|
186
|
|
|
public function getColonyShipQueue(): ?ColonyShipQueueInterface |
|
187
|
|
|
{ |
|
188
|
|
|
return $this->colonyShipQueue; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
#[Override] |
|
192
|
|
|
public function setColonyShipQueue(?ColonyShipQueueInterface $queue): ShipInterface |
|
193
|
|
|
{ |
|
194
|
|
|
$this->colonyShipQueue = $queue; |
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
16 |
|
#[Override] |
|
199
|
|
|
public function getTransferEntityType(): TransferEntityTypeEnum |
|
200
|
|
|
{ |
|
201
|
16 |
|
return TransferEntityTypeEnum::SHIP; |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|
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