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

@@ -108,23 +108,19 @@ TEST_CASE("ConfigLoader loads the committed bin/config/ configs end-to-end", "[c
REQUIRE(ironIngotIt->outputs.size() == 1);
REQUIRE_FALSE(ironIngotIt->outputs[0].probability.has_value());
// ships.toml — combat ships have a combat section; salvage ships don't.
// ships.toml — combat ships have default_modules with a weapon; salvage ships don't.
const auto interceptorIt = std::find_if(
cfg.ships.ships.begin(), cfg.ships.ships.end(),
[](const ShipDef& s) { return s.id == "interceptor"; });
REQUIRE(interceptorIt != cfg.ships.ships.end());
REQUIRE(interceptorIt->combat.has_value());
REQUIRE_FALSE(interceptorIt->salvage.has_value());
REQUIRE_FALSE(interceptorIt->repair.has_value());
REQUIRE(interceptorIt->combat->damageFormula.evaluate(5.0) == Approx(20.0)); // "10 + 2*x"
REQUIRE_FALSE(interceptorIt->defaultModules.empty());
REQUIRE(interceptorIt->defaultModules[0].moduleId == "laser_cannon");
const auto salvageShipIt = std::find_if(
cfg.ships.ships.begin(), cfg.ships.ships.end(),
[](const ShipDef& s) { return s.id == "salvage_ship"; });
REQUIRE(salvageShipIt != cfg.ships.ships.end());
REQUIRE_FALSE(salvageShipIt->combat.has_value());
REQUIRE(salvageShipIt->salvage.has_value());
REQUIRE(salvageShipIt->salvage->cargoCapacity == 10);
REQUIRE(salvageShipIt->defaultModules.empty());
// stations.toml
REQUIRE(cfg.stations.playerStation.level == 5);