1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Lib\ModuleRumpWrapper; |
6
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
8
|
|
|
use RuntimeException; |
9
|
|
|
use Stu\Component\Spacecraft\SpacecraftModuleTypeEnum; |
10
|
|
|
use Stu\Module\Spacecraft\Lib\ModuleValueCalculator; |
11
|
|
|
use Stu\Orm\Entity\ModuleInterface; |
12
|
|
|
use Stu\Module\Spacecraft\Lib\ReactorWrapperInterface; |
13
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
14
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
15
|
|
|
|
16
|
|
|
final class ModuleRumpWrapperReactor extends ModuleRumpWrapperBase implements ModuleRumpWrapperInterface |
17
|
|
|
{ |
18
|
3 |
|
#[Override] |
19
|
|
|
public function getValue(?ModuleInterface $module = null): int |
20
|
|
|
{ |
21
|
3 |
|
$module ??= current($this->getModule()); |
22
|
3 |
|
if ($module === false) { |
23
|
|
|
return 0; |
24
|
|
|
} |
25
|
|
|
|
26
|
3 |
|
return (new ModuleValueCalculator())->calculateModuleValue( |
27
|
3 |
|
$this->rump, |
28
|
3 |
|
$module, |
29
|
3 |
|
$this->rump->getBaseReactor() |
30
|
3 |
|
); |
31
|
|
|
} |
32
|
|
|
|
33
|
3 |
|
#[Override] |
34
|
|
|
public function getSecondValue(?ModuleInterface $module = null): int |
35
|
|
|
{ |
36
|
3 |
|
$module ??= current($this->getModule()); |
37
|
3 |
|
if ($module === false) { |
38
|
|
|
return 0; |
39
|
|
|
} |
40
|
3 |
|
if ($module->getSystemType() == SpacecraftSystemTypeEnum::SINGULARITY_REACTOR) { |
41
|
3 |
|
return $this->getValue($module) * ReactorWrapperInterface::SINGULARITY_CAPACITY_MULTIPLIER; |
42
|
|
|
} |
43
|
3 |
|
if ($module->getSystemType() == SpacecraftSystemTypeEnum::FUSION_REACTOR) { |
44
|
|
|
return $this->getValue($module) * ReactorWrapperInterface::FUSIONCORE_CAPACITY_MULTIPLIER; |
45
|
|
|
} else { |
46
|
3 |
|
return $this->getValue($module) * ReactorWrapperInterface::WARPCORE_CAPACITY_MULTIPLIER; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
#[Override] |
51
|
|
|
public function getModuleType(): SpacecraftModuleTypeEnum |
52
|
|
|
{ |
53
|
|
|
return SpacecraftModuleTypeEnum::REACTOR; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
#[Override] |
57
|
|
|
public function apply(SpacecraftWrapperInterface $wrapper): void |
58
|
|
|
{ |
59
|
|
|
$reactorWrapper = $wrapper->getReactorWrapper(); |
60
|
|
|
if ($reactorWrapper === null) { |
61
|
|
|
throw new RuntimeException('this should not happen'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
if ($reactorWrapper->getLoad() > $this->getSecondValue() && $this->getSecondValue()) { |
65
|
|
|
$reactorWrapper->setLoad($this->getSecondValue()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$reactorWrapper->setOutput($this->getValue()); |
69
|
|
|
} |
70
|
|
|
} |
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