Files
dota_factory/src/lib/ecs/system/ShipSystem.h
2026-06-15 09:16:56 +02:00

50 lines
1.5 KiB
C++

#pragma once
#include <map>
#include <optional>
#include <string>
#include <QVector2D>
#include "GameConfig.h"
#include "ShipLayout.h"
#include "entt/entity/entity.hpp"
class EntityAdmin;
class ShipSystem
{
public:
ShipSystem(const GameConfig& config, EntityAdmin& admin);
entt::entity spawn(const std::string& schematicId, int level, QVector2D position,
bool isEnemy = false,
const std::optional<ShipLayoutConfig>& layout = std::nullopt,
const std::map<std::string, int>& moduleLevelOverrides = {});
void despawn(entt::entity entity);
// Reset all movement intents to inactive before behavior systems run.
void clearMovementIntents();
// Set the rally point that newly spawned player combat ships will loiter at.
void setRallyPoint(QVector2D point);
// Release all gathered player combat ships to advance toward the enemy.
void triggerRallyDeparture();
// Controls whether newly spawned player ships receive a RetreatBehavior. The
// balancing tool disables this so arena fights stay symmetric and aggressive
// (REQ-BAL-SIM-AI); the main game keeps it enabled (REQ-SHP-RETREAT).
void setRetreatEnabled(bool enabled);
private:
const ShipDef* findShipDef(const std::string& schematicId) const;
const ModuleDef* findModuleDef(const std::string& id) const;
const GameConfig& m_config;
EntityAdmin& m_admin;
QVector2D m_rallyPoint;
bool m_retreatEnabled = true;
};