fix issue where shipyard produces ships with modules without requiring items for the modules if the ship's layout was never changed

This commit is contained in:
2026-07-09 21:29:04 +02:00
parent 88bc4f2170
commit cd966daba9
2 changed files with 56 additions and 1 deletions

View File

@@ -870,7 +870,16 @@ void BuildingSystem::tickShipyardProduction(Tick currentTick)
{
const Port& p = building.outputPorts[0];
const QVector2D spawnPos(p.tile.x() + 0.5f, p.tile.y() + 0.5f);
m_spawnShip(building.recipeId, spawnPos, building.shipLayout);
// A shipyard builds exactly what the player configured and
// paid for. When no layout is set it produces a bare hull, so
// pass an explicit empty layout rather than nullopt: the latter
// would make ShipSystem fall back to the schematic's
// defaultModules (a wave-only loadout) and yield free weapons.
const std::optional<ShipLayoutConfig> layout =
building.shipLayout.has_value()
? building.shipLayout
: std::make_optional<ShipLayoutConfig>();
m_spawnShip(building.recipeId, spawnPos, layout);
}
building.production = std::nullopt;
}