define ship roles via added modules and allow multiple weapons

This commit is contained in:
2026-06-01 22:57:53 +02:00
parent f363f7a67c
commit 9d0a60a93b
31 changed files with 873 additions and 407 deletions

View File

@@ -34,7 +34,7 @@ void WaveSystem::tickWaveScheduler(Tick currentTick, ShipSystem& ships,
if (currentTick >= entry.spawnAt)
{
ships.spawn(entry.schematicId, entry.level, entry.position,
/*isEnemy=*/true);
/*isEnemy=*/true, entry.layout);
}
else
{
@@ -90,8 +90,9 @@ std::vector<WaveSystem::SpawnEntry> WaveSystem::composeWave(Tick currentTick,
// Build eligible ship list with their costs at the current level.
struct EligibleShip
{
std::string schematicId;
double cost;
std::string schematicId;
double cost;
std::vector<PlacedModule> defaultModules;
};
std::vector<EligibleShip> eligible;
for (const ShipDef& def : m_config.ships.ships)
@@ -100,8 +101,9 @@ std::vector<WaveSystem::SpawnEntry> WaveSystem::composeWave(Tick currentTick,
if (cost > 0.0)
{
EligibleShip es;
es.schematicId = def.id;
es.cost = cost;
es.schematicId = def.id;
es.cost = cost;
es.defaultModules = def.defaultModules;
eligible.push_back(es);
}
}
@@ -151,11 +153,12 @@ std::vector<WaveSystem::SpawnEntry> WaveSystem::composeWave(Tick currentTick,
budget -= chosen.cost;
SpawnEntry entry;
entry.schematicId = chosen.schematicId;
entry.level = shipLevel;
entry.spawnAt = 0; // set below after all picks are done
entry.position = QVector2D(xDist(m_rng),
static_cast<float>(yDist(m_rng)) + 0.5f);
entry.schematicId = chosen.schematicId;
entry.level = shipLevel;
entry.spawnAt = 0; // set below after all picks are done
entry.position = QVector2D(xDist(m_rng),
static_cast<float>(yDist(m_rng)) + 0.5f);
entry.layout.placedModules = chosen.defaultModules;
picked.push_back(entry);
}