|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Ship\Lib\Movement\Component\Consequence\Flight; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use Stu\Module\Ship\Lib\Message\MessageCollectionInterface; |
|
9
|
|
|
use Stu\Module\Ship\Lib\Message\MessageFactoryInterface; |
|
10
|
|
|
use Stu\Module\Ship\Lib\Movement\Component\Consequence\AbstractFlightConsequence; |
|
11
|
|
|
use Stu\Module\Ship\Lib\Movement\Route\FlightRouteInterface; |
|
12
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperInterface; |
|
13
|
|
|
use Stu\Component\Ship\ShipEnum; |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
class DockConsequence extends AbstractFlightConsequence |
|
16
|
|
|
{ |
|
17
|
5 |
|
public function __construct( |
|
18
|
|
|
private MessageFactoryInterface $messageFactory |
|
19
|
5 |
|
) {} |
|
20
|
|
|
|
|
21
|
3 |
|
#[Override] |
|
22
|
|
|
protected function triggerSpecific( |
|
23
|
|
|
ShipWrapperInterface $wrapper, |
|
24
|
|
|
FlightRouteInterface $flightRoute, |
|
25
|
|
|
MessageCollectionInterface $messages |
|
26
|
|
|
): void { |
|
27
|
|
|
|
|
28
|
3 |
|
$ship = $wrapper->get(); |
|
29
|
|
|
|
|
30
|
3 |
|
if ($ship->getDockedTo() !== null) { |
|
31
|
|
|
|
|
32
|
2 |
|
$message = $this->messageFactory->createMessage(null, $ship->getUser()->getId()); |
|
33
|
2 |
|
$messages->add($message); |
|
34
|
2 |
|
$epsSystem = $wrapper->getEpsSystemData(); |
|
35
|
2 |
|
if ($epsSystem === null || $epsSystem->getEps() < ShipEnum::SYSTEM_ECOST_DOCK) { |
|
36
|
|
|
$message->add(sprintf('%s konnte wegen Energiemangels nicht abgedockt werden', $ship->getName())); |
|
37
|
|
|
return; |
|
38
|
|
|
} else { |
|
39
|
2 |
|
$epsSystem->lowerEps(ShipEnum::SYSTEM_ECOST_DOCK)->update(); |
|
40
|
2 |
|
$ship->setDockedTo(null); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
2 |
|
if ($ship->isTractored()) { |
|
44
|
|
|
//TODO andockschleuse schrotten, wenn passiv |
|
45
|
1 |
|
$message->add(sprintf('Die %s wurde abgedockt', $ship->getName())); |
|
46
|
|
|
} else { |
|
47
|
1 |
|
$message->add(sprintf('Die %s wurde abgedockt', $ship->getName())); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
} |
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