change repair_tool application and add beams for salvager and repair_tool

This commit is contained in:
2026-06-18 22:14:09 +02:00
parent 7924e037aa
commit 9573b9789a
37 changed files with 498 additions and 199 deletions

View File

@@ -93,6 +93,38 @@ TEST_CASE("ScrapSystem: consume returns nullopt for invalid entity", "[scrap]")
REQUIRE_FALSE(amount.has_value());
}
// ---------------------------------------------------------------------------
// collectOne
// ---------------------------------------------------------------------------
TEST_CASE("ScrapSystem: collectOne depletes one scrap and keeps the pile until empty", "[scrap]")
{
EntityAdmin admin;
ScrapSystem ss(admin);
const entt::entity e = ss.spawn(QVector2D(0.0f, 0.0f), 3, 100);
REQUIRE(ss.collectOne(e));
REQUIRE(admin.isValid(e));
REQUIRE(admin.get<ScrapDataComponent>(e).amount == 2);
REQUIRE(ss.collectOne(e));
REQUIRE(admin.isValid(e));
REQUIRE(admin.get<ScrapDataComponent>(e).amount == 1);
// Final unit collected: the pile is removed once depleted.
REQUIRE(ss.collectOne(e));
REQUIRE_FALSE(admin.isValid(e));
}
TEST_CASE("ScrapSystem: collectOne returns false for an invalid entity", "[scrap]")
{
EntityAdmin admin;
ScrapSystem ss(admin);
REQUIRE_FALSE(ss.collectOne(entt::null));
}
// ---------------------------------------------------------------------------
// allScrapInfo
// ---------------------------------------------------------------------------