Fixing minor bugs

This commit is contained in:
Vladislav Khorev committed 2026-04-25 20:30:27 +03:00
1 parent c7b3f04cd4
commit 3495d28edf
9 files changed
+115 -25

No files matched your search

+28 -2
View File
@@ -169,6 +169,8 @@ namespace ZL
params1.scriptPath = "resources/start.lua";
params1.playerPosition = Eigen::Vector3f::Zero();
params1.ghostPosition = Eigen::Vector3f(0.f, 0.f, -20.f);
params1.teleportPosition = Eigen::Vector3f(-2.03001f, 0.f, -4.95618f);
params1.teleportRadius = 1.5f;
location1 = std::make_shared<Location>(renderer, inventory);
location1->setup(params1);
@@ -184,11 +186,35 @@ namespace ZL
params2.npcsJsonPath = "resources/config2/npcs2.json";
params2.ghostPosition = Eigen::Vector3f(700.f, 0.f, 700.f);
params2.teleportPosition = Eigen::Vector3f(-6.45, 0.0, 7.82);
params2.teleportRadius = 1.5f;
location2 = std::make_shared<Location>(renderer, inventory);
location2->setup(params2);
currentLocation = location1;
// Teleport callbacks: stepping into a location's zone hands the player
// to the other location at *its* teleport position. We pre-arm the
// destination's playerInTeleportZone so the player must walk out and
// back in before they can teleport again.
location1->onTeleport = [this]() {
std::cout << "[TELEPORT] location 1 -> location 2" << std::endl;
currentLocation = location2;
if (currentLocation->player) {
currentLocation->player->position = currentLocation->teleportPosition;
currentLocation->player->setTarget(currentLocation->teleportPosition);
}
currentLocation->playerInTeleportZone = true;
};
location2->onTeleport = [this]() {
std::cout << "[TELEPORT] location 2 -> location 1" << std::endl;
currentLocation = location1;
if (currentLocation->player) {
currentLocation->player->position = currentLocation->teleportPosition;
currentLocation->player->setTarget(currentLocation->teleportPosition);
}
currentLocation->playerInTeleportZone = true;
};
currentLocation = location2;
std::cout << "Load resurces step 5" << std::endl;