|
|
@ -12,8 +12,7 @@ TEST_CASE("confirm component loading works", "[components]") { |
|
|
|
std::vector<std::string> test_list{ |
|
|
|
std::vector<std::string> test_list{ |
|
|
|
"assets/enemies.json", "assets/items.json", "assets/devices.json"}; |
|
|
|
"assets/enemies.json", "assets/items.json", "assets/devices.json"}; |
|
|
|
|
|
|
|
|
|
|
|
components::ComponentMap comp_map; |
|
|
|
components::init(); |
|
|
|
components::configure(comp_map); |
|
|
|
|
|
|
|
DinkyECS::World world; |
|
|
|
DinkyECS::World world; |
|
|
|
|
|
|
|
|
|
|
|
for(auto test_data : test_list) { |
|
|
|
for(auto test_data : test_list) { |
|
|
@ -24,7 +23,7 @@ TEST_CASE("confirm component loading works", "[components]") { |
|
|
|
auto& components = data["components"]; |
|
|
|
auto& components = data["components"]; |
|
|
|
fmt::println("TEST COMPONENT: {} from file {}", key, test_data); |
|
|
|
fmt::println("TEST COMPONENT: {} from file {}", key, test_data); |
|
|
|
auto ent = world.entity(); |
|
|
|
auto ent = world.entity(); |
|
|
|
components::configure_entity(comp_map, world, ent, components); |
|
|
|
components::configure_entity(world, ent, components); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -42,21 +41,19 @@ TEST_CASE("make sure json_mods works", "[components]") { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// this then confirms everything else about the json conversion
|
|
|
|
// this then confirms everything else about the json conversion
|
|
|
|
|
|
|
|
components::init(); |
|
|
|
ComponentMap comp_map; |
|
|
|
|
|
|
|
components::configure(comp_map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DinkyECS::World world; |
|
|
|
DinkyECS::World world; |
|
|
|
auto rat_king = world.entity(); |
|
|
|
auto rat_king = world.entity(); |
|
|
|
|
|
|
|
|
|
|
|
components::configure_entity(comp_map, world, rat_king, config["RAT_KING"]["components"]); |
|
|
|
components::configure_entity(world, rat_king, config["RAT_KING"]["components"]); |
|
|
|
|
|
|
|
|
|
|
|
auto boss = world.get<BossFight>(rat_king); |
|
|
|
auto boss = world.get<BossFight>(rat_king); |
|
|
|
REQUIRE(boss.stage == std::nullopt); |
|
|
|
REQUIRE(boss.stage == std::nullopt); |
|
|
|
|
|
|
|
|
|
|
|
// now load the other one for the other way optional is used
|
|
|
|
// now load the other one for the other way optional is used
|
|
|
|
auto devils_fingers = world.entity(); |
|
|
|
auto devils_fingers = world.entity(); |
|
|
|
components::configure_entity(comp_map, world, devils_fingers, config["DEVILS_FINGERS"]["components"]); |
|
|
|
components::configure_entity(world, devils_fingers, config["DEVILS_FINGERS"]["components"]); |
|
|
|
auto boss2 = world.get<BossFight>(devils_fingers); |
|
|
|
auto boss2 = world.get<BossFight>(devils_fingers); |
|
|
|
REQUIRE(boss2.stage != std::nullopt); |
|
|
|
REQUIRE(boss2.stage != std::nullopt); |
|
|
|
} |
|
|
|
} |
|
|
|