Skip to content

Commit

Permalink
effect handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Huxinator committed Feb 4, 2025
1 parent 6c5ef55 commit 40a52be
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function handleIncomingSpacecraft(SpacecraftWrapperInterface $wrapper, Me
$this->spacecraftSystemManager->deactivate($wrapper, SpacecraftSystemTypeEnum::CLOAK, true);

$messages->addInformation(
sprintf("[color=yellow]Tarnung durch %s ausgefallen.[/color]", $spacecraft->getLocation()->getFieldType()->getName()),
sprintf("[color=yellow]Ionische Dispersion durch %s hat die Phasenmodulation des Tarnsystems gestört<br>Tarnsystem ausgefallen[/color]", $spacecraft->getLocation()->getFieldType()->getName()),
$wrapper->get()->getUser()->getId()
);
}
Expand Down
30 changes: 30 additions & 0 deletions src/Component/Map/Effects/Type/LSSMalfunctionEffectHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Stu\Component\Map\Effects\Type;

use Stu\Lib\Information\InformationInterface;
use Stu\Module\Spacecraft\Lib\Message\MessageCollectionInterface;
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;

class LSSMalfunctionEffectHandler implements EffectHandlerInterface
{
public function __construct() {}

public function handleSpacecraftTick(SpacecraftWrapperInterface $wrapper, InformationInterface $information): void
{
// not needed
}

public function handleIncomingSpacecraft(SpacecraftWrapperInterface $wrapper, MessageCollectionInterface $messages): void
{
$spacecraft = $wrapper->get();

$messages->addInformation(
sprintf("[color=yellow]Interferenz im Subraum durch %s detektiert <br>
Langstreckensensoren sind aktiv, liefern jedoch keine verwertbaren Daten[/color]", $spacecraft->getLocation()->getFieldType()->getName()),
$wrapper->get()->getUser()->getId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ public function handleIncomingSpacecraft(SpacecraftWrapperInterface $wrapper, Me
$warpdrive->lowerWarpDrive($loss)->update();

$messages->addInformation(
sprintf("[color=yellow]Leck im Warpantrieb durch %s. (Verlust: %d)[/color]", $spacecraft->getLocation()->getFieldType()->getName(), $loss),
sprintf(
"[color=yellow]Fluktuationen im Warpplasmaleitungssystem durch %s festgestellt<br>Warpantriebs-Leckage verursacht Kapazitätsverlust von %s Cochrane[/color]",
$spacecraft->getLocation()->getFieldType()->getName(),
$loss
),
$wrapper->get()->getUser()->getId()
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Component/Map/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Stu\Component\Map\Effects\EffectHandling;
use Stu\Component\Map\Effects\EffectHandlingInterface;
use Stu\Component\Map\Effects\Type\CloakUnuseableEffectHandler;
use Stu\Component\Map\Effects\Type\LSSMalfunctionEffectHandler;
use Stu\Component\Map\Effects\Type\WarpdriveLeakEffectHandler;
use Stu\Lib\Map\FieldTypeEffectEnum;

Expand All @@ -18,6 +19,7 @@
'handlerList',
[
FieldTypeEffectEnum::CLOAK_UNUSEABLE->value => autowire(CloakUnuseableEffectHandler::class),
FieldTypeEffectEnum::LSS_MALFUNCTION->value => autowire(LSSMalfunctionEffectHandler::class),
FieldTypeEffectEnum::WARPDRIVE_LEAK->value => autowire(WarpdriveLeakEffectHandler::class)
]
),
Expand Down
1 change: 0 additions & 1 deletion src/Lib/Map/FieldTypeEffectEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ enum FieldTypeEffectEnum: string
public function hasHandler(): bool
{
return match ($this) {
self::LSS_MALFUNCTION => false,
self::NO_SPACECRAFT_COUNT => false,
self::DUBIOUS_SPACECRAFT_COUNT => false,
default => true
Expand Down

0 comments on commit 40a52be

Please sign in to comment.