depend on the registry instead of DebrisSystem in the AI path
This commit is contained in:
@@ -101,14 +101,14 @@ struct Fixture
|
||||
void decide()
|
||||
{
|
||||
ships.clearMovementIntents();
|
||||
ai.tick(admin, state, scraps);
|
||||
ai.tick(admin, state);
|
||||
}
|
||||
|
||||
// World mutation: collection/delivery and healing.
|
||||
void runModules()
|
||||
{
|
||||
beamEvents.clear();
|
||||
salvager.tick(tick, scraps, state, beamEvents);
|
||||
salvager.tick(tick, state, beamEvents);
|
||||
repair.tick(tick, beamEvents);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ struct Fixture
|
||||
void salvageTick()
|
||||
{
|
||||
beamEvents.clear();
|
||||
salvager.tick(tick, scraps, state, beamEvents);
|
||||
salvager.tick(tick, state, beamEvents);
|
||||
++tick;
|
||||
}
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ TEST_CASE("CombatSystem: scrap is spawned on ship death", "[combat]")
|
||||
|
||||
sim.tick();
|
||||
|
||||
const std::vector<DebrisInfo> scraps = sim.getDebrisSystem().getAllDebrisInfo();
|
||||
const std::vector<DebrisInfo> scraps = getAllDebrisInfo(sim.getAdmin());
|
||||
REQUIRE(scraps.size() == 1);
|
||||
CHECK(sim.getAdmin().get<DebrisComponent>(scraps[0].entity).amount == 59);
|
||||
}
|
||||
|
||||
@@ -116,16 +116,16 @@ TEST_CASE("DebrisSystem: collectOne depletes one scrap and keeps the debris unti
|
||||
|
||||
const entt::entity e = ss.spawn(QVector2D(0.0f, 0.0f), 3, 100);
|
||||
|
||||
REQUIRE(ss.collectOne(e));
|
||||
REQUIRE(collectOne(admin, e));
|
||||
REQUIRE(admin.isValid(e));
|
||||
REQUIRE(admin.get<DebrisComponent>(e).amount == 2);
|
||||
|
||||
REQUIRE(ss.collectOne(e));
|
||||
REQUIRE(collectOne(admin, e));
|
||||
REQUIRE(admin.isValid(e));
|
||||
REQUIRE(admin.get<DebrisComponent>(e).amount == 1);
|
||||
|
||||
// Final unit collected: the debris is removed once depleted.
|
||||
REQUIRE(ss.collectOne(e));
|
||||
REQUIRE(collectOne(admin, e));
|
||||
REQUIRE_FALSE(admin.isValid(e));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ TEST_CASE("DebrisSystem: collectOne returns false for an invalid entity", "[debr
|
||||
EntityAdmin admin;
|
||||
DebrisSystem ss(admin);
|
||||
|
||||
REQUIRE_FALSE(ss.collectOne(entt::null));
|
||||
REQUIRE_FALSE(collectOne(admin, entt::null));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -149,7 +149,7 @@ TEST_CASE("DebrisSystem: getAllDebrisInfo returns all spawned debris", "[debris]
|
||||
ss.spawn(QVector2D(1.0f, 2.0f), 3, 100);
|
||||
ss.spawn(QVector2D(4.0f, 5.0f), 6, 200);
|
||||
|
||||
const std::vector<DebrisInfo> info = ss.getAllDebrisInfo();
|
||||
const std::vector<DebrisInfo> info = getAllDebrisInfo(admin);
|
||||
REQUIRE(info.size() == 2);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ TEST_CASE("DebrisSystem: getAllDebrisInfo reports each debris entry.s remaining
|
||||
const entt::entity a = ss.spawn(QVector2D(1.0f, 2.0f), 3, 100);
|
||||
const entt::entity b = ss.spawn(QVector2D(4.0f, 5.0f), 6, 200);
|
||||
|
||||
const std::vector<DebrisInfo> info = ss.getAllDebrisInfo();
|
||||
const std::vector<DebrisInfo> info = getAllDebrisInfo(admin);
|
||||
REQUIRE(info.size() == 2);
|
||||
for (const DebrisInfo& i : info)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user