Working on fixing dorm bugs and some uni

This commit is contained in:
Vladislav Khorev committed 2026-06-16 14:05:18 +03:00
1 parent 939136c705
commit c891161d69
16 files changed
+200 -230

No files matched your search

+30
View File
@@ -67,6 +67,21 @@ namespace ZL {
npcs[index]->setTarget(Eigen::Vector3f(x, y, z), std::move(cb));
});
api.set_function("npc_rotate_to",
[loc](int index, float angle) {
auto& npcs = loc->npcs;
if (index < 0 || index >= static_cast<int>(npcs.size())) {
std::cerr << "[script] npc_rotate_to: index " << index
<< " out of range (0.." << npcs.size() - 1 << ")\n";
return;
}
const float rad = angle * static_cast<float>(M_PI) / 180.f;
std::cout << "[script] npc_rotate_to: index " << index << " angle " << angle << " degrees (" << rad << " radians)" << std::endl;
npcs[index]->targetFacingAngle = rad;
});
api.set_function("player_walk_to",
[loc](float x, float y, float z, sol::object on_arrived) {
@@ -502,6 +517,21 @@ namespace ZL {
npcs[index]->battle_state = 0;
});
api.set_function("player_set_position",
[loc](float x, float y, float z) {
Eigen::Vector3f pos(x, y, z);
loc->player->position = pos;
loc->player->homePosition = pos;
loc->player->setTarget(pos);
});
api.set_function("player_set_rotation",
[loc](float angle) {
const float rad = angle * static_cast<float>(M_PI) / 180.f;
loc->player->facingAngle = rad;
loc->player->targetFacingAngle = rad;
});
// move_object(name, x, y, z, duration_sec [, on_complete])
api.set_function("move_object",
[loc](const std::string& name, float x, float y, float z,